From d130eced6899d01376ebfa3a3293c713177fefdd Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 17 Jul 2008 18:15:09 +0000 Subject: [PATCH] Merge the following patches from Kevin Beswick: * fixed location to copy apachetools.h from ... * another typo... * fixed directory error in copying of header file. * move one more copy instruction for a header file. * create the perldir and jsdir * changed the place where headers are copied... fixed an error which caused them to be copied wrong. * fixed a capitalization typo issue in src/Makefile.am * updated opensrf.xml.example to use C math and dbmath implementation rather than Perl * fixed make distcheck problems -- builddir needed to be changed to srcdir * fixed directory replacement in .c file problem stopped the command added in the previous revision from running multiple times, fixed the location of the file to execute the command on. * changed where the directory replacement happens for osrf_json_gateway.c (it was after it was compiled rather than before) * corrected another error with installing header files ( can't install directories recursively through the 'prefix_PRIMARY = files' apparently) * went back to old way of copying perlmods and javascript. it will still be included in dist due to EXTRA_DIST in root makefile * fix install of src/javascript and src/perlmods * nobase_dist_lib_DATA defined twice... oops! * fixed problem with order of execution of targets (install-data-local was being executed before files were copied. resulted in an error) * fixed make dist, and changed ways that files are copied to their installed locations * fixed path substitution for the rest of the files with hardcoded paths to ensure correct default functionality of opensrf git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1367 9efc2488-bf62-4759-914b-345cdb29e865 --- Makefile.am | 83 ++++++++++++++++++++++++++- bin/osrf_config.in | 10 ++++ configure.ac | 3 + doc/dokuwiki-doc-stubber.pl | 2 +- examples/math_bench.pl | 2 +- examples/multisession-test.pl | 2 +- examples/opensrf.xml.example | 14 ++--- src/Makefile.am | 40 +++++++------ src/c-apps/Makefile.am | 8 --- src/gateway/osrf_json_gateway.c | 2 +- src/java/{Makefile.in => Makefile.am} | 7 +-- src/libopensrf/Makefile.am | 22 +++---- src/perlmods/OpenSRF/Utils/Config.pm | 4 +- src/python/Makefile.am | 13 +++++ src/python/Makefile.in | 24 -------- 15 files changed, 155 insertions(+), 81 deletions(-) rename src/java/{Makefile.in => Makefile.am} (95%) create mode 100644 src/python/Makefile.am delete mode 100644 src/python/Makefile.in diff --git a/Makefile.am b/Makefile.am index 17da835..6cea90a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,15 +23,93 @@ export APR_HEADERS = @APR_HEADERS@ export ETCDIR = @sysconfdir@ export APXS2 = @APXS2@ export APACHE2_HEADERS = @APACHE2_HEADERS@ -export DEF_CFLAGS = -D_LARGEFILE64_SOURCE $(MAYBE_DEBUG) -pipe -g -Wall -O2 -fPIC -I@abs_top_builddir@/include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) @INCLUDES@ +export DEF_CFLAGS = -D_LARGEFILE64_SOURCE $(MAYBE_DEBUG) -pipe -g -Wall -O2 -fPIC -I@abs_top_srcdir@/include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) @INCLUDES@ export DEF_LDLIBS = -lobjson -lopensrf export VAR = @localstatedir@ export PID = @localstatedir@/run/opensrf export SOCK = @localstatedir@/lock/opensrf export LOG = @localstatedir@/log/opensrf +export srcdir = @srcdir@ AM_CFLAGS = $(DEF_CFLAGS) +DOC_FILES = doc/Application-HOWTO.txt \ + doc/dokuwiki-doc-stubber.pl \ + doc/OpenSRF-Messaging-Protocol.html \ + doc/Persist-API.html \ + doc/Roadmap.txt + +EXAMPLES_FILES = examples/fieldmapper2cdbi.xsl \ + examples/fieldmapper2javascript.xsl \ + examples/fieldmapper2perl.xsl \ + examples/gen-fieldmapper.xml \ + examples/math_bench.pl \ + examples/multisession-test.pl \ + examples/register.pl \ + examples/srfsh_config.xsd \ + examples/math_xul_client/math \ + examples/math_xul_client/install.js + +strn_compat_FILES = src/ports/strn_compat/strndup.c \ + src/ports/strn_compat/strndup.h \ + src/ports/strn_compat/strnlen.c \ + src/ports/strn_compat/strnlen.h + +python_FILES = src/python/opensrf.py \ + src/python/setup.py \ + src/python/srfsh.py \ + src/python/osrf + +java_FILES = src/java/deps.inc \ + src/java/deps.sh \ + src/java/org + +libosrf_FILES = src/libopensrf/basic_client.c \ + src/libopensrf/osrf_big_hash.c \ + src/libopensrf/osrf_big_list.c \ + src/libopensrf/osrfConfig.c + + +EXTRA_DIST = $(DOC_FILES) $(EXAMPLES_FILES) $(libosrf_FILES) $(strn_compat_FILES) $(python_FILES) $(java_FILES) autogen.sh src/extras src/gateway/fieldmapper-c-xml-out.pl DCO-1.1.txt LICENSE.txt src/perlmods src/javascript + +objsonincludedir = @includedir@/objson +opensrfincludedir = @includedir@/opensrf + +OBJINC=@srcdir@/include/objson +OSRFINC=@srcdir@/include/opensrf + +opensrfinclude_HEADERS = $(OSRFINC)/log.h \ + $(OSRFINC)/md5.h \ + $(OSRFINC)/osrf_application.h \ + $(OSRFINC)/osrf_app_session.h \ + $(OSRFINC)/osrf_big_hash.h \ + $(OSRFINC)/osrf_big_list.h \ + $(OSRFINC)/osrf_cache.h \ + $(OSRFINC)/osrfConfig.h \ + $(OSRFINC)/osrf_hash.h \ + $(OSRFINC)/osrf_json.h \ + $(OSRFINC)/osrf_json_utils.h \ + $(OSRFINC)/osrf_json_xml.h \ + $(OSRFINC)/osrf_legacy_json.h \ + $(OSRFINC)/osrf_list.h \ + $(OSRFINC)/osrf_message.h \ + $(OSRFINC)/osrf_prefork.h \ + $(OSRFINC)/osrf_settings.h \ + $(OSRFINC)/osrf_stack.h \ + $(OSRFINC)/osrf_system.h \ + $(OSRFINC)/osrf_transgroup.h \ + $(OSRFINC)/sha.h \ + $(OSRFINC)/socket_bundle.h \ + $(OSRFINC)/string_array.h \ + $(OSRFINC)/transport_client.h \ + $(OSRFINC)/transport_message.h \ + $(OSRFINC)/transport_session.h \ + $(OSRFINC)/utils.h \ + $(OSRFINC)/xml_utils.h + +objsoninclude_HEADERS = $(OBJINC)/json2xml.h $(OBJINC)/json_parser.h $(OBJINC)/object.h $(OBJINC)/xml2json.h + + SUBDIRS = src jserver: @@ -43,3 +121,6 @@ jserver-install: javascript-install: make -s -C src javascript-install +install-data-hook: + mv @srcdir@/src/gateway/apachetools.h @includedir@/opensrf/apachetools.h + diff --git a/bin/osrf_config.in b/bin/osrf_config.in index ce2f69c..bf16852 100644 --- a/bin/osrf_config.in +++ b/bin/osrf_config.in @@ -50,6 +50,14 @@ function showAll { showInstalled; } +function cconfig { + +sed -i 's|SYSCONFDIR|@sysconfdir@|g' '@srcdir@/src/gateway/osrf_json_gateway.c' +sed -i 's|${prefix}|@prefix@|g' '@srcdir@/src/gateway/osrf_json_gateway.c' +sed -i 's|osrf|@abs_top_srcdir@/src/python/osrf|g' '@srcdir@/src/python/setup.py' +sed -i 's|srfsh\.py|@abs_top_srcdir@/src/python/srfsh.py|g' '@srcdir@/src/python/setup.py' +} + function showHelp { echo echo "------------------------------------------------------------" @@ -81,6 +89,8 @@ case "$1" in --installed) showInstalled; ;; + --cconfig) cconfig; + ;; --libxml) echo @LIBXML2_HEADERS@; ;; diff --git a/configure.ac b/configure.ac index 836fb8d..4a5d23e 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_PREFIX_DEFAULT([/opensrf/]) AC_SUBST(prefix) +AC_SUBST(sysconfdir) AC_DEFUN([AC_PYTHON_MOD],[ @@ -274,6 +275,8 @@ AC_CONFIG_FILES([Makefile AC_OUTPUT +bin/osrf_config --cconfig + AC_MSG_RESULT([]) AC_MSG_RESULT([--------------------- Configuration options: -----------------------]) diff --git a/doc/dokuwiki-doc-stubber.pl b/doc/dokuwiki-doc-stubber.pl index 0182745..c098cc8 100755 --- a/doc/dokuwiki-doc-stubber.pl +++ b/doc/dokuwiki-doc-stubber.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -use OpenSRF::System qw(/openils/conf/opensrf_core.xml); +use OpenSRF::System qw(SYSCONFDIR/opensrf_core.xml); use Getopt::Long $| = 1; diff --git a/examples/math_bench.pl b/examples/math_bench.pl index f83e0fc..6dd94ac 100755 --- a/examples/math_bench.pl +++ b/examples/math_bench.pl @@ -13,7 +13,7 @@ my $count = $ARGV[0]; print "usage: $0 \n" and exit unless $count; # * connect to the Jabber network -OpenSRF::System->bootstrap_client( config_file => "/openils/conf/opensrf_core.xml" ); +OpenSRF::System->bootstrap_client( config_file => "SYSCONFDIR/opensrf_core.xml" ); $log->set_service('math_bench'); # * create a new application session for the opensrf.math service diff --git a/examples/multisession-test.pl b/examples/multisession-test.pl index 21c0c99..01ad495 100755 --- a/examples/multisession-test.pl +++ b/examples/multisession-test.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -use lib '/openils/lib/perl5/'; +use lib 'LIBDIR/perl5/'; use OpenSRF::System; use OpenILS::Application::AppUtils; use OpenILS::Event; diff --git a/examples/opensrf.xml.example b/examples/opensrf.xml.example index 91198f9..3b0ec67 100644 --- a/examples/opensrf.xml.example +++ b/examples/opensrf.xml.example @@ -44,7 +44,7 @@ vim:et:ts=2:sw=2: - localhost:11211 + 127.0.0.1:10101 @@ -131,8 +131,8 @@ vim:et:ts=2:sw=2: 3 1 - perl - OpenSRF::Application::Demo::Math + c + libosrf_math.so 97 opensrf.math_unix.sock @@ -149,8 +149,8 @@ vim:et:ts=2:sw=2: 3 1 - perl - OpenSRF::Application::Demo::MathDB + c + libosrf_dbmath.so 99 1000 @@ -166,13 +166,13 @@ vim:et:ts=2:sw=2: 1 - 1 + 0 perl OpenSRF::Application::Settings 17 opensrf.settings_unix.sock - opensrf.settings_unix.pid + opoensrf.settings_unix.pid 1000 opensrf.settings_unix.log 5 diff --git a/src/Makefile.am b/src/Makefile.am index 7056aea..f16796e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,11 +18,11 @@ export TMPDIR = $(TMP) export OPENSRF = opensrf export BINDIR = @bindir@ export LIBDIR = @libdir@ -export PERLDIR = $(LIBDIR)/perl5 -export JSDIR = $(LIBDIR)/javascript +perldir = $(LIBDIR)/perl5 +jsdir = $(LIBDIR)/javascript export INCLUDEDIR= @includedir@ export OSRF_JAVA_DEPSDIR = @OSRF_JAVA_DEPSDIR@ - +etcdir = $(ETCDIR) AM_LDFLAGS = $(DEF_LDFLAGS) @@ -43,30 +43,36 @@ endif SUBDIRS = libopensrf c-apps router srfsh jserver gateway $(MAYBE_PY) $(MAYBE_JA) -install-data-local: +dist_bin_SCRIPTS = ../bin/osrf_ctl.sh +bin_SCRIPTS = ../bin/osrf_config + +dist_etc_DATA = @top_srcdir@/examples/opensrf.xml.example @top_srcdir@/examples/opensrf_core.xml.example @top_srcdir@/examples/srfsh.xml.example + +install-exec-local: mkdir -p $(VAR) mkdir -p $(PID) mkdir -p $(LOG) mkdir -p $(SOCK) - mkdir -p $(JSDIR) - mkdir -p $(PERLDIR) mkdir -p $(ETCDIR) - cp -r ../include/opensrf $(INCLUDEDIR) - mv $(BINDIR)/opensrf $(BINDIR)/opensrf-c - cp ../bin/osrf_config $(BINDIR) - cp ../bin/osrf_ctl.sh $(BINDIR) - cp ../examples/opensrf.xml.example $(ETCDIR) - cp ../examples/opensrf_core.xml.example $(ETCDIR) - cp ../examples/srfsh.xml.example $(ETCDIR) + mkdir -p $(jsdir) + mkdir -p $(perldir) + +install-data-hook: + ln -s $(BINDIR)/opensrf $(BINDIR)/opensrf-c sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(ETCDIR)/opensrf.xml.example' sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(ETCDIR)/opensrf.xml.example' sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(ETCDIR)/opensrf_core.xml.example' sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(ETCDIR)/opensrf_core.xml.example' sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(ETCDIR)/srfsh.xml.example' sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(ETCDIR)/srfsh.xml.example' - cp -r ../include/objson $(INCLUDEDIR) - cp -r javascript/* $(JSDIR)/ - cp -r perlmods/* $(PERLDIR)/ - mv $(INCLUDEDIR)/apachetools.h $(INCLUDEDIR)/opensrf/apachetools.h + sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '@abs_top_srcdir@/examples/math_bench.pl' + sed -i 's|LIBDIR|$(LIBDIR)|g' '@abs_top_srcdir@/examples/multisession-test.pl' + sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '@abs_top_srcdir@/doc/dokuwiki-doc-stubber.pl' + cp -r @srcdir@/javascript/* $(jsdir)/ + sed -i 's|LOCALSTATEDIR|$(VAR)|g' '@srcdir@/perlmods/OpenSRF/Utils/Config.pm' + cp -r @srcdir@/perlmods/* $(perldir)/ +uninstall-hook: + rm $(INCLUDEDIR)/opensrf/apachetools.h + rm $(bindir)/opensrf-c diff --git a/src/c-apps/Makefile.am b/src/c-apps/Makefile.am index c07df0d..9cd583e 100644 --- a/src/c-apps/Makefile.am +++ b/src/c-apps/Makefile.am @@ -26,11 +26,3 @@ libosrf_math_la_SOURCES = osrf_math.c libosrf_math_la_LIBADD = -lobjson -lopensrf libosrf_version_la_SOURCES = osrf_version.c libosrf_version_la_LIBADD = -lobjson -lopensrf - -## rename libraries (libtool requires the prefix lib, but we dont use that here) -## remove extra library files created by libtool -install-exec-hook: - cp $(LIBDIR)/libosrf_math.so $(LIBDIR)/osrf_math.so - cp $(LIBDIR)/libosrf_dbmath.so $(LIBDIR)/osrf_dbmath.so - cp $(LIBDIR)/libosrf_version.so $(LIBDIR)/osrf_version.so - rm $(LIBDIR)/libosrf* diff --git a/src/gateway/osrf_json_gateway.c b/src/gateway/osrf_json_gateway.c index 2921c6b..162e3ac 100644 --- a/src/gateway/osrf_json_gateway.c +++ b/src/gateway/osrf_json_gateway.c @@ -18,7 +18,7 @@ #define JSON_PROTOCOL "OSRFGatewayLegacyJSON" #define GATEWAY_USE_LEGACY_JSON 1 -#define GATEWAY_DEFAULT_CONFIG "/openils/conf/opensrf_core.xml" +#define GATEWAY_DEFAULT_CONFIG "SYSCONFDIR/opensrf_core.xml" /* our config structure */ diff --git a/src/java/Makefile.in b/src/java/Makefile.am similarity index 95% rename from src/java/Makefile.in rename to src/java/Makefile.am index a420f98..07d5fa1 100644 --- a/src/java/Makefile.in +++ b/src/java/Makefile.am @@ -10,7 +10,7 @@ JAVA_SRC = \ #------------------------------------------------------------------ -all: verify_deps dirs jar +all-local: verify_deps dirs jar verify_deps: @if [ ! -e "$(OSRF_JAVA_DEPSDIR)/$(WSTX)" ]; then echo -e "\nmissing dependency $(WSTX)!\n" && exit 1; fi @@ -47,13 +47,10 @@ docs: javadoc -classpath $(JAVA_LIBS) -d doc @files; rm files; -install: +install-data-local: mkdir -p $(LIBDIR)/java cp opensrf.jar $(LIBDIR)/java -clean: - rm -fr opensrf.jar $(JAVA_LIBDIR) - dep_clean: rm -rf deps diff --git a/src/libopensrf/Makefile.am b/src/libopensrf/Makefile.am index a6129c7..68b46e7 100644 --- a/src/libopensrf/Makefile.am +++ b/src/libopensrf/Makefile.am @@ -16,7 +16,7 @@ AM_CFLAGS = $(DEF_CFLAGS) -DASSUME_STATELESS -DOSRF_STRICT_PARAMS -rdynamic -fn AM_LDFLAGS = $(DEF_LDFLAGS) LDADD = -lxml2 -ldl -lmemcache -lopensrf -lobjson -export OSRF_INC = @abs_top_builddir@/include/opensrf/ +OSRF_INC = @top_srcdir@/include/opensrf TARGS = osrf_message.c \ osrf_app_session.c \ @@ -78,19 +78,15 @@ JSON_DEP = osrf_list.c\ md5.c\ string_array.c -JSON_TARGS_HEADS = $(OSRF_INC)/osrf_json_object.h\ - $(OSRF_INC)/osrf_json_parser.h \ - $(OSRF_INC)/osrf_json_tools.h \ - $(OSRF_INC)/osrf_legacy_json.h \ - $(OSRF_INC)/osrf_json_xml.h - -JSON_DEP_HEADS = $(OSRF_INC)/osrf_list.h\ - $(OSRF_INC)/osrf_hash.h\ - $(OSRF_INC)/utils.h\ - $(OSRF_INC)/log.h\ - $(OSRF_INC)/md5.h\ - $(OSRF_INC)/string_array.h +JSON_TARGS_HEADS = $(OSRF_INC)/osrf_legacy_json.h \ + $(OSRF_INC)/osrf_json_xml.h +JSON_DEP_HEADS = $(OSRF_INC)/osrf_list.h \ + $(OSRF_INC)/osrf_hash.h \ + $(OSRF_INC)/utils.h \ + $(OSRF_INC)/log.h \ + $(OSRF_INC)/md5.h \ + $(OSRF_INC)/string_array.h noinst_PROGRAMS = osrf_json_test diff --git a/src/perlmods/OpenSRF/Utils/Config.pm b/src/perlmods/OpenSRF/Utils/Config.pm index 6dfd5e4..b01cad2 100755 --- a/src/perlmods/OpenSRF/Utils/Config.pm +++ b/src/perlmods/OpenSRF/Utils/Config.pm @@ -153,7 +153,7 @@ Given an OpenSRF configuration file named F with the following otherhost - /openils/var/log/osrfsys.log + LOCALSTATEDIR/log/osrfsys.log @@ -163,7 +163,7 @@ with the following structure: { router_name => 'router', routers => ['localhost', 'otherhost'], - logfile => '/openils/var/log/osrfsys.log' + logfile => 'LOCALSTATEDIR/log/osrfsys.log' } You can retrieve any of these values by name from the bootstrap section of C<$config_obj>; for example: diff --git a/src/python/Makefile.am b/src/python/Makefile.am new file mode 100644 index 0000000..00b9e48 --- /dev/null +++ b/src/python/Makefile.am @@ -0,0 +1,13 @@ +# makefile for OpenSRF Python modules and scripts + +all-local: + @echo $@ + python @srcdir@/setup.py build + +# ------------------------------------------------------------------------------ +# INSTALL +# ------------------------------------------------------------------------------ +install-data-local: + @echo $@ + python @srcdir@/setup.py install + diff --git a/src/python/Makefile.in b/src/python/Makefile.in deleted file mode 100644 index 4a3061d..0000000 --- a/src/python/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# makefile for OpenSRF Python modules and scripts - -all: build - -# ------------------------------------------------------------------------------ -# BUILD -# ------------------------------------------------------------------------------ -build: - @echo $@ - python setup.py build - -# ------------------------------------------------------------------------------ -# INSTALL -# ------------------------------------------------------------------------------ -install: build - @echo $@ - python setup.py install - -# ------------------------------------------------------------------------------ -# CLEAN -# ------------------------------------------------------------------------------ -clean: - python setup.py clean --all - -- 2.43.2