root/releases/bedework-3.7/build/quickstart/linux/bw

Revision 3104 (checked in by douglm, 2 years ago)

Remove definition of property "base.name" from (almost) every build file. Was not used.
Stop defining, creating and copying to libapi. Wasn't in use.

Remove build directory from every project and use the build files in the main bedework project. improves consistency and maintainability. Also allowed some bugs to be fixed.

Allow setting of message level during build and set it at quiet. Allows error messages to be more obvious.

Create macro to handle the common property definitions. Reduces size and complexity of build files.

Add a build-jar macro. Removes need for build files for sub-modules. Partway through converting to use that.

  • Property svn:mergeinfo set to
  • Property svn:executable set to *
Line 
1 #! /bin/sh
2
3 #
4 # This file is included by the quickstart script file "bw" so that it can live
5 # within the svn repository.
6 #
7
8 ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0
9 ANT_HOME=`cd "$ANT_HOME" && pwd`
10
11 #ant_listener="-listener org.apache.tools.ant.listener.Log4jListener"
12 #ant_xmllogfile="-DXmlLogger.file=log.xml"
13 #ant_logger="-logger org.apache.tools.ant.XmlLogger"
14
15 ant_listener=
16 ant_xmllogfile=
17 ant_logger=
18
19 ant_loglevel="-quiet"
20 bw_loglevel=""
21
22 echo ""
23 echo "  Bedework Calendar System"
24 echo "  ------------------------"
25 echo ""
26
27 PRG="$0"
28
29 usage() {
30   echo "  $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [LOG_LEVEL] [ target ] "
31   echo "  $PRG ACTION"
32   echo ""
33   echo " where:"
34   echo ""
35   echo "   CONFIG-SOURCE optionally defines the location of configurations and"
36   echo "                 is one or none of  "
37   echo "     -quickstart    to use the configurations within the quickstart"
38   echo "     -bwchome path  to specify the location of the bwbuild directory"
39   echo "   The default is to look in the user home for the bwbuild directory."
40   echo ""
41   echo "   CONFIG optionally defines the configuration to build"
42   echo "      -bwc configname"
43   echo ""
44   echo "   -offline     Build without attempting to retrieve library jars"
45   echo ""
46   echo "   LOG_LEVEL sets the level of logging and can be"
47   echo "      -log-silent   Nearly silent"
48   echo "      -log-quiet    The default"
49   echo "      -log-inform   A little more noisy"
50   echo "      -log-verbose  Noisier"
51   echo "      -ant-debug    Vast amounts of ant output"
52   echo "      -build-debug  Some bedework build debug output"
53   echo ""
54   echo "   target       Ant target to execute"
55   echo ""
56   echo "   PROJECT optionally defines the package to build and is none or more of"
57   echo "     -carddav     Target is for the CardDAV build"
58   echo "     -exsynch     Target is for the Exchange synch build"
59   echo "     -client      Target is for the bedework client application build"
60   echo "     -monitor     Target is for the bedework monitor application"
61   echo "     -naming      Target is for the abstract naming api"
62   echo "     -tzsvr       Target is for the timezones server build"
63   echo "     The default is a calendar build"
64   echo ""
65   echo "     -carddav deploy-addrbook    To deploy the Javascript Addressbook client."
66   echo ""
67   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
68   echo "   directory which contains one directory per configuration."
69   echo ""
70   echo "   Within each configuration directory we expect a file called build.properties"
71   echo "   which should point to the property and options file needed for the deploy process"
72   echo ""
73   echo "   In general these files will be in the same directory as build.properties."
74   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
75   echo "   configuration directory and can be used to build a path to the other files."
76   echo ""
77   echo "   ACTION defines an action to take usually in the context of the quickstart."
78   echo "    In a deployed system many of these actions are handled directly by a"
79   echo "    deployed application. ACTION may be one of"
80   echo "      -reindex    runs the indexer directly out of the quickstart bedework"
81   echo "                  dist directory to rebuild the lucene indexes"
82   echo "      -zoneinfo   builds zoneinfo data for the timezones server"
83   echo "                  requires -version and -tzdata parameters.   NOTE: build depends on glib2"
84   echo "      -buildwebcache     builds webcache"
85   echo "      -deploywebcache    deploys webcache"
86   echo "      -deployurlbuilder  deploys url/widget builder"
87   echo ""
88 }
89
90 errorUsage() {
91   echo "*******************************************************************************************"
92   echo "Error: $1"
93   echo "*******************************************************************************************"
94   echo
95   echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C."
96   sleep 5
97   echo ""
98   usage
99   exit 1
100 }
101
102 # ----------------------------------------------------------------------------
103 # Reindex the data
104 # ----------------------------------------------------------------------------
105 actionReindex() {
106   INDEXER=$QUICKSTART_HOME/bedework/dist/temp/shellscr/indexer
107  
108         if [ ! -d "$INDEXER" ] ; then
109           errorUsage "The indexer directory $INDEXER does not exist. You probably need to do a rebuild."
110         fi
111
112   cd $INDEXER
113   chmod +x bwrun
114   ./bwrun reindex-nostart -user admin -indexlocprefix ../../../../../
115  
116   exit 0
117 }
118
119 usageZoneinfo() {
120   echo ""
121   echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data"
122   echo "for example:"
123   echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz"
124   exit 1
125 }
126
127 # ----------------------------------------------------------------------------
128 # Build zoneinfo - require -version -tzdata
129 # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or
130 # more directly from ftp://elsie.nci.nih.gov/pub/
131 # The version parameter value should be the version code from the tzdata name
132 # ----------------------------------------------------------------------------
133 actionZoneinfo() {
134   bwtzsvr="$QUICKSTART_HOME/bwtzsvr"
135   bwresources="$bwtzsvr/resources"
136
137   shift
138  
139   if [ "$1" != "-version" ] ; then
140     echo "got $1"
141     echo "Must supply -version parameter for -zoneinfo"
142     usageZoneinfo
143   fi
144  
145   shift
146     echo "got $1"
147 #  version="-Dorg.bedework.timezones.version=$1"
148   version=$1
149   shift
150  
151   if [ "$1" != "-tzdata" ] ; then
152     echo "Must supply -tzdata parameter for -zoneinfo"
153     usageZoneinfo
154   fi
155  
156   shift
157 #  tzdata="-Dorg.bedework.timezones.data=$1"
158   tzdata=$1
159   shift
160  
161   rm -rf /tmp/bedework
162   mkdir /tmp/bedework
163   mkdir /tmp/bedework/timezones
164  
165   cd /tmp/bedework/timezones
166  
167   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
168   gunzip vzic-1.3.tgz
169   tar -xf vzic-1.3.tar
170
171 # copy and unpack the data
172   mkdir olsondata
173   cd olsondata
174   cp $tzdata tzdata.tar.gz
175   gunzip tzdata.tar.gz
176   tar -xf tzdata.tar
177   rm tzdata.tar
178   cd ..
179  
180 # Replace lines in the makefile. Sure real unix types can do better 
181  
182   cd vzic-1.3
183  
184   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
185
186   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
187
188   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
189  
190   make
191  
192 # omit the pure for allegedly better outlook compatability -
193 # but not altogether correct timezones 
194   ./vzic --pure
195
196   cd ..
197  
198   mkdir tzdata
199   cp -r vzic-1.3/zoneinfo tzdata
200   cp $bwresources/aliases.txt tzdata
201  
202   cd tzdata
203  
204   echo "version=$version" > info.txt
205   date +buildTime=%D-%T-%N >> info.txt
206  
207   zip -r tzdata *
208  
209   cp tzdata.zip $bwtzsvr/
210  
211   echo ""
212   echo "------------------------------------------------------------------------------"
213   echo "tzdata.zip has been built and is at $bwtzsvr/tzdata.zip"
214   echo "------------------------------------------------------------------------------"
215   echo ""
216  
217   exit 0
218 }
219
220 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
221   errorUsage "JAVA_HOME is not defined correctly for bedework."
222 fi
223
224 saveddir=`pwd`
225
226 trap 'cd $saveddir' 0
227 trap "exit 2" 1 2 3 15
228
229 export QUICKSTART_HOME=$saveddir
230
231 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
232 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
233 #CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/applib/log4j-1.2.8.jar
234
235 # Default some parameters
236
237 BWCONFIGS=
238 bwc=default
239 BWCONFIG=
240 offline=
241 quickstart=
242
243 # Projects we will build
244 pkgdefault=yes
245 bedework=
246 carddav=
247 caldav=
248 client=
249 exsynch=
250 monitor=
251 naming=
252 tzsvr=
253 webdav=
254
255 action=
256
257 if [ "$1" = "" ] ; then
258   usage
259   exit 1
260 fi
261
262 # look for actions first
263
264 if [ "$1" = "-reindex" ] ; then
265   actionReindex
266 fi
267
268 if [ "$1" = "-zoneinfo" ] ; then
269   actionZoneinfo $*
270 fi
271
272 if [ "$1" = "-buildwebcache" ] ; then
273   cd $QUICKSTART_HOME/cachedfeeder
274   ./buildWebCache
275   exit
276 fi
277
278 if [ "$1" = "-deploywebcache" ] ; then
279    cd $QUICKSTART_HOME/cachedfeeder
280   ./deployWebCache
281   exit
282 fi
283
284 if [ "$1" = "-deployurlbuilder" ] ; then
285    cd $QUICKSTART_HOME/cachedfeeder
286   ./deployUrlBuilder
287   exit
288 fi
289
290 while [ "$1" != "" ]
291 do
292   # Process the next arg
293   case $1       # Look at $1
294   in
295     -bwchome)         # Define location of configs
296       shift
297       BWCONFIGS="$1"
298       shift
299       ;;
300     -quickstart)
301       quickstart="yes"
302       shift
303       ;;
304     -usage | -help | -? | ?)
305       usage
306       exit
307       shift
308       ;;
309     -bwc)
310       shift
311       bwc="$1"
312       shift
313       ;;
314     -offline)
315       offline="-Dorg.bedework.offline.build=yes"
316       shift
317       ;;
318 # ----------------------- Log level       
319     -log-silent)
320       ant_loglevel="-quiet"
321       bw_loglevel="-Dorg.bedework.build.silent=true"
322       shift
323       ;;
324     -log-quiet)
325       ant_loglevel="-quiet"
326       bw_loglevel=""
327       shift
328       ;;
329     -log-inform)
330       ant_loglevel=""
331       bw_loglevel="-Dorg.bedework.build.inform=true"
332       shift
333       ;;
334     -log-verbose)
335       ant_loglevel="-verbose"
336       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
337       shift
338       ;;
339     -ant-debug)
340       ant_loglevel="-debug"
341       shift
342       ;;
343     -build-debug)
344       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
345       shift
346       ;;
347 # ------------------------Projects
348     -carddav)
349       carddav="yes"
350       pkgdefault=
351       shift
352       ;;
353     -caldav)
354       caldav="yes"
355       pkgdefault=
356       shift
357       ;;
358     -client)
359       client="yes"
360       pkgdefault=
361       shift
362       ;;
363     -exsynch)
364       exsynch="yes"
365       pkgdefault=
366       shift
367       ;;
368     -webdav)
369       webdav="yes"
370       pkgdefault=
371       shift
372       ;;
373     -monitor)
374       monitor="yes"
375       pkgdefault=
376       shift
377       ;;
378     -naming)
379       naming="yes"
380       pkgdefault=
381       shift
382       ;;
383     -tzsvr)
384       tzsvr="yes"
385       pkgdefault=
386       shift
387       ;;
388     -*)
389       usage
390       exit 1
391       ;;
392     *)
393       # Assume we've reached the target(s)
394       break
395       ;;
396   esac
397 done
398
399 if [ "$quickstart" != "" ] ; then
400   if [ "$BWCONFIGS" != "" ] ; then
401     errorUsage "Cannot specify both -quickstart and -bwchome"
402   fi
403   if [ "$bwc" = "jboss" ] ; then
404         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
405   fi
406
407   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
408 elif [ "$BWCONFIGS" = "" ] ; then
409   BWCONFIGS=$HOME/bwbuild
410 fi
411
412 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
413 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
414
415 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then
416   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'."
417 fi
418
419 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
420   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
421 fi
422
423 # Make available for ant
424 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
425
426 echo "BWCONFIGS=$BWCONFIGS"
427 echo "BWCONFIG=$BWCONFIG"
428
429 if [ "$caldav" != "" ] ; then
430   cd $QUICKSTART_HOME/bedework/projects/caldav
431 fi
432
433 if [ "$carddav" != "" ] ; then
434   cd $QUICKSTART_HOME/bedework-carddav
435 fi
436
437 if [ "$client" != "" ] ; then
438   cd $QUICKSTART_HOME/bwclient
439 fi
440
441 if [ "$exsynch" != "" ] ; then
442   cd $QUICKSTART_HOME/exchgsynch
443 fi
444
445 if [ "$monitor" != "" ] ; then
446   cd $QUICKSTART_HOME/MonitorApp
447 fi
448
449 if [ "$naming" != "" ] ; then
450   cd $QUICKSTART_HOME/bwnaming
451 fi
452
453 if [ "$tzsvr" != "" ] ; then
454   cd $QUICKSTART_HOME/bwtzsvr
455 fi
456
457 if [ "$webdav" != "" ] ; then
458   cd $QUICKSTART_HOME/bedework/projects/webdav
459 fi
460
461 $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile $offline -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel $*
Note: See TracBrowser for help on using the browser.