root/trunk/build/quickstart/linux/bw

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

echo time we finish build

  • 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 # Projects we need to update
23 updateProjects="bwxml rpiutil access davutil webdav caldav bedework bedework-carddav bwtzsvr cachedfeeder"
24
25 # Projects we will build - pkgdefault (bedework) is built if nothing specified
26 pkgdefault=yes
27 access=
28 bedework=
29 bwtools=
30 bwxml=
31 caldav=
32 caldavTest=
33 carddav=
34 catsvr=
35 client=
36 davutil=
37 monitor=
38 naming=
39 rpiutil=
40 synch=
41 testsuite=
42 tzsvr=
43 webdav=
44
45 # Special targets - avoiding dependencies
46
47 deploylog4j=
48 dirstart=
49
50 specialTarget=
51
52 echo ""
53 echo "  Bedework Calendar System"
54 echo "  ------------------------"
55 echo ""
56
57 PRG="$0"
58
59 usage() {
60   echo "  $PRG ACTION"
61   echo "  $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [LOG_LEVEL] [ target ] "
62   echo ""
63   echo " where:"
64   echo ""
65   echo "   ACTION defines an action to take usually in the context of the quickstart."
66   echo "    In a deployed system many of these actions are handled directly by a"
67   echo "    deployed application. ACTION may be one of"
68   echo "      -updateall  Does an svn update of all projects"
69   echo "      -zoneinfo   builds zoneinfo data for the timezones server"
70   echo "                  requires -version and -tzdata parameters.   "
71   echo "                  NOTE: build depends on glib2 and only works on Linux/Unix"
72   echo "      -buildwebcache     builds webcache"
73   echo "      -deploywebcache    deploys webcache"
74   echo "      -deployurlbuilder  deploys url/widget builder"
75   echo ""
76   echo "   CONFIG-SOURCE optionally defines the location of configurations and"
77   echo "                 is one or none of  "
78   echo "     -quickstart    to use the configurations within the quickstart"
79   echo "     -bwchome path  to specify the location of the bwbuild directory"
80   echo "   The default is to look in the user home for the bwbuild directory."
81   echo ""
82   echo "   CONFIG optionally defines the configuration to build"
83   echo "      -bwc configname"
84   echo ""
85   echo "   -offline     Build without attempting to retrieve library jars"
86   echo ""
87   echo "   LOG_LEVEL sets the level of logging and can be"
88   echo "      -log-silent   Nearly silent"
89   echo "      -log-quiet    The default"
90   echo "      -log-inform   A little more noisy"
91   echo "      -log-verbose  Noisier"
92   echo "      -ant-debug    Vast amounts of ant output"
93   echo "      -build-debug  Some bedework build debug output"
94   echo ""
95   echo "   target       Ant target to execute"
96   echo ""
97   echo "   PROJECT optionally defines the package to build and is one of"
98   echo "           the core, ancillary or experimental targets below:"
99   echo ""
100   echo "   Core projects: required for a functioning system"
101   echo "     -access      Target is for the access classes"
102   echo "     -bwxml       Target is for the Bedework XML schemas build"
103   echo "                       (usually built automatically be dependent projects"
104   echo "     -caldav      Target is for the CalDAV build"
105   echo "     -carddav     Target is for the CardDAV build"
106   echo "     -carddav deploy-addrbook    To deploy the Javascript Addressbook client."
107   echo "     -davutil     Target is for the Bedework dav util classes"
108   echo "     -rpiutil     Target is for the Bedework util classes"
109   echo "     -tzsvr       Target is for the timezones server build"
110   echo "     -webdav      Target is for the WebDAV build"
111   echo "   Ancillary projects: not required"
112   echo "     -bwtools     Target is for the Bedework tools build"
113   echo "     -caldavTest  Target is for the CalDAV Test build"
114   echo "     -monitor     Target is for the bedework monitor application"
115   echo "     -testsuite   Target is for the bedework test suite"
116   echo "   Experimental projects: no guarantees"
117   echo "     -catsvr      Target is for the Catsvr build"
118   echo "     -client      Target is for the bedework client application build"
119   echo "     -synch       Target is for the synch build"
120   echo "     -naming      Target is for the abstract naming api"
121   echo "     The default is a calendar build"
122   echo ""
123   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
124   echo "   directory which contains one directory per configuration."
125   echo ""
126   echo "   Within each configuration directory we expect a file called build.properties"
127   echo "   which should point to the property and options file needed for the deploy process"
128   echo ""
129   echo "   In general these files will be in the same directory as build.properties."
130   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
131   echo "   configuration directory and can be used to build a path to the other files."
132   echo ""
133 }
134
135 errorUsage() {
136   echo "*******************************************************************************************"
137   echo "Error: $1"
138   echo "*******************************************************************************************"
139   echo
140   echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C."
141   sleep 5
142   echo ""
143   usage
144   exit 1
145 }
146
147 # ----------------------------------------------------------------------------
148 # Update the projects
149 # ----------------------------------------------------------------------------
150 actionUpdateall() {
151   for project in $updateProjects
152   do
153     echo "*********************************************************************"
154     echo "Updating project $project"
155     echo "*********************************************************************"
156     svn update $project
157   done
158  
159   exit 0
160 }
161
162 usageZoneinfo() {
163   echo ""
164   echo "$PRG -zoneinfo -fetch"
165   echo "to have data fetched and processed. Alternatively to process a specifi set of data"
166   echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data"
167   echo "for example:"
168   echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz"
169   echo ""
170   echo "The data can be obtained manually in the following manner:"
171   echo "  wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'"
172   echo ""
173   echo "The version is the '*' part of the name"
174  
175   exit 1
176 }
177
178 # Change to the next project to build. Exit if we're done.
179 # The order below reflects the dependencies
180 setDirectory() {
181     specialTarget=
182    
183 #     Special targets
184         if [ "$dirstart" != "" ] ; then
185           cd $QUICKSTART_HOME
186           specialTarget=dirstart
187       dirstart=
188           return
189         fi
190
191         if [ "$deploylog4j" != "" ] ; then
192           cd $QUICKSTART_HOME
193           specialTarget=deploylog4j
194       deploylog4j=
195           return
196         fi
197        
198 #     projects
199         if [ "$bwxml" != "" ] ; then
200           cd $QUICKSTART_HOME/bwxml
201       bwxml=
202           return
203         fi
204        
205         if [ "$rpiutil" != "" ] ; then
206           cd $QUICKSTART_HOME/rpiutil
207       rpiutil=
208           return
209         fi
210        
211         if [ "$access" != "" ] ; then
212           cd $QUICKSTART_HOME/access
213       access=
214           return
215         fi
216        
217         if [ "$davutil" != "" ] ; then
218           cd $QUICKSTART_HOME/davutil
219       davutil=
220           return
221         fi
222        
223         if [ "$webdav" != "" ] ; then
224           cd $QUICKSTART_HOME/webdav
225       webdav=
226           return
227         fi
228        
229         if [ "$caldav" != "" ] ; then
230           cd $QUICKSTART_HOME/caldav
231       caldav=
232           return
233         fi
234        
235         if [ "$caldavTest" != "" ] ; then
236           cd $QUICKSTART_HOME/caldavTest
237       caldavTest=
238           return
239         fi
240        
241         if [ "$carddav" != "" ] ; then
242           cd $QUICKSTART_HOME/bedework-carddav
243       carddav=
244           return
245         fi
246        
247         if [ "$bedework" != "" ] ; then
248           cd $QUICKSTART_HOME
249       bedework=
250           return
251         fi
252        
253         if [ "$catsvr" != "" ] ; then
254           cd $QUICKSTART_HOME/catsvr
255       catsvr=
256           return
257         fi
258        
259         if [ "$client" != "" ] ; then
260           cd $QUICKSTART_HOME/bwclient
261       client=
262           return
263         fi
264        
265         if [ "$monitor" != "" ] ; then
266           cd $QUICKSTART_HOME/MonitorApp
267       monitor=
268           return
269         fi
270        
271         if [ "$naming" != "" ] ; then
272           cd $QUICKSTART_HOME/bwnaming
273       naming=
274           return
275         fi
276        
277         if [ "$synch" != "" ] ; then
278           cd $QUICKSTART_HOME/synch
279       synch=
280           return
281         fi
282        
283         if [ "$testsuite" != "" ] ; then
284           cd $QUICKSTART_HOME/testsuite
285       testsuite=
286           return
287         fi
288        
289         if [ "$tzsvr" != "" ] ; then
290           cd $QUICKSTART_HOME/bwtzsvr
291       tzsvr=
292           return
293         fi
294        
295         if [ "$bwtools" != "" ] ; then
296           cd $QUICKSTART_HOME/bwtools
297       bwtools=
298           return
299         fi
300
301 # Nothing left to do
302     echo "Finished at $(date)" 
303         exit 0;
304 }
305
306 # ----------------------------------------------------------------------------
307 # Build zoneinfo - require -version -tzdata
308 # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or
309 # more directly from ftp://elsie.nci.nih.gov/pub/
310 # The version parameter value should be the version code from the tzdata name
311 # ----------------------------------------------------------------------------
312 actionZoneinfo() {
313   bwtzsvr="$QUICKSTART_HOME/bwtzsvr"
314   bwresources="$bwtzsvr/resources"
315
316   rm -rf /tmp/bedework
317   mkdir /tmp/bedework
318   mkdir /tmp/bedework/timezones
319   mkdir /tmp/bedework/timezones/data
320  
321   cd /tmp/bedework/timezones
322  
323   shift
324  
325   if [ "$1" = "-fetch" ] ; then
326     shift
327     cd data
328     wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
329     gzip -dc tzdata*.tar.gz | tar -xf -
330    
331     filename=$(basename `ls tzdata*`)
332     version=$( echo $filename | cut -c 7-11 )
333    
334     tzdata="/tmp/bedework/timezones/data/$filename"
335    
336     cd ..
337    
338     echo version=$version
339     echo tzdata=$tzdata
340   else
341     if [ "$1" != "-version" ] ; then
342       echo "got $1"
343       echo "Must supply -version parameter for -zoneinfo"
344       usageZoneinfo
345     fi
346    
347     shift
348
349     echo "got $1"
350     version=$1
351
352     shift
353    
354     if [ "$1" != "-tzdata" ] ; then
355       echo "Must supply -tzdata parameter for -zoneinfo"
356       usageZoneinfo
357     fi
358    
359     shift
360
361     tzdata=$1
362
363     shift
364   fi
365  
366   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
367   gunzip vzic-1.3.tgz
368   tar -xf vzic-1.3.tar
369
370 # copy and unpack the data
371   mkdir olsondata
372   cd olsondata
373   cp $tzdata tzdata.tar.gz
374   gunzip tzdata.tar.gz
375   tar -xf tzdata.tar
376   rm tzdata.tar
377   cd ..
378  
379 # Replace lines in the makefile. Sure real unix types can do better 
380  
381   cd vzic-1.3
382  
383   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
384
385   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
386
387   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
388  
389   make
390  
391 # omit the pure for allegedly better outlook compatability -
392 # but not altogether correct timezones 
393   ./vzic --pure
394
395   cd ..
396  
397   mkdir tzdata
398   cp -r vzic-1.3/zoneinfo tzdata
399   cp $bwresources/aliases.txt tzdata
400  
401   cd tzdata
402  
403   echo "version=$version" > info.txt
404 #  date +buildTime=%D-%T-%N >> info.txt
405   date --utc +buildTime=%Y%m%dT%H%M%SZ >> info.txt
406  
407   zip -r tzdata *
408  
409   cp tzdata.zip $bwtzsvr/dist
410  
411   echo ""
412   echo "------------------------------------------------------------------------------"
413   echo "tzdata.zip has been built and is at $bwtzsvr/dist/tzdata.zip"
414   echo "------------------------------------------------------------------------------"
415   echo ""
416  
417   exit 0
418 }
419
420 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
421   errorUsage "JAVA_HOME is not defined correctly for bedework."
422 fi
423
424 saveddir=`pwd`
425
426 trap 'cd $saveddir' 0
427 trap "exit 2" 1 2 3 15
428
429 export QUICKSTART_HOME=$saveddir
430
431 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
432 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
433
434 # Default some parameters
435
436 BWCONFIGS=
437 bwc=default
438 BWCONFIG=
439 offline=
440 quickstart=
441
442 action=
443
444 if [ "$1" = "" ] ; then
445   usage
446   exit 1
447 fi
448
449 # look for actions first
450
451 if [ "$1" = "-updateall" ] ; then
452   actionUpdateall
453 fi
454
455 if [ "$1" = "-zoneinfo" ] ; then
456   actionZoneinfo $*
457 fi
458
459 if [ "$1" = "-buildwebcache" ] ; then
460   cd $QUICKSTART_HOME/cachedfeeder
461   ./buildWebCache
462   exit
463 fi
464
465 if [ "$1" = "-deploywebcache" ] ; then
466   cd $QUICKSTART_HOME/cachedfeeder
467   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
468                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-webcache
469   exit
470 fi
471
472 if [ "$1" = "-deployurlbuilder" ] ; then
473   cd $QUICKSTART_HOME/cachedfeeder
474   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
475                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-urlbuilder
476   exit
477 fi
478
479 while [ "$1" != "" ]
480 do
481   # Process the next arg
482   case $1       # Look at $1
483   in
484     -bwchome)         # Define location of configs
485       shift
486       BWCONFIGS="$1"
487       shift
488       ;;
489     -quickstart)
490       quickstart="yes"
491       shift
492       ;;
493     -usage | -help | -? | ?)
494       usage
495       exit
496       shift
497       ;;
498     -bwc)
499       shift
500       bwc="$1"
501       shift
502       ;;
503     -offline)
504       offline="-Dorg.bedework.offline.build=yes"
505       shift
506       ;;
507 # ----------------------- Log level       
508     -log-silent)
509       ant_loglevel="-quiet"
510       bw_loglevel="-Dorg.bedework.build.silent=true"
511       shift
512       ;;
513     -log-quiet)
514       ant_loglevel="-quiet"
515       bw_loglevel=""
516       shift
517       ;;
518     -log-inform)
519       ant_loglevel=""
520       bw_loglevel="-Dorg.bedework.build.inform=true"
521       shift
522       ;;
523     -log-verbose)
524       ant_loglevel="-verbose"
525       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
526       shift
527       ;;
528     -ant-debug)
529       ant_loglevel="-debug"
530       shift
531       ;;
532     -build-debug)
533       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
534       shift
535       ;;
536 # ------------------------Special targets
537     deploylog4j)
538           deploylog4j="yes"
539       pkgdefault=
540       shift
541       ;;
542         dirstart)
543           dirstart="yes"
544       pkgdefault=
545       shift
546       ;;
547 # ------------------------Projects
548     -access)
549       access="yes"
550      
551       bwxml="yes"
552       rpiutil="yes"
553       pkgdefault=
554       shift
555       ;;
556     -bwtools)
557       bwtools="yes"
558       pkgdefault=
559       shift
560       ;;
561     -bwxml)
562       bwxml="yes"
563       pkgdefault=
564       shift
565       ;;
566     -caldav)
567       caldav="yes"
568
569       access="yes"
570       bwxml="yes"
571       rpiutil="yes"
572       webdav="yes"
573       pkgdefault=
574       shift
575       ;;
576     -caldavTest)
577       caldavTest="yes"
578
579       access="yes"
580       bwxml="yes"
581       rpiutil="yes"
582       webdav="yes"
583       pkgdefault=
584       shift
585       ;;
586     -carddav)
587       carddav="yes"
588
589       access="yes"
590       bwxml="yes"
591       davutil="yes"
592       rpiutil="yes"
593       webdav="yes"
594       pkgdefault=
595       shift
596       ;;
597     -catsvr)
598       catsvr="yes"
599
600       access="yes"
601       bwxml="yes"
602       rpiutil="yes"
603       webdav="yes"
604       pkgdefault=
605       shift
606       ;;
607     -client)
608       client="yes"
609       pkgdefault=
610       shift
611       ;;
612     -davutil)
613       davutil="yes"
614
615       bwxml="yes"
616       rpiutil="yes"
617       pkgdefault=
618       shift
619       ;;
620     -monitor)
621       monitor="yes"
622       pkgdefault=
623       shift
624       ;;
625     -naming)
626       naming="yes"
627       pkgdefault=
628       shift
629       ;;
630     -rpiutil)
631       rpiutil="yes"
632
633       bwxml="yes"
634       pkgdefault=
635       shift
636       ;;
637     -synch)
638       synch="yes"
639      
640       access="yes"
641       bwxml="yes"
642       davutil="yes"
643       rpiutil="yes"
644       pkgdefault=
645       shift
646       ;;
647     -testsuite)
648       testsuite="yes"
649       pkgdefault=
650       shift
651       ;;
652     -tzsvr)
653       tzsvr="yes"
654       bwxml="yes"
655       rpiutil="yes"
656       pkgdefault=
657       shift
658       ;;
659     -webdav)
660       webdav="yes"
661
662       access="yes"
663       bwxml="yes"
664       rpiutil="yes"
665       pkgdefault=
666       shift
667       ;;
668     -*)
669       usage
670       exit 1
671       ;;
672     *)
673       # Assume we've reached the target(s)
674       break
675       ;;
676   esac
677 done
678
679 if [ "$pkgdefault" = "yes" ] ; then
680   bedework="yes"
681
682   access="yes"
683   bwxml="yes"
684   caldav="yes"
685   davutil="yes"
686   rpiutil="yes"
687   webdav="yes"
688 fi
689
690 if [ "$quickstart" != "" ] ; then
691   if [ "$BWCONFIGS" != "" ] ; then
692     errorUsage "Cannot specify both -quickstart and -bwchome"
693   fi
694   if [ "$bwc" = "jboss" ] ; then
695         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
696   fi
697
698   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
699 elif [ "$BWCONFIGS" = "" ] ; then
700   BWCONFIGS=$HOME/bwbuild
701 fi
702
703 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
704 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
705
706 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then
707   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'."
708 fi
709
710 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.defaults" ] ; then
711   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.defaults'."
712 fi
713
714 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
715   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
716 fi
717
718 # Make available for ant
719 export BWCONFIG="-Dorg.bedework.build.properties=$BEDEWORK_CONFIG/build.properties"
720
721 echo "BWCONFIGS=$BWCONFIGS"
722 echo "BWCONFIG=$BWCONFIG"
723
724 javacmd="$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"
725
726 while true
727 do
728   setDirectory
729  
730   if [ "$specialTarget" != "" ] ; then
731     $javacmd $specialTarget
732   else 
733     $javacmd $*
734   fi
735 done
736  
Note: See TracBrowser for help on using the browser.