2 # --------------------------------------------------------------------
3 # Copyright (C) 2005 Georgia Public Library Service
4 # Bill Erickson <highfalutin@gmail.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 # --------------------------------------------------------------------
18 # --------------------------------------------------------------------
20 # --------------------------------------------------------------------
21 CONFIG_FILE="install.conf";
22 DEFAULT_CONFIG_FILE="install.conf.default";
23 verbose="-s" #clear this to get full build output
26 # --------------------------------------------------------------------
27 # Loads all of the path information from the user setting
28 # install variables as it goes
29 # --------------------------------------------------------------------
33 echo "A build error occured: $MSG";
38 #function postMessage {
41 # --------------------------------------------------------------------
48 # --------------------------------------------------------------------
49 # Makes sure the install directories exist and are writable
50 # --------------------------------------------------------------------
51 function mkInstallDirs {
56 if [ "$?" != "0" ]; then
57 fail "Error creating $PREFIX";
60 if [ ! -w "$PREFIX" ]; then
61 fail "We don't have write access to $PREFIX";
69 if [ "$?" != "0" ]; then
70 fail "Error creating $TMP";
73 if [ ! -w "$TMP" ]; then
74 fail "We don't have write access to $TMP";
83 if [ -z "$INSTALLING" ]; then return 1; fi;
88 if [ -z "$BUILDING" ]; then return 1; fi;
94 # --------------------------------------------------------------------
95 # Loads the config file. If it can't fine CONFIG_FILE, it attempts to
96 # use DEFAULT_CONFIG_FILE. If it can't find that, it fails.
97 # --------------------------------------------------------------------
99 if [ ! -f "$CONFIG_FILE" ]; then
100 if [ -f "$DEFAULT_CONFIG_FILE" ]; then
101 echo "+ + + Copying $DEFAULT_CONFIG_FILE to $CONFIG_FILE and using its settings...";
102 cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE";
104 fail "config file \"$CONFIG_FILE\" cannot be found";
107 source "$CONFIG_FILE";
113 function runInstall {
117 # pass the collected variables to make
118 for target in ${TARGETS[@]:0}; do
121 echo "-------------- [ $target ] -------------------------------------------";
124 MAKE="make $verbose APXS2=$APXS2 PREFIX=$PREFIX TMP=$TMP \
125 APACHE2_HEADERS=$APACHE2_HEADERS LIBXML2_HEADERS=$LIBXML2_HEADERS \
126 BINDIR=$BINDIR LIBDIR=$LIBDIR PERLDIR=$PERLDIR INCLUDEDIR=$INCLUDEDIR \
127 WEBDIR=$WEBDIR TEMPLATEDIR=$TEMPLATEDIR ETCDIR=$ETCDIR \
128 OPENSRFDIR=$OPENSRFDIR OPENILSDIR=$OPENILSDIR EVERGREENDIR=$EVERGREENDIR \
129 CIRCRULESDIR=$CIRCRULESDIR CGIDIR=$CGIDIR DBDRVR=$DBDRVR DBHOST=$DBHOST \
130 DBNAME=$DBNAME DBUSER=$DBUSER DBPW=$DBPW XSLDIR=$XSLDIR NEW_OPAC_URL=$NEW_OPAC_URL \
131 NEW_XUL_PACKAGE_NAME=$NEW_XUL_PACKAGE_NAME NEW_XUL_PACKAGE_LABEL=$NEW_XUL_PACKAGE_LABEL";
139 if building; then $MAKE -C "$OPENSRFDIR" all; fi;
140 if installing; then $MAKE -C "$OPENSRFDIR" install; fi;
144 if building; then $MAKE -C "$OPENSRFDIR" "jserver"; fi;
145 if installing; then $MAKE -C "$OPENSRFDIR" "jserver-install"; fi;
149 if building; then $MAKE -C "$OPENSRFDIR" "router"; fi;
150 if installing; then $MAKE -C "$OPENSRFDIR" "router-install"; fi;
154 if building; then $MAKE -C "$OPENSRFDIR" "gateway"; fi;
155 if installing; then $MAKE -C "$OPENSRFDIR" "gateway-install"; fi;
159 if building; then $MAKE -C "$OPENSRFDIR" "srfsh"; fi;
160 if installing; then $MAKE -C "$OPENSRFDIR" "srfsh-install"; fi;
164 if installing; then $MAKE -C "$OPENSRFDIR" "perl-install"; fi;
171 if building; then $MAKE -C "$OPENILSDIR" all; fi;
172 if installing; then $MAKE -C "$OPENILSDIR" install; fi;
177 $MAKE -C "$OPENILSDIR" "perl-install";
178 $MAKE -C "$OPENILSDIR" "string-templates-install";
179 $MAKE -C "$OPENILSDIR" "xsl-install";
184 if building; then $MAKE -C "$OPENILSDIR" "mod_xmltools"; fi;
185 if building; then $MAKE -C "$OPENILSDIR" "mod_ils_rest_gateway"; fi;
186 if installing; then $MAKE -C "$OPENILSDIR" "web-install"; fi;
189 "openils_marcdumper" )
190 if building; then $MAKE -C "$OPENILSDIR" "marcdumper"; fi;
191 if installing; then $MAKE -C "$OPENILSDIR" "marcdumper-install"; fi;
196 $MAKE -C "$OPENILSDIR" "storage-bootstrap";
204 if installing; then $MAKE -C "$EVERGREENDIR" "circ-install"; fi;
207 "evergreen_xul_client" )
208 if building; then $MAKE -C "$EVERGREENDIR" xul; fi;
212 *) fail "Unknown target: $target";;
220 # --------------------------------------------------------------------
221 # Checks command line parameters for special behavior
222 # Supported params are:
223 # clean - cleans all build files
224 # build - builds the specified sources
225 # install - installs the specified sources
226 # --------------------------------------------------------------------
227 function checkParams {
229 if [ -z "$1" ]; then usage; fi;
249 *) fail "Unknown option => $arg";
253 if [ "$lastArg" = "clean" ]; then exit 0; fi;
259 make "TMP=$TMP" -s -C "$OPENSRFDIR" clean;
260 make "TMP=$TMP" -s -C "$OPENILSDIR" clean;
261 make "TMP=$TMP" -s -C "$EVERGREENDIR" clean;
265 echo "usage: $0 [ build | install | clean ]";
271 if building; then echo "Building..."; fi;
272 if installing; then echo "Installing..."; fi;
275 # --------------------------------------------------------------------
277 # --------------------------------------------------------------------