From e30e8e8d042790df94a05e182452bb46e41278da Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 14 Sep 2009 04:02:04 +0000 Subject: [PATCH] Make building & installing the core components of OpenSRF optional. For now, this will be of most interest to those interested in installing only the JavaScript files from OpenSRF. If you disable the core components in configure, then dependency checking for those core components is skipped and the JavaScript files will be installed to the desired location. For example: ./autogen.sh ./configure --prefix=/openils --sysconfdir=/openils/conf --disable-core sudo make install ... will result in only the OpenSRF JavaScript files being installed in /openils/lib/javascript/ (although at the moment, the other directories will still be created). git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1783 9efc2488-bf62-4759-914b-345cdb29e865 --- Makefile.am | 70 ++++++++-------- configure.ac | 206 +++++++++++++++++++++++++++--------------------- src/Makefile.am | 30 ++++--- 3 files changed, 165 insertions(+), 141 deletions(-) diff --git a/Makefile.am b/Makefile.am index 12c5c88..e2f8f0b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,40 +81,40 @@ libosrf_FILES = @srcdir@/src/libopensrf/basic_client.c \ EXTRA_DIST = $(DOC_FILES) $(EXAMPLES_FILES) $(libosrf_FILES) $(strn_compat_FILES) $(python_FILES) $(java_FILES) @srcdir@/autogen.sh @srcdir@/src/extras @srcdir@/COPYING @srcdir@/DCO-1.1.txt @srcdir@/LICENSE.txt @srcdir@/src/perl @srcdir@/src/javascript -opensrfincludedir = @includedir@/opensrf - 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 - +if BUILDCORE + include_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 \ + src/gateway/apachetools.h +endif SUBDIRS = src @@ -124,12 +124,6 @@ jserver: jserver-install: make -s -C src jserver-install -javascript-install: - make -s -C src javascript-install - -install-data-hook: - cp @srcdir@/src/gateway/apachetools.h @includedir@/opensrf/apachetools.h - distclean-local: rm -rf ./autom4te.cache - rm -rf ./m4 \ No newline at end of file + rm -rf ./m4 diff --git a/configure.ac b/configure.ac index 53307f6..8bdf183 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,33 @@ esac], AM_CONDITIONAL([BUILDJAVA], [test x$OSRF_INSTALL_JAVA = xtrue]) AC_SUBST([OSRF_INSTALL_JAVA]) +# install the javascript files? +AC_ARG_ENABLE([javascript], +[ --disable-javascript disable installing JavaScript libraries], +[case "${enableval}" in + yes) OSRF_INSTALL_JAVASCRIPT=true ;; + no) OSRF_INSTALL_JAVASCRIPT=false ;; + *) AC_MSG_ERROR([please choose another value for --disable-javascript (supported values are yes or no)]) ;; +esac], +[OSRF_INSTALL_JAVASCRIPT=true]) + +AM_CONDITIONAL([INSTALLJAVASCRIPT], [test x$OSRF_INSTALL_JAVASCRIPT = xtrue]) +AC_SUBST([OSRF_INSTALL_JAVASCRIPT]) + +# install the OpenSRF core files? +AC_ARG_ENABLE([core], +[ --disable-core disable installing core files], +[case "${enableval}" in + yes) OSRF_INSTALL_CORE=true ;; + no) OSRF_INSTALL_CORE=false ;; + *) AC_MSG_ERROR([please choose another value for --disable-core (supported values are yes or no)]) ;; +esac], +[OSRF_INSTALL_CORE=true]) + +AM_CONDITIONAL([BUILDCORE], [test x$OSRF_INSTALL_CORE = xtrue]) +AC_SUBST([OSRF_INSTALL_CORE]) + + # build and install the python modules AC_ARG_ENABLE([python], [ --enable-python enable building and installing python modules], @@ -92,14 +119,11 @@ AC_ARG_ENABLE(debug, esac],[debug=false]) AM_CONDITIONAL(DEBUG, test x$debug = xtrue) - # path to the directory containing the java dependency jar files (included if java installs) if test $OSRF_INSTALL_JAVA; then AC_SUBST([OSRF_JAVA_DEPSDIR], [/opt/java]) fi - - #-------------------------------- # Checks for programs. #-------------------------------- @@ -176,97 +200,99 @@ AC_SUBST(LIBDIRS) IFS=${IFSBAK} -#-------------------------------- -# Check for dependencies. -#-------------------------------- - -#APACHE PREFORK DEV TEST -AC_MSG_CHECKING([APXS]) -if test -f "${APXS2}"; then -AC_MSG_RESULT([yes]) -else -AC_MSG_ERROR([*** apxs not found, aborting]) -fi - -#PYTHON TESTS -if test x$OSRF_INSTALL_PYTHON = xtrue; then - AC_CHECK_PROG([HAVE_PYTHON],python,yes,no) - if test $HAVE_PYTHON = "no"; then - AC_MSG_ERROR([*** python not found, aborting]) - fi - AC_PYTHON_MOD([setuptools]) -fi - - -#----------------------------- -# Checks for libraries. -#----------------------------- - -AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl)) -AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache development headers)) -AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers)) -AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers)) -AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers)) - - - -#----------------------------- -# Checks for header files. -#----------------------------- - -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h]) - -#------------------------------------------------------------------ -# Checks for typedefs, structures, and compiler characteristics. -#------------------------------------------------------------------ - -AC_C_CONST -AC_C_INLINE -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM - -#---------------------------------- -# Checks for library functions. -#---------------------------------- +AC_CONFIG_FILES([Makefile + src/Makefile]) -AC_FUNC_FORK -AC_FUNC_MALLOC -AC_FUNC_SELECT_ARGTYPES -AC_TYPE_SIGNAL -AC_FUNC_STRFTIME -AC_FUNC_STRTOD -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol]) +if test "x$OSRF_INSTALL_CORE" = "xtrue"; then + #-------------------------------- + # Check for dependencies. + #-------------------------------- -#------------------------------------ -# Configuration and output -#------------------------------------ + #APACHE PREFORK DEV TEST + AC_MSG_CHECKING([APXS]) + if test -f "${APXS2}"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([*** apxs not found, aborting]) + fi + + #PYTHON TESTS + if test x$OSRF_INSTALL_PYTHON = xtrue; then + AC_CHECK_PROG([HAVE_PYTHON],python,yes,no) + if test $HAVE_PYTHON = "no"; then + AC_MSG_ERROR([*** python not found, aborting]) + fi + AC_PYTHON_MOD([setuptools]) + fi -AC_CONFIG_FILES([Makefile - doc/dokuwiki-doc-stubber.pl - examples/math_xul_client/Makefile - examples/math_bench.pl - examples/math_client.py - examples/multisession-test.pl - src/Makefile - src/c-apps/Makefile - src/gateway/Makefile - src/java/Makefile - src/jserver/Makefile - src/libopensrf/Makefile - src/perl/Makefile - src/ports/strn_compat/Makefile - src/python/Makefile - src/router/Makefile - src/srfsh/Makefile - bin/opensrf-perl.pl - bin/osrf_config - bin/osrf_ctl.sh]) + #----------------------------- + # Checks for libraries. + #----------------------------- + + AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl)) + AC_SEARCH_LIBS([mc_req_free], [memcache], [], AC_MSG_ERROR(***OpenSRF requires memcache development headers)) + AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR(***OpenSRF requires ncurses development headers)) + AC_CHECK_LIB([readline], [readline], [], AC_MSG_ERROR(***OpenSRF requires readline development headers)) + AC_CHECK_LIB([xml2], [xmlAddID], [], AC_MSG_ERROR(***OpenSRF requires xml2 development headers)) + + + + #----------------------------- + # Checks for header files. + #----------------------------- + + AC_HEADER_STDC + AC_HEADER_SYS_WAIT + AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h]) + + #------------------------------------------------------------------ + # Checks for typedefs, structures, and compiler characteristics. + #------------------------------------------------------------------ + + AC_C_CONST + AC_C_INLINE + AC_TYPE_PID_T + AC_TYPE_SIZE_T + AC_HEADER_TIME + AC_STRUCT_TM + + #---------------------------------- + # Checks for library functions. + #---------------------------------- + + AC_FUNC_FORK + AC_FUNC_MALLOC + AC_FUNC_SELECT_ARGTYPES + AC_TYPE_SIGNAL + AC_FUNC_STRFTIME + AC_FUNC_STRTOD + AC_FUNC_VPRINTF + AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol]) + + #------------------------------------ + # Configuration and output + #------------------------------------ + + AC_CONFIG_FILES([doc/dokuwiki-doc-stubber.pl + examples/math_xul_client/Makefile + examples/math_bench.pl + examples/math_client.py + examples/multisession-test.pl + src/c-apps/Makefile + src/gateway/Makefile + src/java/Makefile + src/jserver/Makefile + src/libopensrf/Makefile + src/perl/Makefile + src/ports/strn_compat/Makefile + src/python/Makefile + src/router/Makefile + src/srfsh/Makefile + bin/opensrf-perl.pl + bin/osrf_config + bin/osrf_ctl.sh]) +fi AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index d9389d5..78bf581 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,7 +17,6 @@ export OPENSRF = opensrf export BINDIR = @bindir@ export LIBDIR = @libdir@ -jsdir = $(LIBDIR)/javascript export OSRF_JAVA_DEPSDIR = @OSRF_JAVA_DEPSDIR@ etcdir = $(ETCDIR) @@ -34,30 +33,35 @@ if BUILDJAVA MAYBE_JA = java endif -SUBDIRS = libopensrf c-apps router srfsh jserver gateway perl $(MAYBE_PY) $(MAYBE_JA) +if INSTALLJAVASCRIPT +MAYBE_JAVASCRIPT = javascript +jsdir = $(prefix)/lib/javascript +js_SCRIPTS = javascript/DojoSRF.js javascript/JSON_v0.js javascript/JSON_v1.js javascript/md5.js javascript/opensrf.js javascript/opensrf_xhr.js javascript/opensrf_xmpp.js +endif +if BUILDCORE +MAYBE_CORE = libopensrf c-apps router srfsh jserver gateway perl dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl bin_SCRIPTS = @top_srcdir@/bin/osrf_config @top_srcdir@/bin/osrf_ctl.sh - dist_sysconf_DATA = @top_srcdir@/examples/opensrf.xml.example @top_srcdir@/examples/opensrf_core.xml.example @top_srcdir@/examples/srfsh.xml.example +endif + +SUBDIRS = $(MAYBE_CORE) $(MAYBE_PY) $(MAYBE_JA) install-exec-local: mkdir -p $(VAR) mkdir -p $(PID) mkdir -p $(LOG) mkdir -p $(SOCK) - mkdir -p $(jsdir) 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' - cp -r @srcdir@/javascript/* $(jsdir)/ + if [ $(MAYBE_CORE) ]; then 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'; fi uninstall-hook: - rm @includedir@/opensrf/apachetools.h - rm -R $(jsdir) + rm -f @includedir@/opensrf/apachetools.h -- 2.43.2