[Opensrf-commits] r1907 - in branches/rel_1_2: . bin src src/c-apps src/libopensrf (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jan 28 21:48:02 EST 2010
Author: dbs
Date: 2010-01-28 21:48:00 -0500 (Thu, 28 Jan 2010)
New Revision: 1907
Modified:
branches/rel_1_2/bin/osrf_config.in
branches/rel_1_2/bin/osrf_ctl.sh.in
branches/rel_1_2/configure.ac
branches/rel_1_2/src/Makefile.am
branches/rel_1_2/src/c-apps/Makefile.am
branches/rel_1_2/src/c-apps/timejson.c
branches/rel_1_2/src/libopensrf/Makefile.am
Log:
Apply patches for enhancing portability, from Dan McMahill
The following is a list of the patches and a brief description of what
they are supposed to address. They were needed for building OpenSRF-1.2.0
(the most recent release) on a NetBSD system.
patch-aa -- some systems have dlerror() in libc instead of libdl so use
AC_SEARCH_LIBS to see if we need an explicit -ldl or not.
Fail in the same way as the previous code if we can't find
dlerror() anywhere.
malloc_stats() is malloc implementation specific so check for
it and define HAVE_MALLOC_STATS if we do.
patch-ab -- No need to explicitly list -lxml2 -ldl -lmemcache in LDADD.
These were automatically filled in via the LIBS variable which
is filled in via AC_SEARCH_LIBS and AC_CHECK_LIB. Also this
way -ldl only shows up if it is actually needed.
patch-ac -- Only conditionally call malloc_stats() if it exists. On
systems without malloc_stats(), just print a warning to the
effect.
patch-ad -- Instead of using -lopensrf for foo_la_LIBADD use
@top_builddir@/src/libopensrf/libopensrf.la. This
is the way to link to the not-yet-installed libtool
library we just built.
patch-af -- "sed -i" is a GNU sed extension and not portable to Solaris or the
various BSDs. Rework the target a little to be more portable.
patch-ag -- Use /bin/sh instead of /bin/bash. And to make sure this will work
on non-Linux systems where /bin/sh is *not* bash, make things a little
more portable. The biggest is that
function foo { code here }
is replaced by the more portable
foo() {code here}
syntax.
patch-ah -- Use /bin/sh instead of /bin/bash. And to make sure this will work
on non-Linux systems where /bin/sh is *not* bash, make things a little
more portable. Of note, "echo -e" is non-portable so instead use
as "here document" which is more portable and also I think easier to
edit anyway. Also address the function syntax and finally "==" is
a bash extension to "test". "=" does the same thing and is portable
to other shells.
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: Dan McMahill <dmcmahill at NetBSD.org>
Modified: branches/rel_1_2/bin/osrf_config.in
===================================================================
--- branches/rel_1_2/bin/osrf_config.in 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/bin/osrf_config.in 2010-01-29 02:48:00 UTC (rev 1907)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (C) 2008 Equinox Software, Inc.
# Kevin Beswick <kevinbeswick00 at gmail.com>
@@ -20,7 +20,7 @@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
-function showInstalled {
+showInstalled() {
JAVA=@OSRF_INSTALL_JAVA@
PYTHON=@OSRF_INSTALL_PYTHON@
if test "$JAVA" = "true"; then
@@ -31,7 +31,7 @@
fi
}
-function showAll {
+showAll() {
echo @PACKAGE_STRING@
echo PREFIX=@prefix@
echo BINDIR=@bindir@
@@ -48,7 +48,7 @@
showInstalled;
}
-function showHelp {
+showHelp() {
echo
echo "------------------------------------------------------------"
echo " osrf_config "
@@ -77,53 +77,53 @@
case "$1" in
--installed)
- showInstalled;
+ showInstalled
;;
--cconfig) cconfig;
;;
--libxml)
- echo @LIBXML2_HEADERS@;
+ echo @LIBXML2_HEADERS@
;;
--apr)
- echo @APR_HEADERS@;
+ echo @APR_HEADERS@
;;
--apache)
- echo @APACHE2_HEADERS@;
+ echo @APACHE2_HEADERS@
;;
--prefix)
echo @prefix@
;;
--version)
- echo @PACKAGE_STRING@;
+ echo @PACKAGE_STRING@
;;
--bindir)
echo @bindir@
;;
--libdir)
- echo @libdir@;
+ echo @libdir@
;;
--sysconfdir)
- echo @sysconfdir@;
+ echo @sysconfdir@
;;
--localstatedir)
- echo @localstatedir@;
+ echo @localstatedir@
;;
--tmpdir)
- echo @TMP@;
+ echo @TMP@
;;
--apxs)
- echo @APXS2@;
+ echo @APXS2@
;;
--includedir)
- echo @includedir@;
+ echo @includedir@
;;
--docdir)
- echo @docdir@;
+ echo @docdir@
;;
--help)
- showHelp;
+ showHelp
;;
*)
- showAll;
+ showAll
;;
esac
Modified: branches/rel_1_2/bin/osrf_ctl.sh.in
===================================================================
--- branches/rel_1_2/bin/osrf_ctl.sh.in 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/bin/osrf_ctl.sh.in 2010-01-29 02:48:00 UTC (rev 1907)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -28,40 +28,41 @@
[ $(whoami) != 'opensrf' ] && echo 'Must run as user "opensrf"' && exit;
-function usage {
- echo "";
- echo "usage: $0 [OPTION]... -c <c_config> -a <action>";
- echo "";
- echo "Mandatory parameters:";
- echo -e " -a\t\taction to perform";
- echo "";
- echo "Optional parameters:";
- echo -e " -c\t\tfull path to C configuration file (opensrf_core.xml)";
- echo -e " -d\t\tstore PID files in this directory";
- echo -e " -l\t\taccept 'localhost' as the fully-qualified domain name";
- echo "";
- echo "Actions include:";
- echo -e "\tstart_router"
- echo -e "\tstop_router"
- echo -e "\trestart_router"
- echo -e "\tstart_perl"
- echo -e "\tstop_perl"
- echo -e "\trestart_perl"
- echo -e "\tstart_c"
- echo -e "\tstop_c"
- echo -e "\trestart_c"
- echo -e "\tstart_osrf"
- echo -e "\tstop_osrf"
- echo -e "\trestart_osrf"
- echo -e "\tstop_all"
- echo -e "\tstart_all"
- echo -e "\trestart_all"
- echo "";
- echo "Examples:";
- echo " $0 -a restart_all";
- echo " $0 -l -c opensrf_core.xml -a restart_all";
- echo "";
- exit;
+usage() {
+ cat << EOF
+
+usage: $0 [OPTION]... -c <c_config> -a <action>
+
+Mandatory parameters:
+ -a action to perform
+
+Optional parameters:";
+ -c full path to C configuration file (opensrf_core.xml)
+ -d store PID files in this directory
+ -l accept 'localhost' as the fully-qualified domain name
+
+Actions include:
+ start_router
+ stop_router
+ restart_router
+ start_perl
+ stop_perl
+ restart_perl
+ start_c
+ stop_c
+ restart_c
+ start_osrf
+ stop_osrf
+ restart_osrf
+ stop_all
+ start_all
+ restart_all
+
+Examples:
+ $0 -a restart_all
+ $0 -l -c opensrf_core.xml -a restart_all
+
+EOF
}
# ---------------------------------------------------------------------------
@@ -96,13 +97,13 @@
# ---------------------------------------------------------------------------
# Utility code for checking the PID files
# ---------------------------------------------------------------------------
-function do_action {
+do_action() {
action="$1";
pidfile="$2";
item="$3";
- if [ $action == "start" ]; then
+ if [ $action = "start" ]; then
if [ -e $pidfile ]; then
pid=$(cat $pidfile);
@@ -112,7 +113,7 @@
echo "Starting $item";
fi;
- if [ $action == "stop" ]; then
+ if [ $action = "stop" ]; then
if [ ! -e $pidfile ]; then
echo "$item not running";
@@ -138,7 +139,7 @@
# ---------------------------------------------------------------------------
-function start_router {
+start_router() {
do_action "start" $PID_ROUTER "OpenSRF Router";
opensrf_router $OPT_CONFIG routers
sleep 2; # give the router procs time to fork and appear in ps
@@ -147,28 +148,28 @@
return 0;
}
-function stop_router {
+stop_router() {
do_action "stop" $PID_ROUTER "OpenSRF Router";
return 0;
}
-function start_perl {
+start_perl() {
echo "Starting OpenSRF Perl";
opensrf-perl.pl --verbose --pid-dir $OPT_PID_DIR \
--config $OPT_CONFIG --action start_all --settings-startup-pause 3
return 0;
}
-function stop_perl {
+stop_perl() {
echo "Stopping OpenSRF Perl";
opensrf-perl.pl --verbose --pid-dir $OPT_PID_DIR --config $OPT_CONFIG --action stop_all
sleep 1;
return 0;
}
-function start_c {
+start_c() {
host=$OSRF_HOSTNAME
- if [ "_$host" == "_" ]; then
+ if [ "_$host" = "_" ]; then
host=$(perl -MNet::Domain=hostfqdn -e 'print hostfqdn()');
fi;
@@ -180,7 +181,7 @@
return 0;
}
-function stop_c {
+stop_c() {
do_action "stop" $PID_OSRF_C "OpenSRF C";
sleep 1;
return 0;
Modified: branches/rel_1_2/configure.ac
===================================================================
--- branches/rel_1_2/configure.ac 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/configure.ac 2010-01-29 02:48:00 UTC (rev 1907)
@@ -202,7 +202,7 @@
# Checks for libraries.
#-----------------------------
-AC_CHECK_LIB([dl], [dlerror], [],AC_MSG_ERROR(***OpenSRF requires libdl))
+AC_SEARCH_LIBS([dlerror], [dl], [], AC_MSG_ERROR([***OpenSRF requires a library (typically libdl) that provides dlerror()]))
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))
@@ -240,7 +240,7 @@
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])
+AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday malloc_stats memset select socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strtol])
#------------------------------------
# Configuration and output
Modified: branches/rel_1_2/src/Makefile.am
===================================================================
--- branches/rel_1_2/src/Makefile.am 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/src/Makefile.am 2010-01-29 02:48:00 UTC (rev 1907)
@@ -48,12 +48,12 @@
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'
+ for f in opensrf.xml.example opensrf_core.xml.example srfsh.xml.example ; do \
+ mv "$(DESTDIR)@sysconfdir@/$${f}" "$(DESTDIR)@sysconfdir@/$${f}.bak" ; \
+ sed -e 's|LOCALSTATEDIR|$(VAR)|g' -e 's|SYSCONFDIR|$(ETCDIR)|g' \
+ "$(DESTDIR)@sysconfdir@/$${f}.bak" > "$(DESTDIR)@sysconfdir@/$${f}" ; \
+ rm "$(DESTDIR)@sysconfdir@/$${f}.bak" ; \
+ done
cp -r @srcdir@/javascript/* $(jsdir)/
uninstall-hook:
Modified: branches/rel_1_2/src/c-apps/Makefile.am
===================================================================
--- branches/rel_1_2/src/c-apps/Makefile.am 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/src/c-apps/Makefile.am 2010-01-29 02:48:00 UTC (rev 1907)
@@ -19,13 +19,16 @@
lib_LTLIBRARIES = osrf_dbmath.la osrf_math.la osrf_version.la
timejson_SOURCES = timejson.c
-timejson_LDADD = -lopensrf
+timejson_LDADD = @top_builddir@/src/libopensrf/libopensrf.la
+
osrf_dbmath_la_SOURCES = osrf_dbmath.c
osrf_dbmath_la_LDFLAGS = $(AM_LDFLAGS) -module
-osrf_dbmath_la_LIBADD = -lopensrf
+osrf_dbmath_la_LIBADD = @top_builddir@/src/libopensrf/libopensrf.la
+
osrf_math_la_SOURCES = osrf_math.c
osrf_math_la_LDFLAGS = $(AM_LDFLAGS) -module
-osrf_math_la_LIBADD = -lopensrf
+osrf_math_la_LIBADD = @top_builddir@/src/libopensrf/libopensrf.la
+
osrf_version_la_SOURCES = osrf_version.c
osrf_version_la_LDFLAGS = $(AM_LDFLAGS) -module
-osrf_version_la_LIBADD = -lopensrf
+osrf_version_la_LIBADD = @top_builddir@/src/libopensrf/libopensrf.la
Modified: branches/rel_1_2/src/c-apps/timejson.c
===================================================================
--- branches/rel_1_2/src/c-apps/timejson.c 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/src/c-apps/timejson.c 2010-01-29 02:48:00 UTC (rev 1907)
@@ -57,8 +57,11 @@
else
printf( "Address space: %lu\n", (unsigned long) rlim.rlim_cur );
+#ifdef HAVE_MALLOC_STATS
malloc_stats();
-
+#else
+ fprintf(stderr, "malloc_stats() is not available on your system\n");
+#endif
return rc;
}
Modified: branches/rel_1_2/src/libopensrf/Makefile.am
===================================================================
--- branches/rel_1_2/src/libopensrf/Makefile.am 2010-01-28 03:14:32 UTC (rev 1906)
+++ branches/rel_1_2/src/libopensrf/Makefile.am 2010-01-29 02:48:00 UTC (rev 1907)
@@ -14,7 +14,7 @@
AM_CFLAGS = $(DEF_CFLAGS) -DASSUME_STATELESS -DOSRF_STRICT_PARAMS -rdynamic -fno-strict-aliasing -DOSRF_JSON_ENABLE_XML_UTILS
AM_LDFLAGS = $(DEF_LDFLAGS) -R $(libdir)
-LDADD = -lxml2 -ldl -lmemcache -lopensrf
+LDADD = -lopensrf
OSRF_INC = @top_srcdir@/include/opensrf
More information about the opensrf-commits
mailing list