Commit autotools patch from Kevin Beswick
authordbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 28 Jul 2008 03:55:01 +0000 (03:55 +0000)
committerdbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 28 Jul 2008 03:55:01 +0000 (03:55 +0000)
(adjusted slightly for Bill's objson API compatibility layer removal)

Enclosed is a patch to update the OpenSRF autotools implementation. It
fixes most bugs such as:
-correctly replacing hardcoded directory paths in various files
-correctly implementing clean, and uninstall make targets
-fixes building src/c-apps modules without the lib prefix
-builds the src/gateway apache modules with apxs
-fixed the naming of the opensrf-c binary

Also, it implements more of the autotools features:
-rolling a tarball with make dist
-enables VPATH (parallel) builds
-checking a distribution with make distcheck

-------------------------------------------

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
   have the right to submit it under the open source license
   indicated in the file; or

(b) The contribution is based upon previous work that, to the best
   of my knowledge, is covered under an appropriate open source
   license and I have the right under that license to submit that
   work with modifications, whether created in whole or in part
   by me, under the same open source license (unless I am
   permitted to submit under a different license), as indicated
   in the file; or

(c) The contribution was provided directly to me by some other
   person who certified (a), (b) or (c) and I have not modified
   it.

(d) I understand and agree that this project and the contribution
   are public and that a record of the contribution (including all
   personal information I submit with it, including my sign-off) is
   maintained indefinitely and may be redistributed consistent with
   this project or the open source license(s) involved.

Signed-off-by: [Kevin Beswick (kevinbeswick00@gmail.com)]
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1375 9efc2488-bf62-4759-914b-345cdb29e865

13 files changed:
Makefile.am
bin/osrf_config.in
include/opensrf/osrfConfig.h
src/Makefile.am
src/c-apps/Makefile.am
src/gateway/Makefile.am
src/jserver/Makefile.am
src/libopensrf/Makefile.am
src/python/Makefile.am
src/python/setup.py [deleted file]
src/python/setup.py.in [new file with mode: 0644]
src/router/Makefile.am
src/srfsh/Makefile.am

index b2b1f35..8d1b133 100644 (file)
@@ -33,44 +33,44 @@ 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
+DOC_FILES = @srcdir@/doc/Application-HOWTO.txt \
+           @srcdir@/doc/dokuwiki-doc-stubber.pl \
+           @srcdir@/doc/OpenSRF-Messaging-Protocol.html \
+           @srcdir@/doc/Persist-API.html \
+           @srcdir@/doc/Roadmap.txt
+
+EXAMPLES_FILES = @srcdir@/examples/fieldmapper2cdbi.xsl \
+                @srcdir@/examples/fieldmapper2javascript.xsl \
+                @srcdir@/examples/fieldmapper2perl.xsl \
+                @srcdir@/examples/gen-fieldmapper.xml \
+                @srcdir@/examples/math_bench.pl \
+                @srcdir@/examples/multisession-test.pl \
+                @srcdir@/examples/register.pl \
+                @srcdir@/examples/srfsh_config.xsd \
+                @srcdir@/examples/math_xul_client/math \
+                @srcdir@/examples/math_xul_client/install.js
+
+strn_compat_FILES = @srcdir@/src/ports/strn_compat/strndup.c \
+                   @srcdir@/src/ports/strn_compat/strndup.h \
+                   @srcdir@/src/ports/strn_compat/strnlen.c \
+                   @srcdir@/src/ports/strn_compat/strnlen.h
+
+python_FILES = @srcdir@/src/python/opensrf.py \
+              @srcdir@/src/python/setup.py \
+              @srcdir@/src/python/srfsh.py \
+              @srcdir@/src/python/osrf
+
+java_FILES = @srcdir@/src/java/deps.inc \
+            @srcdir@/src/java/deps.sh \
+            @srcdir@/src/java/org
+
+libosrf_FILES = @srcdir@/src/libopensrf/basic_client.c \
+               @srcdir@/src/libopensrf/osrf_big_hash.c \
+               @srcdir@/src/libopensrf/osrf_big_list.c \
+               @srcdir@/src/libopensrf/osrfConfig.c
+
+
+EXTRA_DIST = $(DOC_FILES) $(EXAMPLES_FILES) $(libosrf_FILES) $(strn_compat_FILES) $(python_FILES) $(java_FILES) @srcdir@/autogen.sh @srcdir@/src/extras @srcdir@/DCO-1.1.txt @srcdir@/LICENSE.txt @srcdir@/src/perlmods @srcdir@/src/javascript
 
 opensrfincludedir = @includedir@/opensrf
 
@@ -119,5 +119,5 @@ javascript-install:
        make -s -C src javascript-install
 
 install-data-hook:
-       mv @srcdir@/src/gateway/apachetools.h @includedir@/opensrf/apachetools.h
+       cp @srcdir@/src/gateway/apachetools.h @includedir@/opensrf/apachetools.h
 
index bf16852..359a034 100644 (file)
@@ -52,10 +52,8 @@ function showAll {
 
 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'
+sed -e 's|osrf|@abs_top_srcdir@/src/python/osrf|g' \
+    -e 's|srfsh\.py|@abs_top_srcdir@/src/python/srfsh.py|g' @srcdir@/src/python/setup.py.in > @srcdir@/src/python/setup.py
 }
 
 function showHelp {
index b3fd60c..64f9ca6 100644 (file)
@@ -46,10 +46,10 @@ int osrfConfigHasDefaultConfig();
 
 /**
        Replaces the config object's json object.  This is useful
-       if you have an ojbson object already and not an XML config
+       if you have a json object already and not an XML config
        file to parse.
        @param cfg The config object to alter
-       @param obj The json objet to use when searching values
+       @param obj The json object to use when searching values
 */
 void osrfConfigReplaceConfig(osrfConfig* cfg, const jsonObject* obj);
 
index 12fb2b9..4ecc96a 100644 (file)
 
 # Declare some directory variables
 
-export TMPDIR  = $(TMP)
 export OPENSRF = opensrf
 export BINDIR  = @bindir@
 export LIBDIR  = @libdir@
 perldir        = $(LIBDIR)/perl5
 jsdir = $(LIBDIR)/javascript
-export INCLUDEDIR= @includedir@
 export OSRF_JAVA_DEPSDIR = @OSRF_JAVA_DEPSDIR@
 etcdir = $(ETCDIR)
 
@@ -38,28 +36,26 @@ endif
 
 SUBDIRS = libopensrf c-apps router srfsh jserver gateway $(MAYBE_PY) $(MAYBE_JA)
 
-dist_bin_SCRIPTS = ../bin/osrf_ctl.sh
-bin_SCRIPTS = ../bin/osrf_config
+dist_bin_SCRIPTS = @top_srcdir@/bin/osrf_ctl.sh
+bin_SCRIPTS = @top_srcdir@/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 
+dist_sysconf_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 $(ETCDIR)
        mkdir -p $(jsdir)
        mkdir -p $(perldir)
 
-install-data-hook:
-       ln -sf $(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'
+install-exec-hook:
+       sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
+       sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
+       sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
+       sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
+       sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(DESTDIR)@sysconfdir@/srfsh.xml.example'
+       sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(DESTDIR)@sysconfdir@/srfsh.xml.example'
        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'
@@ -69,5 +65,7 @@ install-data-hook:
 
 
 uninstall-hook:
-       rm $(INCLUDEDIR)/opensrf/apachetools.h
-       rm $(bindir)/opensrf-c
+       rm @includedir@/opensrf/apachetools.h
+       rm -R $(jsdir)
+       rm -R $(perldir)
+
index b3d9574..80e0e3d 100644 (file)
 
 
 AM_CFLAGS = $(DEF_CFLAGS) -DORSF_LOG_PARAMS 
-AM_LDFLAGS = $(DEF_LDFLAGS) -L../libopensrf/
+AM_LDFLAGS = $(DEF_LDFLAGS) -L@top_builddir@/src/libopensrf
 
 noinst_PROGRAMS = timejson
-lib_LTLIBRARIES = libosrf_dbmath.la libosrf_math.la libosrf_version.la
+lib_LTLIBRARIES = osrf_dbmath.la osrf_math.la osrf_version.la
 
 timejson_SOURCES = timejson.c
 timejson_LDADD = -lopensrf
-libosrf_dbmath_la_SOURCES = osrf_dbmath.c 
-libosrf_dbmath_la_LIBADD = -lopensrf
-libosrf_math_la_SOURCES = osrf_math.c
-libosrf_math_la_LIBADD =  -lopensrf
-libosrf_version_la_SOURCES = osrf_version.c 
-libosrf_version_la_LIBADD = -lopensrf
+osrf_dbmath_la_SOURCES = osrf_dbmath.c 
+osrf_dbmath_la_LDFLAGS = $(AM_LDFLAGS) -module
+osrf_dbmath_la_LIBADD = -lopensrf
+osrf_math_la_SOURCES = osrf_math.c
+osrf_math_la_LDFLAGS = $(AM_LDFLAGS) -module
+osrf_math_la_LIBADD =  -lopensrf
+osrf_version_la_SOURCES = osrf_version.c 
+osrf_version_la_LDFLAGS = $(AM_LDFLAGS) -module
+osrf_version_la_LIBADD = -lopensrf
index 163061b..fa83b94 100644 (file)
 # GNU General Public License for more details.
 
 
-AM_LDFLAGS = $(DEF_LDFLAGS)
-AM_CFLAGS = $(DEF_CFLAGS) -DASSUME_STATELESS -L../libopensrf/
+EXTRA_DIST = @srcdir@/apachetools.c @srcdir@/apachetools.h @srcdir@/osrf_json_gateway.c @srcdir@/osrf_http_translator.c
 
-curdir = @abs_top_builddir@/src/gateway/
+options=-D_LARGEFILE64_SOURCE -Wall -I@abs_top_srcdir@/include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) -L$(LIBDIR) -L@top_builddir@/src/libopensrf
 
-cur_LTLIBRARIES = libosrf_json_gateway.la libosrf_http_translator.la
-libosrf_json_gateway_la_SOURCES = apachetools.c apachetools.h osrf_json_gateway.c
-libosrf_json_gateway_la_LIBADD = -lopensrf
-libosrf_http_translator_la_SOURCES = apachetools.c apachetools.h osrf_http_translator.c
-libosrf_http_translator_la_LIBADD = -lopensrf
-
-include_HEADERS = apachetools.h
+all-local:
+       $(APXS2) -c $(DEF_LDLIBS) $(options) @srcdir@/osrf_json_gateway.c
+       $(APXS2) -c $(DEF_LDLIBS) $(options) @srcdir@/osrf_http_translator.c
 
 install-exec-local: 
-       cp .libs/libosrf_json_gateway.so osrf_json_gateway.so
-       $(APXS2) -i -a -n osrf_json_gateway osrf_json_gateway.so
-       cp .libs/libosrf_http_translator.so osrf_http_translator.so
-       $(APXS2) -i -a -n osrf_http_translator osrf_http_translator.so
+       $(APXS2) -i -a @srcdir@/osrf_json_gateway.c
+       $(APXS2) -i -a @srcdir@/osrf_http_translator.c
+
+clean-local:
+       rm -f @srcdir@/osrf_http_translator.la @srcdir@/osrf_http_translator.lo @srcdir@/osrf_http_translator.slo @srcdir@/osrf_json_gateway.la @srcdir@/osrf_json_gateway.lo @srcdir@/osrf_json_gateway.slo
index c0e61a7..03eab79 100644 (file)
@@ -13,7 +13,7 @@
 
 
 LDADD = -lxml2 $(DEF_LDLIBS)
-AM_CFLAGS = $(DEF_CFLAGS) -D_GNU_SOURCE -L../libopensrf/
+AM_CFLAGS = $(DEF_CFLAGS) -D_GNU_SOURCE -L@top_builddir@/src/libopensrf
 AM_LDFLAGS = $(DEF_LDFLAGS)
 
 bin_PROGRAMS = chopchop
index 40aac2c..1955334 100644 (file)
@@ -90,9 +90,9 @@ JSON_DEP_HEADS =      $(OSRF_INC)/osrf_list.h \
 
 noinst_PROGRAMS = osrf_json_test
 
-bin_PROGRAMS = opensrf
-opensrf_SOURCES = opensrf.c
-opensrf_DEPENDENCIES = libopensrf.la
+bin_PROGRAMS = opensrf-c
+opensrf_c_SOURCES = opensrf.c
+opensrf_c_DEPENDENCIES = libopensrf.la
 
 osrf_json_test_SOURCES = osrf_json_test.c $(JSON_TARGS) $(JSON_DEP) $(JSON_TARGS_HEADS) $(JSON_DEP_HEADS)
 
@@ -105,9 +105,5 @@ libosrf_json_la_CFLAGS = $(AM_CFLAGS)
 libopensrf_la_CFLAGS = $(AM_CFLAGS)
 libopensrf_la_DEPENDENCIES = libosrf_json.la
 
-if BUILDJSON
-libopensrf_la_SOURCES = $(TARGS) $(TARGS_HEADS)
-else
 libopensrf_la_SOURCES = $(TARGS) $(TARGS_HEADS) $(JSON_TARGS) $(JSON_TARGS_HEADS)
-endif
 
index 00b9e48..6225f27 100644 (file)
@@ -11,3 +11,12 @@ install-data-local:
        @echo $@
        python @srcdir@/setup.py install
 
+distclean-local:
+       rm @builddir@/OpenSRF.egg-info/PKG-INFO
+       rm @builddir@/OpenSRF.egg-info/requires.txt
+       rm @builddir@/OpenSRF.egg-info/top_level.txt
+       rm @builddir@/OpenSRF.egg-info/SOURCES.txt
+       rm @builddir@/OpenSRF.egg-info/dependency_links.txt
+       rm @builddir@/build/scripts-2.5/srfsh.py
+       rm @builddir@/dist/OpenSRF-1.0.0-py2.5.egg
+
diff --git a/src/python/setup.py b/src/python/setup.py
deleted file mode 100644 (file)
index 1b841ae..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-
-from setuptools import setup
-
-setup(name='OpenSRF',
-    version='1.0.0',
-    install_requires=[
-        'dnspython', # required by pyxmpp
-       'python-memcached',
-        'pyxmpp>=1.0.0',
-        'simplejson>=1.7.1'
-    ],
-    dependency_links = [
-        "http://pyxmpp.jajcus.net/downloads/",
-        "ftp://ftp.tummy.com/pub/python-memcached/python-memcached-latest.tar.gz"
-    ],
-    description='OpenSRF Python Modules',
-    author='Bill Erickson',
-    author_email='erickson@esilibrary.com',
-    license="GPL",
-    url='http://www.open-ils.org/',
-    packages=['osrf'],
-    scripts=['srfsh.py']
-)
diff --git a/src/python/setup.py.in b/src/python/setup.py.in
new file mode 100644 (file)
index 0000000..1b841ae
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+from setuptools import setup
+
+setup(name='OpenSRF',
+    version='1.0.0',
+    install_requires=[
+        'dnspython', # required by pyxmpp
+       'python-memcached',
+        'pyxmpp>=1.0.0',
+        'simplejson>=1.7.1'
+    ],
+    dependency_links = [
+        "http://pyxmpp.jajcus.net/downloads/",
+        "ftp://ftp.tummy.com/pub/python-memcached/python-memcached-latest.tar.gz"
+    ],
+    description='OpenSRF Python Modules',
+    author='Bill Erickson',
+    author_email='erickson@esilibrary.com',
+    license="GPL",
+    url='http://www.open-ils.org/',
+    packages=['osrf'],
+    scripts=['srfsh.py']
+)
index e3e3ade..d777f3b 100644 (file)
@@ -13,7 +13,7 @@
 
 
 LDADD = -lxml2 $(DEF_LDLIBS) 
-AM_CFLAGS = $(DEF_CFLAGS) -D_ROUTER -L../libopensrf/
+AM_CFLAGS = $(DEF_CFLAGS) -D_ROUTER -L@top_builddir@/src/libopensrf
 AM_LDFLAGS = $(DEF_LDFLAGS)
 
 bin_PROGRAMS = opensrf_router
index fb234b4..5c9f451 100644 (file)
@@ -13,7 +13,7 @@
 
 
 LDADD = -lreadline -lxml2 -lncurses $(DEF_LDLIBS) 
-AM_CFLAGS = $(DEF_CFLAGS) -DEXEC_DEFAULT -L../libopensrf/
+AM_CFLAGS = $(DEF_CFLAGS) -DEXEC_DEFAULT -L@top_builddir@/src/libopensrf
 AM_LDFLAGS = $(DEF_LDFLAGS)
 
 bin_PROGRAMS = srfsh