committing to cvs so i can move it over to another machine and work on it :)
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Jul 2005 20:52:53 +0000 (20:52 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Jul 2005 20:52:53 +0000 (20:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1048 dcc99617-32d9-48b4-a31d-7c20da2025e4

install.conf.default [new file with mode: 0644]
install.sh

diff --git a/install.conf.default b/install.conf.default
new file mode 100644 (file)
index 0000000..a16f36a
--- /dev/null
@@ -0,0 +1,68 @@
+# --------------------------------------------------------------------
+# Build targets.  Options include:
+# 
+# jserver    - custom 'single-domain' jabber server which may be used
+#              in place of jabberd2
+# router     - jabber router.  
+# gateway    - mod_ils_gateway, Apache module for proxying API calls
+# srfsh      - diagnostic shell interface to OpenSRF
+# marcdumper - utility code for converting MARC to MARCXML
+# xul        - client XUL application
+#
+# When running the server components of OpenSRF/OpenILS, the simplest
+# thing is to build jserver, router, gateway, and srfsh, even if you 
+# don't use all of them.  Build marcdumper only if you need to convert
+# MARC files to MARCXML.  If you only want to build the client app,
+# then just build xul.
+# --------------------------------------------------------------------
+#TARGETS=("jserver" "router" "gateway" "srfsh" "marcdumper" "xul");
+TARGETS=("router" "gateway" "jserver" "srfsh");
+
+
+# --------------------------------------------------------------------
+# Global install prefix.  Binaries will be installed into PREFIX/bin,
+# libraries will be installed into PERFIX/lib, etc.  The user 
+# running install.sh must have write permissions to PREFIX
+# --------------------------------------------------------------------
+#PREFIX="/tmp/testinstall/";
+PREFIX="/pines/";
+
+
+# --------------------------------------------------------------------
+# Temporary build files go here.  The User running install.sh must
+# have write permissions to TMP
+# --------------------------------------------------------------------
+TMP="/tmp/ilsinstall/";
+
+
+# --------------------------------------------------------------------
+# Location of the apxs binary for Apache2.  This must be set when
+# building the mod_ils_gateway C plugin for allowing web access
+# to the published API.
+# --------------------------------------------------------------------
+APXS2="/pines/apps/apache2/bin/apxs";
+
+
+# --------------------------------------------------------------------
+# Directory where the Apache2 header files are located.  This must 
+# be set when building the mod_ils_gateway C plugin for allowing web 
+# access to the published API.
+# --------------------------------------------------------------------
+APACHE2_HEADERS="/pines/apps/apache2/include/";
+
+
+# --------------------------------------------------------------------
+# Directory where the libxml2 headers are located.  Libxml2 is used
+# by various components
+# --------------------------------------------------------------------
+LIBXML2_HEADERS="/usr/include/libxml2/";
+
+
+
+# --------------------------------------------------------------------
+# These point to the top level makefiles for each of the sub 
+# projects.  Only change these if you have relocated the directories.
+# --------------------------------------------------------------------
+OPENSRF_DIR="OpenSRF/src/";
+OPENILS_DIR="Open-ILS/src/";
+EVERGREEN_DIR="Evergreen/";
index 18ffa92..219e43d 100755 (executable)
 # --------------------------------------------------------------------
 # ILS install script
 # --------------------------------------------------------------------
+CONFIG_FILE="install.conf";
+DEFAULT_CONFIG_FILE="install.conf.default";
 
-# *!*!* EDIT THESE *!*!*
-# --------------------------------------------------------------------
-# Here define all of the necessary install variables 
-# --------------------------------------------------------------------
-APXS2="/pines/apps/apache2/bin/apxs";
-PREFIX="/pines/";
-TMP="/tmp/pines/";
-APACHE2_HEADERS="/pines/apps/apache2/include/";
-LIBXML2_HEADERS="/usr/include/libxml2/";
-TARGETS=("OpenSRF" "Open-ILS" "Evergreen");
-# --------------------------------------------------------------------
 
 # --------------------------------------------------------------------
-# if FORCE is set to any non-empty value, we'll use 
-# the default settings
-FORCE=$1 
+# Loads all of the path information from the user setting 
+# install variables as it goes
 # --------------------------------------------------------------------
 
+function fail {
+       MSG="$1";
+       echo "A build error occured: $MSG";
+       exit 99;
+}
 
 
-
-
-# --------------------------------------------------------------------
-# Loads all of the path information from the user setting 
-# install variables as it goes
-# --------------------------------------------------------------------
 function verifyInstallPaths {
 
        cat <<-WORDS
@@ -65,46 +53,67 @@ function verifyInstallPaths {
        -----------------------------------------------------------------------
 
        If these are not OK, use control-c to break out and fix the variables 
-       at the top of this script.  Otherwise, type enter.
+       in install.config.  Otherwise, type enter.
+
+       To disable this message, run "./install.sh force".
 
        WORDS
        read OK;
 }
 
+#function postMessage {
+
+#cat <<-WORDS
+#      --------------------------------------------------------------------
+
+
+#}
+
 # --------------------------------------------------------------------
 # Makes sure the install directories exist and are writable
 # --------------------------------------------------------------------
 function mkInstallDirs {
 
        mkdir -p "$PREFIX";
-
        if [ "$?" != "0" ]; then
-               echo "Error creating $PREFIX";
-               exit 99;
+               fail "Error creating $PREFIX";
        fi
 
        mkdir -p "$TMP";
        if [ "$?" != "0" ]; then
-               echo "Error creating $TMP";
-               exit 99;
+               fail "Error creating $TMP";
        fi
 
        if [ ! -w "$PREFIX" ]; then
-               echo "We don't have write access to $PREFIX";
-               exit 99;
+               fail "We don't have write access to $PREFIX";
        fi
 
        if [ ! -w "$TMP" ]; then
-               echo "We don't have write access to $TMP";
-               exit 99;
+               fail "We don't have write access to $TMP";
        fi
 
 }
 
+# --------------------------------------------------------------------
+# Loads the config file.  If it can't fine CONFIG_FILE, it attempts to
+# use DEFAULT_CONFIG_FILE.  If it can't find that, it fails.
+# --------------------------------------------------------------------
+function loadConfig {
+       if [ ! -f "$CONFIG_FILE" ]; then
+               if [ -f "$DEFAULT_CONFIG_FILE" ];
+                       $CONFIG_FILE="$DEFAULT_CONFIG_FILE";
+               else
+                       fail "config file \"$CONFIG_FILE\" cannot be found";
+       fi
+       source "$CONFIG_FILE";
+}
+
 
 function runInstall {
 
-       [ -z "$FORCE" ] && verifyInstallPaths;
+
+       loadConfig;
+       [ ! -z "$NOFORCE" ] && verifyInstallPaths;
        mkInstallDirs;
 
        # pass the collected variables to make
@@ -118,21 +127,57 @@ function runInstall {
 
                MSG
 
-               target="$target/src";
+               MAKE="make APXS2=$APXS2 PREFIX=$PREFIX TMP=$TMP APACHE2_HEADERS=$APACHE2_HEADERS LIBXML2_HEADERS=$LIBXML2_HEADERS"; 
+
+               echo "Passing to sub-makes: $VARS"
+                       
+               case "$target" in
+                       
+                       "jserver" | "router" | "gateway" | "srfsh" ) $MAKE -C "$OPENSRF_DIR" "$target" "$target-install";;
+
+                       *) fail "Unknown target: $target";;
+
+               esac
+
+       done
+}
+
 
-               make -C "$target" \
-                       APXS2="$APXS2" \
-                       PREFIX="$PREFIX" \
-                       TMP="$TMP" \
-                       APCHE2_HEADERS="$APACHE2_HEADERS" \
-                       LIBXML2_HEADERS="$LIBXML2_HEADERS" \
-                       all;    
+# --------------------------------------------------------------------
+# Checks command line parameters for special behavior
+# Supported params are:
+# clean - cleans all build files
+# force - forces build without the initial message
+# --------------------------------------------------------------------
+function checkParams {
+
+       if [ -z "$1" ]; then return; fi;
+
+       for arg in "$*"; do
+
+               case "$arg" in
+
+                       "clean") 
+                               make -C OpenSRF/src clean
+                               make -C Open-ILS/src clean
+                               make -C Evergreen/src clean
+                               exit 0;;
+
+                       "force")
+                               FORCE="1";;
+
+                       *) fail "Unknown command line argument: $arg";;
+               esac
 
        done
 }
 
+# if user passes in the word 'clean' as the first shell arg, clean all
+checkParams "$*";
 
 
 # Kick it off...
 runInstall;
 
+
+