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";
25 # --------------------------------------------------------------------
26 # Loads all of the path information from the user setting
27 # install variables as it goes
28 # --------------------------------------------------------------------
32 echo "A build error occured: $MSG";
37 #function postMessage {
40 # --------------------------------------------------------------------
47 # --------------------------------------------------------------------
48 # Makes sure the install directories exist and are writable
49 # --------------------------------------------------------------------
50 function mkInstallDirs {
55 if [ "$?" != "0" ]; then
56 fail "Error creating $PREFIX";
59 if [ ! -w "$PREFIX" ]; then
60 fail "We don't have write access to $PREFIX";
68 if [ "$?" != "0" ]; then
69 fail "Error creating $TMP";
72 if [ ! -w "$TMP" ]; then
73 fail "We don't have write access to $TMP";
82 if [ -z "$INSTALLING" ]; then return 1; fi;
87 if [ -z "$BUILDING" ]; then return 1; fi;
93 # --------------------------------------------------------------------
94 # Loads the config file. If it can't fine CONFIG_FILE, it attempts to
95 # use DEFAULT_CONFIG_FILE. If it can't find that, it fails.
96 # --------------------------------------------------------------------
98 if [ ! -f "$CONFIG_FILE" ]; then
99 if [ -f "$DEFAULT_CONFIG_FILE" ]; then
100 echo "+ + + Copying $DEFAULT_CONFIG_FILE to $CONFIG_FILE and using its settings...";
101 cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE";
103 fail "config file \"$CONFIG_FILE\" cannot be found";
106 source "$CONFIG_FILE";
112 function runInstall {
116 # pass the collected variables to make
117 for target in ${TARGETS[@]:0}; do
121 --------------------------------------------------------------------
123 --------------------------------------------------------------------
127 MAKE="make APXS2=$APXS2 PREFIX=$PREFIX TMP=$TMP \
128 APACHE2_HEADERS=$APACHE2_HEADERS LIBXML2_HEADERS=$LIBXML2_HEADERS \
129 BINDIR=$BINDIR LIBDIR=$LIBDIR PERLDIR=$PERLDIR INCLUDEDIR=$INCLUDEDIR \
130 WEBDIR=$WEBDIR TEMPLATEDIR=$TEMPLATEDIR ETCDIR=$ETCDIR \
131 OPENSRFDIR=$OPENSRFDIR OPENILSDIR=$OPENILSDIR EVERGREENDIR=$EVERGREENDIR CIRCRULESDIR=$CIRCRULESDIR\
132 CGIDIR=$CGIDIR DBDRVR=$DBDRVR DBHOST=$DBHOST DBNAME=$DBNAME DBUSER=$DBUSER DBPW=$DBPW";
140 if building; then $MAKE -C "$OPENSRFDIR" all; fi;
141 if installing; then $MAKE -C "$OPENSRFDIR" install; fi;
145 if building; then $MAKE -C "$OPENSRFDIR" "jserver"; fi;
146 if installing; then $MAKE -C "$OPENSRFDIR" "jserver-install"; fi;
150 if building; then $MAKE -C "$OPENSRFDIR" "router"; fi;
151 if installing; then $MAKE -C "$OPENSRFDIR" "router-install"; fi;
155 if building; then $MAKE -C "$OPENSRFDIR" "gateway"; fi;
156 if installing; then $MAKE -C "$OPENSRFDIR" "gateway-install"; fi;
160 if building; then $MAKE -C "$OPENSRFDIR" "srfsh"; fi;
161 if installing; then $MAKE -C "$OPENSRFDIR" "srfsh-install"; fi;
165 if installing; then $MAKE -C "$OPENSRFDIR" "perl-install"; fi;
172 if building; then $MAKE -C "$OPENILSDIR" all; fi;
173 if installing; then $MAKE -C "$OPENILSDIR" install; fi;
178 $MAKE -C "$OPENILSDIR" "perl-install";
179 $MAKE -C "$OPENILSDIR" "string-templates-install";
185 $MAKE -C "$OPENILSDIR" "javascript-install";
186 $MAKE -C "$OPENILSDIR" "web-templates-install";
190 "openils_marcdumper" )
191 if building; then $MAKE -C "$OPENILSDIR" "marcdumper"; fi;
192 if installing; then $MAKE -C "$OPENILSDIR" "marcdumper-install"; fi;
197 $MAKE -C "$OPENILSDIR" "storage-bootstrap";
205 if installing; then $MAKE -C "$EVERGREENDIR" "images-install"; fi;
206 if installing; then $MAKE -C "$EVERGREENDIR" "circ-install"; fi;
209 "evergreen_xul_client" )
210 if building; then $MAKE -C "$EVERGREENDIR" xul; fi;
214 *) fail "Unknown target: $target";;
222 # --------------------------------------------------------------------
223 # Checks command line parameters for special behavior
224 # Supported params are:
225 # clean - cleans all build files
226 # build - builds the specified sources
227 # install - installs the specified sources
228 # --------------------------------------------------------------------
229 function checkParams {
231 if [ -z "$1" ]; then return; fi;
248 *) fail "Unknown command line argument: $arg";;
252 if [ "$lastArg" = "clean" ]; then exit 0; fi;
258 make -C "$OPENSRFDIR" clean;
259 make -C "$OPENILSDIR" clean;
260 make -C "$EVERGREENDIR" clean;
266 if building; then echo "Building..."; fi;
267 if installing; then echo "Installing..."; fi;
270 # --------------------------------------------------------------------
272 # --------------------------------------------------------------------