/[pdpsoft]/trunk/grid-mw-security/glexec/util/sac_from_source/sac_from_source.sh
ViewVC logotype

Contents of /trunk/grid-mw-security/glexec/util/sac_from_source/sac_from_source.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2289 - (show annotations) (download) (as text)
Fri Apr 29 09:48:03 2011 UTC (10 years, 8 months ago) by msalle
File MIME type: application/x-shellscript
File size: 52122 byte(s)
Bumping version to 0.3.0: new tracking plugin etc.

1 #!/bin/sh
2
3 # Script to build Nikhef-developed gLite tools from source as obtained from CVS
4 # and SVN.
5 #
6 # Author: Mischa Sall\'e
7 #
8 # Questions and comments: <grid-mw-security@nikhef.nl>
9 #
10 ##############################################################################
11 # Global definitions
12 ##############################################################################
13
14 VERSION=0.3.0
15
16 SOURCE_DEFAULT=/tmp/source # Where to download sources
17 NEWTARGETFILE_DEFAULT="failedcomps.txt"
18 NEWFLAGFILE_DEFAULT="configflag.txt"
19 NEWFLAGFILE_TMP=/tmp/${NEWFLAGFILE_DEFAULT}$$
20 DESTDIR_DEFAULT=/tmp/build # Where to install binaries
21
22 webcvs=http://glite.cvs.cern.ch/cgi-bin/glite.cgi/ # Web CVS location
23 mwsec_svnroot=http://ndpfsvn.nikhef.nl/ro/mwsec/
24 globus_baseurl=http://www.globus.org/ftppub/ # Base for globus tarball
25 globus_flavor=unset
26
27 # Valid return codes: anything less than RC_FAILED is non-blocking
28 RC_SUCCESS=0
29 RC_SKIPPED=1
30 RC_DISTFAILED=2
31 RC_FAILED=4
32 RC_MISSDEP=8
33
34 myexit() {
35 if [ -f "$NEWFLAGFILE_TMP" ];then
36 rm $NEWFLAGFILE_TMP
37 fi
38 exit $1
39 }
40
41 # Define error function
42 error() {
43 echo "$PROG: $*" >&2
44 myexit 1
45 }
46
47 # Define warning function
48 warning() {
49 echo "$PROG: $*" >&2
50 }
51
52 # Define a message only printed when verbose
53 verb_msg() {
54 if [ $VERBOSE -eq 1 ];then
55 echo "$PROG: $*"
56 fi
57 }
58
59 # Set defaults
60 PROG=`basename $0`
61 GNU_DEF_PFX="/usr/local"
62
63 CONFIG="" # No default configuration file
64 COMPO=""
65 TARGETFILE=""
66 NEWTARGETFILE=""
67 myDISTDIR=""
68 SOURCE="$SOURCE_DEFAULT" # where to download sources
69 myDESTDIR="$DESTDIR_DEFAULT" # where to stage builds
70 DESTDIR_flag="DESTDIR=$myDESTDIR"
71 DEPEND=1 # Do dependency checks when building all
72 DIST=0
73 USAGE=0 # printing of usage is not a default (-;
74 REMOVE=0 # Do NOT remove directories before downloading etc.
75 EXIT_ON_ERROR=0 # Continue on failing target
76 STDOUT="" # No file for stdout
77 STDERR="" # No file for stderr
78 PLATFORM="" # No default platform (only used for globus from etics)
79 FLAGS=""
80 FLAGFILE=""
81 NEWFLAGFILE=""
82 VERBOSE=0
83
84 # Parse command line options
85 while getopts ":c:C:i:I:s:dDhrxo:e:p:F:f:N:Vv" i ; do
86 case "$i" in
87 c) CONFIG="$OPTARG" ;;
88 C) COMPO="$COMPO target:$OPTARG" ;;
89 i) TARGETFILE="$OPTARG" ;;
90 I) NEWTARGETFILE="$OPTARG" ;;
91 s) SOURCE="$OPTARG" ;;
92 d) DEPEND=0 ;;
93 D) DIST=1 ;;
94 h) USAGE=1 ;;
95 r) REMOVE=1 ;;
96 x) EXIT_ON_ERROR=1 ;;
97 o) STDOUT="$OPTARG" ;;
98 e) STDERR="$OPTARG" ;;
99 p) PLATFORM="$OPTARG" ;;
100 F) FLAGS="$FLAGS `echo $OPTARG|tr ',' ' '`" ;;
101 f) FLAGFILE="$OPTARG" ;;
102 N) NEWFLAGFILE="$OPTARG" ;;
103 V) VERBOSE=1 ;;
104 v) echo "$PROG version: $VERSION"
105 myexit 0 ;;
106 :) echo "$PROG: option requires an argument -- '$OPTARG'" >&2
107 echo "Try \`$PROG -h' for more information." >&2
108 myexit 1 ;;
109 \?) echo "$PROG: invalid option -- '$OPTARG'" >&2
110 echo "Try \`$PROG -h' for more information." >&2
111 myexit 1 ;;
112 esac
113 done
114 shift `expr $OPTIND - 1`
115
116 ##############################################################################
117 # Convenience functions
118 ##############################################################################
119
120
121 # Prints usage message
122 usage() {
123 echo "Usage: $PROG [options] [targets]"
124 echo
125 echo "Options:"
126 echo " -c <config> get build options from file <config>, see below."
127 echo " -C <options> specify extra build options"\
128 "(will override those from file),"
129 echo " use , as separator between suboptions,"\
130 "use multiple -C"
131 echo " options for multiple components, see below."
132 echo " -i <file> get targets from <file>, any targets on the cmdline"\
133 "are added."
134 echo " -I <file> save list of failed targets (failed or missing dependencies)"
135 echo " into <file>, which can be used as input for -i option,"
136 echo " default <sourcedir>/$NEWTARGETFILE_DEFAULT."
137 echo " -s specify directory where to checkout sources,"
138 echo " default ${SOURCE_DEFAULT}"
139 echo " -d don't check dependencies."
140 echo " -D create dist tarballs, will be put in DISTDIR,"
141 echo " default: <sourcedir>, see -s. Override DISTDIR using -F."
142 echo " -r remove (old) source directories before checkout."
143 echo " -x exit on first failing target (default continue)."
144 echo " -o <file> send checkout/build stdout to <file>."
145 echo " -e <file> send checkout/build stderr to <file>."
146 echo " -p <platform> download globus for <platform> from etics/VDT"\
147 "instead of"
148 echo " building from source, \"-p help\" prints"\
149 "valid options."
150 echo " -f <flagfile> get extra configure flags from <flagfile>."
151 echo " -F <flags> specify extra configure flags "\
152 "(will override those from file),"
153 echo " use , as separator between options, see below."
154 echo " -N <flagfile> save flags for a new build (using -f) into <flagfile>,"
155 echo " default <sourcedir>/$NEWFLAGFILE_DEFAULT"
156 echo " -V be more verbose."
157 echo " -h show this helptext."
158 echo
159 echo "Valid exit values:"
160 echo " 1 non-build related error"
161 echo "or sum of"
162 echo " $RC_DISTFAILED at least one distribution tarball failed"
163 echo " $RC_FAILED at least one build failed"
164 echo " $RC_MISSDEP at least one build missed dependencies"
165 echo
166 echo "Format for config file:"
167 echo "<target> [tag:<value>] [compo:<value>] [cvsroot:<value>] \\"
168 echo " [svnroot:<value>] [gitrepo:<value>] [coopts:<value>]"
169 echo "where"
170 echo " tag specifies CVS or SVN tag"
171 echo " compo specifies long component name"
172 echo " cvsroot specifies CVSROOT"
173 echo " cvsrootweb specifies ROOT to use for CVS tarball download"
174 echo " svnroot specifies SVN repository (not including trunk/ etc.)"
175 echo " gitrepo specifies full git repository (eg. git:myrepo/mycompo.git"
176 echo " coopts specifies checkout options for CVS/SVN"
177 echo "A configline can be continued using the \\ char."
178 echo "After a # the remainder of the line is ignored."
179 echo "coopts are inserted after the checkout command for cvs and/or svn, NOT git."
180 echo "The same fields can be used for the -C option using a comma as separator:"
181 echo " -C glexec,tag:tags/glexec/0.8.2"
182 echo
183 echo "Format for flagfile:"
184 echo "<flag>=<value>"
185 echo "where flag can be:"
186 echo " prefix used in 'configure --prefix=<value>'"
187 echo " libdir used in 'configure --libdir=<value>'"
188 echo " globus ignores this value."
189 echo " includedir used in 'configure --includedir=<value>'"
190 echo " sysconfdir used in 'configure --sysconfdir=<value>'"
191 echo " DESTDIR used in 'make DESTDIR=<value>', default $DESTDIR_DEFAULT."
192 echo " Use DESTDIR=\"\" in order to install in the prefix dir."
193 echo " For globus, the configure prefix is prefixed with DESTDIR."
194 echo " DISTDIR output of 'make dist' is moved to this dir,"
195 echo " default <sourcedir>"
196 echo " globus specify build prefix for globus itself,"
197 echo " default $GNU_DEF_PFX or <prefix>."
198 echo " gridsite specify build prefix for gridsite itself"
199 echo " default $GNU_DEF_PFX or <prefix>."
200 echo " <compo>-prefix used in 'configure --with-<compo>-prefix=<value>'"
201 echo " <compo>-libdir used in 'configure --with-<compo>-libdir=<value>',"
202 echo " NOT for globus"
203 echo " <compo>-includes used in 'configure --with-<compo>-includes=<value>',"
204 echo " NOT for globus, gridsite, pep-api, xacml."
205 echo " globus-flavor used in 'configure --with-globus-nothr-flavor=<value>"
206 echo "Valid values for <compo> are:"
207 echo " globus gridsite voms lcmaps lcas jobrep-api pep-api xacml"
208 echo "The same flags can be used for the -F option, using comma as separator."
209 echo "Flags will be saved in a file (default <sourcedir>/$NEWFLAGFILE_DEFAULT)"
210 echo "which can be used as input for a rebuild."
211 echo
212 echo "Notes:"
213 echo "1. when the special target all is specified,"\
214 "all known targets are built."
215 echo "2. targets are build in the 'known-targets' order, with duplicates removed,"
216 echo " the 'all' target is expanded before removing duplicates."
217 echo "3. when checking dependencies, only dependencies between components which"\
218 "are"
219 echo " actually being build will be checked."
220 echo "4. when building both lcas/lcmaps and lcas/lcmaps-interface, the"\
221 "interface"
222 echo " is only build when the main component has failed."
223 echo
224 echo "Known targets:"
225 for target in $known_targets;do
226 echo " $target"
227 done
228 echo
229 return $RC_SUCCESS
230 }
231
232 # Function which is used to create the dependency checking functions.
233 # arguments:
234 # $1 - target
235 # $2... - dependencies
236 setdeps() {
237 if [ $# -eq 0 ];then
238 echo "Error: $PROG needs at least one argument." >&2
239 return $RC_FAILED
240 fi
241
242 # target
243 target=$1; shift
244 known_targets="$known_targets $target"
245
246 eval rc_$target=$RC_SKIPPED
247
248 depstring=""
249 # Only when we DO want dependency checking...
250 if [ $DEPEND -eq 1 ];then
251 while [ $# -gt 0 ];do
252 # Use RC_FAILED as default for rc_$1 in case it's not defined
253 depstring="$depstring \${rc_$1:-\$RC_FAILED} -lt \$RC_FAILED"
254 shift
255 if [ $# -gt 0 ];then
256 depstring="$depstring -a"
257 fi
258 done
259 fi
260
261 # define the dep_ function
262 if [ -n "$depstring" ];then
263 eval "dep_$target() {
264 if [ $depstring ];then
265 $target
266 rc_$target=\$?
267 else
268 rc_$target=\$RC_MISSDEP
269 fi
270 return \$rc_$target
271 }"
272 else
273 eval "dep_$target() {
274 $target
275 rc_$target=\$?
276 return \$rc_$target
277 }"
278 fi
279 }
280
281 # function to get a suitable download command with cmdline args. The result will
282 # be in variable $wget
283 # Expected format:
284 # $wget $URL > $outputfile
285 get_download_cmd() {
286 func=get_downloadcmd
287 if which wget > /dev/null 2> /dev/null;then
288 wget="wget -nv -O -"
289 elif which curl > /dev/null 2> /dev/null;then
290 wget="curl -s"
291 elif which lynx > /dev/null 2> /dev/null;then
292 wget="lynx -dump -source"
293 else
294 error "$func: Cannot find download tool such as wget, curl, lynx etc."
295 fi
296 }
297
298 # Parses a single configuration line/entry, i.e. for a single component
299 parse_config_line() {
300 first=1
301 for field in `echo $line`;do
302 # first char == '#' ? then go to next line
303 [ "`echo "$field"|cut -c1`" = '#' ] && break
304 # Now differentiate between first compo and others
305 if [ $first -eq 1 ];then
306 name=$field
307 echo $name | grep -q : && \
308 error "$name is not a valid component name"
309 # Make sure we reset the variables
310 eval "tag_$name=\"\""
311 eval "compo_$name=\"\""
312 eval "cvsroot_$name=\"\""
313 eval "cvsrootweb_$name=\"\""
314 eval "svnroot_$name=\"\""
315 eval "gitrepo_$name=\"\""
316 eval "coopts_$name=\"\""
317 first=0
318 else
319 case "$field" in
320 tag:*) eval tag_$name=\$\{field#tag:\} ;;
321 compo:*) eval compo_$name=\$\{field#compo:\} ;;
322 cvsroot:*) eval cvsroot_$name=\$\{field#cvsroot:\} ;;
323 cvsrootweb:*) eval cvsrootweb_$name=\$\{field#cvsrootweb:\} ;;
324 svnroot:*) eval svnroot_$name=\$\{field#svnroot:\} ;;
325 gitrepo:*) eval gitrepo_$name=\$\{field#gitrepo:\} ;;
326 coopts:) eval coopts_$name=\$\{field#coopts:\} ;;
327 esac
328 fi
329 done
330 }
331
332 # function that parses the CONFIG file and COMPO options and sets all the tag_
333 # compo_ cvsroot_ svnroot_ variables
334 # We cannot use subshells in order to get the vars in the current shell, which
335 # sometimes obfuscates the code a bit.
336 parse_config() {
337 if [ -n "$CONFIG" ];then
338 lines=`cat $CONFIG|wc -l`
339 lineno=0
340 line=""
341 cont=0
342 while [ $lineno -lt $lines ];do
343 lineno=`expr $lineno + 1`
344 readline=`sed -n ${lineno}p $CONFIG`
345 # replace trailing [whitespace] \ [whitespace] by a single space
346 subline=`echo "${readline}"|sed 's/[ \t]*\\\[ \t]*$/ /'`
347 line="${line}${subline}"
348 # Continue when continuation char, empty line, or comment line
349 if [ "$subline" != "$readline" ];then
350 cont=1
351 continue
352 fi
353 # line is ready, parse the components
354 parse_config_line $line
355 # reset line and cont
356 line=""
357 cont=0
358 done
359 if [ $cont -ne 0 ];then
360 error "Unexpected end of file while parsing $CONFIG"
361 fi
362 fi
363
364 if [ -n "$COMPO" ];then
365 for readline in `echo "$COMPO"|sed 's/ target:/\n/g'`;do
366 line=`echo "${readline}"|tr , ' '|sed 's/[ \t]*\\\[ \t]*$/ /'`
367 parse_config_line $line
368 done
369 fi
370 }
371
372 # Parses a configuration flag, coming from either FLAGFILE or FLAGS.
373 parse_flag() {
374 flag="$1"
375 case "$flag" in
376 prefix=*|libdir=*|includedir=*|sysconfdir=*)
377 eval my$flag
378 var=`echo $flag|cut -d= -f1`
379 eval ${var}_flag="--$flag" ;;
380
381 DESTDIR=*)
382 eval my$flag
383 if [ -n "$myDESTDIR" ];then
384 DESTDIR_flag=$flag
385 else
386 DESTDIR_flag=""
387 fi
388 ;;
389
390 DISTDIR=*)
391 eval my$flag ;;
392
393 globus=*|gridsite=*)
394 eval my$flag ;;
395
396 # prefix/includes flags for *other* components.
397 globus-prefix=*|\
398 gridsite-prefix=*|gridsite-libdir=*|\
399 voms-prefix=*|voms-includes=*|voms-libdir=*|\
400 lcmaps-prefix=*|lcmaps-includes=*|lcmaps-libdir=*|\
401 lcas-prefix=*|lcas-includes=*|lcas-libdir=*|\
402 jobrep-api-prefix=*|jobrep-api-includes=*|jobrep-api-libdir=*|\
403 pep-api-prefix=*|pep-api-libdir=*|\
404 xacml-prefix=*|xacml-libdir=*)
405 var=`echo $flag|cut -d= -f1|tr '-' '_'`
406 value=`echo $flag|cut -d= -f2`
407 eval ${var}="$value"
408 eval ${var}_flag="--with-$flag" ;;
409
410 # globus flavor for other components.
411 globus-flavor=*)
412 globus_flavor=`echo $flag|cut -d= -f2`
413 globus_flavor_flag="--with-globus-nothr-flavor=$globus_flavor" ;;
414
415 *) error "Unknown configure flag \"$flag\" specified" ;;
416 esac
417 echo "$flag" >> $NEWFLAGFILE_TMP
418 }
419
420 # Saves configuration flags from temporary file
421 save_flags() {
422 rm -f $NEWFLAGFILE
423 echo "# WARNING: this is a CREATED file, local changes will (probably) get lost" \
424 > $NEWFLAGFILE
425 echo "# This file contains all configure flags:" >> $NEWFLAGFILE
426 echo "# $PROG -f $NEWFLAGFILE" >> $NEWFLAGFILE
427 for flag in `cut -d'=' -f1 $NEWFLAGFILE_TMP|sort -u`;do
428 case "$flag" in
429 prefix|libdir|includedir|sysconfdir|DESTDIR|DISTDIR)
430 eval value="\$my$flag"
431 eval echo "$flag=$value" >> $NEWFLAGFILE ;;
432 globus|gridsite)
433 eval value="\$my$flag"
434 eval rc=\$rc_$flag
435 # Only save these build flags if the component failed
436 if [ "$rc" = "$RC_FAILED" -o "$rc" = "$RC_MISSDEP" ];then
437 eval echo "$flag=$value" >> $NEWFLAGFILE
438 fi ;;
439 *-prefix|*-includes|*-libdir|globus-flavor)
440 eval value="\$`echo $flag|tr '-' '_'`"
441 eval echo "$flag=$value" >> $NEWFLAGFILE ;;
442 *) error "Unknown configure flag \"$flag\" found" ;;
443 esac
444 done
445 rm -f $NEWFLAGFILE_TMP
446 }
447
448 # cvs checkout wrapper: a wget + untar is much faster than anonymous cvs
449 # checkout, especially due to a 30 sec. timeout of the CVS server.
450 cvsget() {
451 name="$1"
452 dir="$2"
453 [ -z "$name" ] && return $RC_FAILED
454 eval compo=\$\{compo_$name\}
455 eval tag=\$\{tag_$name\}
456 eval cvsroot=\$\{cvsroot_$name\}
457 eval coopts=\$\{coopts_$name\}
458 # optionally remove directory
459 [ $REMOVE -eq 1 ] && rm -rf ${dir:-$compo}
460 # use cvs checkout
461 cvs -d $cvsroot co $coopts \
462 ${tag:+-r $tag} \
463 ${dir:+-d $dir} $compo || return $RC_FAILED
464
465 return $RC_SUCCESS
466 }
467
468 cvswebget() {
469 name="$1"
470 dir="$2"
471 [ -z "$name" ] && return $RC_FAILED
472 eval compo=\$\{compo_$name\}
473 eval tag=\$\{tag_$name\}
474 eval cvsrootweb=\$\{cvsrootweb_$name\}
475 eval coopts=\$\{coopts_$name\}
476 url="${cvsrootweb:-$webcvs}${compo}.tar.gz?view=tar${tag:+&pathrev=$tag}"
477 # Use tarball installation: always remove old dir
478 rm -rf ${dir:-$compo}
479 # If custom directory: download in tmpdir and later move to dir
480 if [ -n "$dir" ];then
481 tmpdir=tmpdir.$$
482 mkdir ${tmpdir} && cd ${tmpdir} || return $RC_FAILED
483 fi
484 # Retrieve tarball and untar on the fly
485 eval "${wget} \"$url\"" | tar -zvxf - || return $RC_FAILED
486 # Move downloaded dir into $dir and cleanup
487 if [ -n "$dir" ];then
488 cd .. && \
489 mv ${tmpdir}/${compo} $dir && \
490 rmdir ${tmpdir} || return $RC_FAILED
491 unset tmpdir
492 fi
493
494 return $RC_SUCCESS
495 }
496
497 # svn checkout wrapper
498 svnget() {
499 name="$1"
500 dir="$2"
501 [ -z "$name" ] && return $RC_FAILED
502 eval compo=\$\{compo_$name\}
503 eval tag=\$\{tag_$name:-trunk/$compo\}
504 eval svnroot=\$\{svnroot_$name:-$mwsec_svnroot\}
505 eval coopts=\$\{coopts_$name\}
506 realdir=${dir:-$compo}
507 # optionally remove directory
508 [ $REMOVE -eq 1 ] && rm -rf ${realdir}
509 svn co $coopts ${svnroot}${tag} ${realdir} || return $RC_FAILED
510 unset realdir
511
512 return $RC_SUCCESS
513 }
514
515 # git checkout wrapper
516 gitget() {
517 name="$1"
518 dir="$2"
519 [ -z "$name" ] && return $RC_FAILED
520 eval compo=\$\{compo_$name\}
521 eval tag=\$\{tag_$name\}
522 eval gitrepo=\$\{gitrepo_$name\}
523 [ -z "$gitrepo" ] && return $RC_FAILED
524 #eval coopts=\$\{coopts_$name\}
525 realdir=${dir:-$compo}
526 # optionally remove directory
527 [ $REMOVE -eq 1 ] && rm -rf ${realdir}
528 if [ -d ${realdir} ];then
529 cd ${realdir} && \
530 git checkout ${tag} && \
531 git fetch && \
532 git reset --hard || return $RC_FAILED
533 cd ..
534 else
535 if [ -n "${tag}" ] ; then
536 git clone -n ${gitrepo} ${realdir} && \
537 cd ${realdir} && \
538 git checkout ${tag} || return $RC_FAILED
539 cd ..
540 else
541 git clone ${gitrepo} ${realdir} || return $RC_FAILED
542 fi
543 fi
544 }
545
546 # general cvs and svn wrapper: use svn ONLY when cvsroot is NOT defined AND
547 # svnroot is defined. In all other cases, use cvsroot
548 get() {
549 name="$1"
550 dir="$2"
551 [ -z "$name" ] && return $RC_FAILED
552 eval cvsroot=\$\{cvsroot_$name\}
553 eval cvsrootweb=\$\{cvsrootweb_$name\}
554 eval svnroot=\$\{svnroot_$name\}
555 eval gitrepo=\$\{gitrepo_$name\}
556 if [ -n "$cvsroot" ] ; then
557 cvsget $name $dir
558 elif [ -n "$cvsrootweb" ] ; then
559 cvswebget $name $dir
560 elif [ -n "$gitrepo" ] ; then
561 gitget $name $dir
562 else
563 svnget $name $dir
564 fi
565 return $?
566 }
567
568 # Print function for results:
569 # $1 - name of component, result is in $rc_<name of component>
570 print_result() {
571 tool=$1
572 eval rc=\$rc_$tool
573 [ "$rc" = "$RC_SKIPPED" ] && return
574 case "$rc" in
575 $RC_SUCCESS) result="SUCCESS" ;;
576 $RC_DISTFAILED) result="DIST TARBALL FAILED"
577 echo "$tool" >> $NEWTARGETFILE
578 DISTFAILED=$RC_DISTFAILED ;;
579 $RC_MISSDEP) result="MISSING DEPS"
580 echo "$tool" >> $NEWTARGETFILE
581 MISSING=$RC_MISSDEP ;;
582 $RC_FAILED) result="FAILED"
583 echo "$tool" >> $NEWTARGETFILE
584 FAILED=$RC_FAILED ;;
585 *) result="UNKNOWN: $rc" ;;
586 esac
587 printf "%-33s: %s\n" "$tool" "$result"
588 }
589
590 # Creates dist tarball and moves it to the ${SOURCE} directory.
591 make_dist() {
592 if [ $DIST -eq 1 ];then
593 # Allow for an optionally given tarball
594 if [ -n "$1" ];then
595 tarball=$1
596 else
597 package=`grep "^PACKAGE *= *" Makefile|sed 's/PACKAGE *= *//'`
598 version=`grep "^VERSION *= *" Makefile|sed 's/VERSION *= *//'`
599 tarball=${package}-${version}.tar.gz
600 fi
601 if [ -f "$tarball" ];then
602 rm -f $tarball
603 fi
604 make dist || return $RC_DISTFAILED
605 mkdir -p ${myDISTDIR} && mv $tarball ${myDISTDIR} || return $RC_DISTFAILED
606 fi
607 return $RC_SUCCESS
608 }
609
610 # Build the targets and print the results
611 build() {
612 t0=`date +%s`
613 # build the targets
614 for target in $build_targets;do
615 eval dep_$target
616 [ $EXIT_ON_ERROR -eq 1 -a $? -ge $RC_FAILED ] && break
617 done
618 t1=`date +%s`
619
620 if [ -n "$NEWTARGETFILE" ];then
621 rm -f $NEWTARGETFILE
622 echo "# WARNING: this is a CREATED file, local changes will "\
623 "(probably) get lost" > $NEWTARGETFILE
624 echo "# This file contains all failed components:" >> $NEWTARGETFILE
625 echo "# $PROG -i $NEWTARGETFILE" >> $NEWTARGETFILE
626 fi
627 # Print results
628 for target in $known_targets;do
629 print_result $target
630 done
631 # Save flags file
632 save_flags
633
634 echo "Total build time: `expr $t1 - $t0` seconds"
635 }
636
637 # Sets the default configure flags for a built component, and saves them to the tmp file.
638 set_def_compo_flags() {
639 compo=$1; shift
640 name=`echo $compo|tr '_' '-'`
641 for var in $*;do
642 case "$var" in
643 prefix)
644 if [ -n "$myDESTDIR" -o -n "$myprefix" ];then
645 value="${myDESTDIR}/${myprefix:-$GNU_DEF_PFX}"
646 eval ${compo}_${var}="$value"
647 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
648 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
649 fi
650 ;;
651 includes)
652 # Only set includes flags when we have overridden the default
653 # location, otherwise prefix is sufficient.
654 if [ -n "$myincludedir" ];then
655 value="${myDESTDIR}/${myincludedir}"
656 eval ${compo}_${var}="$value"
657 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
658 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
659 fi
660 ;;
661 libdir)
662 # Only set libdir flags when we have overridden the default
663 # location, otherwise prefix is sufficient.
664 if [ -n "$mylibdir" ];then
665 value="${myDESTDIR}/${mylibdir}"
666 eval ${compo}_${var}="$value"
667 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
668 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
669 fi
670 ;;
671 *) error "Unknown flag type \"$var\" specified"
672 ;;
673 esac
674 done
675 }
676
677 # Sets configure flags for a built component assuming the ${compo}_* is already set.
678 # Then saves the flags to the tmp file.
679 set_compo_flags() {
680 compo=$1; shift
681 name=`echo $compo|tr '_' '-'`
682 for var in $*;do
683 eval ${compo}_${var}_flag=""
684 eval value=\$${compo}_${var}
685 if [ -n "$value" ];then
686 case "$var" in
687 prefix)
688 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
689 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
690 ;;
691 includes)
692 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
693 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
694 ;;
695 libdir)
696 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
697 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
698 ;;
699 flavor)
700 eval ${compo}_${var}_flag="--with-${name}-nothr-${var}=$value"
701 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
702 ;;
703 *) error "Unknown flag type \"$var\" specified"
704 ;;
705 esac
706 fi
707 done
708 }
709
710 ##############################################################################
711 #
712 # Define all building functions
713 #
714 ##############################################################################
715
716 # GLOBUS
717
718
719 # print known platforms for globus tarball
720 globus_etics_platform() {
721 echo "Valid platforms are:"
722 echo " RH4_32"
723 echo " RH5_64"
724 echo " SUSE11_64"
725 echo " Deb5_64"
726 }
727
728 # globus from VDT/etics tarball
729 globus_etics() {
730 # Find correct globus for platform
731 case "$PLATFORM" in
732 RH4_32)
733 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.3-VDT-1.6.1/slc4_ia32_gcc346/
734 globus_tgz=globus-4.0.3-VDT-1.6.1-7.tar.gz
735 globus_flavor=gcc32dbg
736 ;;
737 RH5_64)
738 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.7-VDT-1.10.1/sl5_x86_64_gcc412/
739 globus_tgz=globus-4.0.7-VDT-1.10.1-1.tar.gz
740 globus_flavor=gcc64dbg
741 ;;
742 SUSE11_64)
743 globus_url=http://eticssoft.web.cern.ch/eticssoft/repository//vdt/globus/4.0.7-VDT-1.10.1/SUSE11_x86_64_gcc432/
744 globus_tgz=globus-4.0.7-VDT-1.10.1-1.tar.gz
745 globus_flavor=gcc64dbg
746 ;;
747 Deb5_64)
748 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.8-VDT-2.0.0/deb5_x86_64_gcc432/
749 globus_tgz=globus-4.0.8-VDT-2.0.0-2.tar.gz
750 globus_flavor=gcc64dbg
751 ;;
752 *)
753 echo "Unknown platform: \"$PLATFORM\"" >&2
754 globus_etics_platform >&2
755 myexit 1
756 ;;
757 esac
758
759 # Now download, unpack, and update the tarball
760 cd ${SOURCE}
761 mkdir -p ${globus_prefix} && \
762 eval ${wget} ${globus_url}${globus_tgz} > ${globus_tgz} && \
763 tar -C ${globus_prefix} -zxf ${globus_tgz} && \
764 cd ${globus_prefix} && \
765 find . -type f -name lib\*.la|while read file;do
766 sed s+/opt/globus+${globus_prefix}+g ${file} > ${file}.new && \
767 mv -f ${file}.new ${file}
768 done || return $RC_FAILED
769
770 # Setup globus flags for other compos
771 set_compo_flags globus prefix flavor
772
773 return $RC_SUCCESS
774 }
775
776 # globus directly from source tarball
777 globus_source() {
778 tag=${tag_globus:-4.0.8}
779 major=`echo $tag|cut -d. -f1`
780 minor=`echo $tag|cut -d. -f2`
781 # Where to get which globus toolkit tarball
782 globus_url=${globus_baseurl}gt${major}/${major}.${minor}/${tag}/installers/src/
783 globus_tbz=gt${tag}-all-source-installer.tar.bz2
784 globus_srcdir=`basename ${globus_tbz} .tar.bz2`
785
786 # Note: making globus_gridmap_callout_error globus_authz only needed for gt4
787 # interface.
788 cd ${SOURCE}
789 eval ${wget} ${globus_url}${globus_tbz} > ${globus_tbz} && \
790 tar -jxf ${globus_tbz} && \
791 cd ${globus_srcdir} && \
792 ./configure --prefix=${globus_prefix} \
793 --disable-gridftp --disable-gsiopenssh --disable-myproxy \
794 --disable-rls --disable-drs --disable-rendezvous \
795 --disable-tests --disable-prewsgram --disable-wsgram \
796 --disable-wsjava --disable-wsc --disable-wsmds --disable-wsdel \
797 --disable-wsrft --disable-wscas --disable-wstests \
798 --disable-webmds && \
799 make globus-gsi globus_gridmap_callout_error globus_authz && \
800 make install || return $RC_FAILED
801
802 # Remove .la files for at least globus
803 find ${globus_prefix}/lib -name lib\*.la -exec rm "{}" \;
804
805 # (re)evaluate globus flavour
806 globus_flavour
807
808 # Setup globus flags for other compos
809 set_compo_flags globus prefix flavor
810
811 return $RC_SUCCESS
812 }
813
814 # Set correct globus flavour
815 globus_flavour() {
816 if [ -n "$PLATFORM" ];then
817 case "$PLATFORM" in
818 RH4_32) globus_flavor=gcc32dbg ;;
819 RH5_64) globus_flavor=gcc64dbg ;;
820 SUSE11_64) globus_flavor=gcc64dbg ;;
821 Deb5_64) globus_flavor=gcc64dbg ;;
822 *) echo "Unknown platform: \"$PLATFORM\"" >&2
823 return $RC_FAILED ;;
824 esac
825 else
826 if [ -f "${globus_prefix}/etc/globus_core/flavor_gcc64dbg.gpt" ];then
827 globus_flavor=gcc64dbg
828 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc64.gpt" ];then
829 globus_flavor=gcc64
830 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc32dbg.gpt" ];then
831 globus_flavor=gcc32dbg
832 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc32.gpt" ];then
833 globus_flavor=gcc32
834 else
835 # Assume we're building a flavor-less version
836 globus_flavor=""
837 fi
838 fi
839 return $RC_SUCCESS
840 }
841
842 # wrapper function that either does a source download or etics download
843 globus() {
844 globus_prefix=${myDESTDIR}/${myglobus:-${myprefix:-$GNU_DEF_PFX}}
845 # Now unpack or build globus
846 if [ -z "$PLATFORM" ];then
847 globus_source
848 return $?
849 else
850 globus_etics
851 return $?
852 fi
853 }
854
855 # VOMS development version, directly from CNAF via git, for OpenSSL1.0
856 voms_git() {
857 compo_voms=${compo_voms:-voms}
858 # tag_voms=${tag_voms:-voms_R_2_0_0_RC2}
859 tag_voms=${tag_voms:-origin/new-voms-2-0-series}
860 gitrepo_voms=${gitroot_voms:-git://testbed002.cnaf.infn.it/opt/gits/voms.git}
861 cd ${SOURCE}
862 gitget voms && \
863 cd ${compo_voms} && \
864 ./configure --prefix=${myprefix:-$GNU_DEF_PFX} ${libdir_flag} ${sysconfdir_flag} \
865 ${includedir_flag} \
866 --disable-glite --disable-java --with-api-only && \
867 make && \
868 make ${DESTDIR_flag} install || return $RC_FAILED
869 set_def_compo_flags voms prefix includes libdir
870 make_dist || return $RC_DISTFAILED
871 return $RC_SUCCESS
872 }
873
874 # VOMS development version, directly from CNAF via SVN
875 voms_svn() {
876 compo_voms=${compo_voms:-voms}
877 cd ${SOURCE}
878 # optionally remove directory
879 [ $REMOVE -eq 1 ] && rm -rf ${compo_voms}
880 echo "t" |svn co --no-auth-cache --username anonymous --password anonymous \
881 https://svn.forge.cnaf.infn.it/svn/voms/voms/branches/voms-2-0-series ${compo_voms} && \
882 cd ${compo_voms} || return $RC_FAILED
883 # Already setup variables for other components: voms overrides libdir...
884 myvoms=${myprefix:-$GNU_DEF_PFX}
885 voms_prefix=${myDESTDIR}/${myvoms}
886 if [ -n "${mylibdir}" ];then
887 myvomslibdir=${mylibdir}
888 voms_libdir=${myDESTDIR}/${mylibdir}
889 else
890 myvomslibdir=${myvoms}/lib
891 voms_libdir=""
892 fi
893 # Fix for old style includedir
894 if grep -q '@includedir@/glite/security/voms' src/include/Makefile.am ; then
895 # Don't try to improve on includedir, use: <prefix>/include/glite/security
896 myvomsincludedir_flag=""
897 voms_includes=${voms_prefix}/include/glite/security
898 elif [ -n "${myincludedir}" ];then
899 myvomsincludedir_flag="--includedir=${myincludedir}"
900 voms_includes=${myDESTDIR}/${myincludedir}
901 else
902 myvomsincludedir_flag=""
903 voms_includes=""
904 fi
905 ./autogen.sh && \
906 ./configure --prefix=${myvoms} --libdir=${myvomslibdir} ${sysconfdir_flag} \
907 ${myvomsincludedir_flag} \
908 --disable-glite --disable-java --with-api-only && \
909 make && \
910 make ${DESTDIR_flag} libdir=${myvomslibdir} install || return $RC_FAILED
911 set_compo_flags voms prefix includes libdir
912 return $RC_SUCCESS
913 }
914
915 voms_cerncvs() {
916 compo_voms=${compo_voms:-org.glite.security.voms}
917 cvsrootweb_voms=${cvsrootweb_voms:-$webcvs}
918 cd ${SOURCE}
919 get voms && \
920 cd ${compo_voms} || return $RC_FAILED
921 # Already setup variables for other components: voms overrides libdir...
922 myvoms=${myprefix:-$GNU_DEF_PFX}
923 voms_prefix=${myDESTDIR}/${myvoms}
924 if [ -n "${mylibdir}" ];then
925 myvomslibdir=${mylibdir}
926 voms_libdir=${myDESTDIR}/${mylibdir}
927 else
928 myvomslibdir=${myvoms}/lib
929 voms_libdir=""
930 fi
931 # Fix for old style includedir
932 if grep -q '@includedir@/glite/security/voms' src/include/Makefile.am ; then
933 # Don't try to improve on includedir, use: <prefix>/include/glite/security
934 myvomsincludedir_flag=""
935 voms_includes=${voms_prefix}/include/glite/security
936 elif [ -n "${myincludedir}" ];then
937 myvomsincludedir_flag="--includedir=${myincludedir}"
938 voms_includes=${myDESTDIR}/${myincludedir}
939 else
940 myvomsincludedir_flag=""
941 voms_includes=""
942 fi
943 ./autogen.sh && \
944 ./configure --prefix=${myvoms} --libdir=${myvomslibdir} ${sysconfdir_flag} \
945 ${myvomsincludedir_flag} \
946 ${globus_prefix_flag} \
947 --disable-glite --disable-java --with-api-only && \
948 make && \
949 make ${DESTDIR_flag} libdir=${myvomslibdir} install || return $RC_FAILED
950 set_compo_flags voms prefix includes libdir
951 return $RC_SUCCESS
952 }
953
954 # VOMS: (C & C++ API only)
955 voms() {
956 case "$tag_voms" in
957 glite-security-voms_*)
958 voms_cerncvs
959 return $?
960 ;;
961 svn*)
962 voms_svn
963 return $?
964 ;;
965 *)
966 voms_git
967 return $?
968 ;;
969 esac
970 }
971
972 # LCMAPS: Note we can always use the un-threaded flavor for both
973 lcmaps() {
974 compo_lcmaps=${compo_lcmaps:-lcmaps}
975 cd ${SOURCE}
976 get lcmaps && \
977 cd ${compo_lcmaps} && \
978 ./bootstrap && \
979 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
980 ${includedir_flag} \
981 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} \
982 ${globus_prefix_flag} \
983 ${globus_flavor_flag} && \
984 make && \
985 make ${DESTDIR_flag} install || return $RC_FAILED
986 set_def_compo_flags lcmaps prefix includes libdir
987
988 # remove liblcmaps*.la files from installation. It's a hack...
989 warning "Removing liblcmaps\*.la files from $findlibdir"
990 find ${lcmaps_libdir:-${lcmaps_prefix:-${myDESTDIR}/$GNU_DEF_PFX}} \
991 -name liblcmaps\*.la -exec rm "{}" \;
992 rc_lcmaps_interface=$RC_SUCCESS
993
994 make_dist || return $RC_DISTFAILED
995 return $RC_SUCCESS
996 }
997
998 # LCMAPS-INTERFACE:
999 lcmaps_interface() {
1000 if [ "$rc_lcmaps" = "$RC_SUCCESS" -o "$rc_lcmaps" = "$RC_DISTFAILED" ];then
1001 warning "No need to build lcmaps_interface: "\
1002 "lcmaps has been build successfully."
1003 return $RC_SUCCESS
1004 fi
1005 dir=lcmaps-interface
1006 compo_lcmaps_interface=${compo_lcmaps_interface:-lcmaps}
1007 cd ${SOURCE}
1008 get lcmaps_interface $dir && \
1009 cd ${dir} && \
1010 ./bootstrap && \
1011 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1012 ${includedir_flag} \
1013 --enable-headers && \
1014 make && \
1015 make ${DESTDIR_flag} install || return $RC_FAILED
1016 set_def_compo_flags lcmaps prefix includes libdir
1017 return $RC_SUCCESS
1018 }
1019
1020 # LCAS:
1021 lcas() {
1022 compo_lcas=${compo_lcas:-lcas}
1023 cd ${SOURCE}
1024 get lcas && \
1025 cd ${compo_lcas} && \
1026 ./bootstrap && \
1027 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1028 ${includedir_flag} \
1029 ${globus_prefix_flag} ${globus_flavor_flag} && \
1030 make && \
1031 make ${DESTDIR_flag} install || return $RC_FAILED
1032 set_def_compo_flags lcas prefix includes libdir
1033 rc_lcas_interface=$RC_SUCCESS
1034 make_dist || return $RC_DISTFAILED
1035 return $RC_SUCCESS
1036 }
1037
1038 # LCAS-INTERFACE:
1039 lcas_interface() {
1040 if [ "$rc_lcas" = "$RC_SUCCESS" -o "$rc_lcas" = "$RC_DISTFAILED" ];then
1041 warning "No need to build lcas_interface: lcas has been build successfully."
1042 return $RC_SUCCESS
1043 fi
1044 dir=lcas-interface
1045 compo_lcas_interface=${compo_lcas_interface:-lcas}
1046 cd ${SOURCE}
1047 get lcas_interface $dir && \
1048 cd ${dir} && \
1049 ./bootstrap && \
1050 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1051 ${includedir_flag} \
1052 --enable-headers && \
1053 make ${DESTDIR_flag} install || return $RC_FAILED
1054 set_def_compo_flags lcas prefix includes libdir
1055 return $RC_SUCCESS
1056 }
1057
1058 # glexec >=0.8
1059 glexec() {
1060 compo_glexec=${compo_glexec:-glexec}
1061 cd ${SOURCE}
1062 get glexec && \
1063 cd ${compo_glexec} && \
1064 ./bootstrap && \
1065 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1066 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1067 make && \
1068 make ${DESTDIR_flag} install || return $RC_FAILED
1069 make_dist || return $RC_DISTFAILED
1070 return $RC_SUCCESS
1071 }
1072
1073 # LCMAPS PLUGINS BASIC:
1074 lcmaps_plugins_basic() {
1075 compo_lcmaps_plugins_basic=${compo_lcmaps_plugins_basic:-lcmaps-plugins-basic}
1076 cd ${SOURCE}
1077 get lcmaps_plugins_basic && \
1078 cd ${compo_lcmaps_plugins_basic} && \
1079 ./bootstrap && \
1080 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1081 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1082 make && \
1083 make ${DESTDIR_flag} install || return $RC_FAILED
1084 make_dist || return $RC_DISTFAILED
1085 return $RC_SUCCESS
1086 }
1087
1088 # LCMAPS PLUGINS VERIFY-PROXY:
1089 lcmaps_plugins_verify_proxy() {
1090 compo_lcmaps_plugins_verify_proxy=${compo_lcmaps_plugins_verify_proxy:-lcmaps-plugins-verify-proxy}
1091 cd ${SOURCE}
1092 get lcmaps_plugins_verify_proxy && \
1093 cd ${compo_lcmaps_plugins_verify_proxy} && \
1094 ./bootstrap && \
1095 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1096 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1097 make && \
1098 make ${DESTDIR_flag} install || return $RC_FAILED
1099 make_dist || return $RC_DISTFAILED
1100 return $RC_SUCCESS
1101 }
1102
1103 # LCMAPS PLUGINS VOMS:
1104 lcmaps_plugins_voms() {
1105 compo_lcmaps_plugins_voms=${compo_lcmaps_plugins_voms:-lcmaps-plugins-voms}
1106 cd ${SOURCE}
1107 get lcmaps_plugins_voms && \
1108 cd ${compo_lcmaps_plugins_voms} && \
1109 ./bootstrap && \
1110 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1111 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1112 ${globus_prefix_flag} ${globus_flavor_flag} \
1113 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} && \
1114 make && \
1115 make ${DESTDIR_flag} install || return $RC_FAILED
1116 make_dist || return $RC_DISTFAILED
1117 return $RC_SUCCESS
1118 }
1119
1120 # LCMAPS PLUGINS AFS:
1121 lcmaps_plugins_afs() {
1122 compo_lcmaps_plugins_afs=${compo_lcmaps_plugins_afs:-lcmaps-plugins-afs}
1123 cd ${SOURCE}
1124 get lcmaps_plugins_afs && \
1125 cd ${compo_lcmaps_plugins_afs} && \
1126 ./bootstrap && \
1127 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1128 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1129 ${globus_prefix_flag} ${globus_flavor_flag} && \
1130 make && \
1131 make ${DESTDIR_flag} install || return $RC_FAILED
1132 make_dist || return $RC_DISTFAILED
1133 return $RC_SUCCESS
1134 }
1135
1136 # LCMAPS PLUGINS GUMS:
1137 lcmaps_plugins_gums() {
1138 compo_lcmaps_plugins_gums=${compo_lcmaps_plugins_gums:-lcmaps-plugins-gums}
1139 cd ${SOURCE}
1140 get lcmaps_plugins_gums && \
1141 cd ${compo_lcmaps_plugins_gums} && \
1142 ./bootstrap && \
1143 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1144 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1145 make && \
1146 make ${DESTDIR_flag} install || return $RC_FAILED
1147 make_dist || return $RC_DISTFAILED
1148 return $RC_SUCCESS
1149 }
1150
1151 # LCMAPS PLUGINS TRACKING GROUPID:
1152 lcmaps_plugins_tracking_groupid() {
1153 compo_lcmaps_plugins_tracking_groupid=${compo_lcmaps_plugins_tracking_groupid:-lcmaps-plugins-tracking-groupid}
1154 cd ${SOURCE}
1155 get lcmaps_plugins_tracking_groupid && \
1156 cd ${compo_lcmaps_plugins_tracking_groupid} && \
1157 ./bootstrap && \
1158 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1159 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1160 make && \
1161 make ${DESTDIR_flag} install || return $RC_FAILED
1162 make_dist || return $RC_DISTFAILED
1163 return $RC_SUCCESS
1164 }
1165
1166 # PEP-C LIB: Will install in same libdir as LCMAPS
1167 pep_api() {
1168 compo_pep_api=${compo_pep_api:-pep-api}
1169 svnroot_pep_api=${svnroot_pep_api_c:-http://svnweb.cern.ch/guest/glxa/pep-c-lib/}
1170 # tag_pep_api=${tag_pep_api:-branches/1_3}
1171 tag_pep_api=${tag_pep_api:-branches/2_0}
1172 # Need fix for 1_3 series, which does not properly treat the datadir.
1173 case "$tag_pep_api" in
1174 branches/1_*)
1175 mypep_api=${myprefix:-$GNU_DEF_PFX}
1176 mypepprefix_flag="--prefix=${mypep_api}"
1177 mypepdatadir_flag="--datadir=${myDESTDIR}/${mypep_api}/share"
1178 ;;
1179 *)
1180 mypep_api=""
1181 mypepprefix_flag=${prefix_flag}
1182 mypepdatadir_flag=""
1183 ;;
1184 esac
1185 cd ${SOURCE}
1186 get pep_api && \
1187 cd ${compo_pep_api} && \
1188 ./autotools.sh && \
1189 ./configure ${mypepprefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1190 ${mypepdatadir_flag} && \
1191 make && \
1192 make ${DESTDIR_flag} install || return $RC_FAILED
1193 set_def_compo_flags pep_api prefix
1194 make doxygen && make_dist || return $RC_DISTFAILED
1195 return $RC_SUCCESS
1196 }
1197
1198 # LCMAPS PLUGINS C-PEP
1199 lcmaps_plugins_c_pep() {
1200 compo_lcmaps_plugins_c_pep=${compo_lcmaps_plugins_c_pep:-lcmaps-plugins-c-pep}
1201 cd ${SOURCE}
1202 get lcmaps_plugins_c_pep && \
1203 cd ${compo_lcmaps_plugins_c_pep} && \
1204 ./bootstrap && \
1205 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1206 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1207 ${pep_api_prefix_flag} ${pep_api_libdir_flag} && \
1208 make && \
1209 make ${DESTDIR_flag} install || return $RC_FAILED
1210 make_dist || return $RC_DISTFAILED
1211 return $RC_SUCCESS
1212 }
1213
1214 # Jobrepository:
1215 jobrep_api() {
1216 compo_jobrep_api=${compo_jobrep_api:-jobrepository}
1217 cd ${SOURCE}
1218 get jobrep_api && \
1219 cd ${compo_jobrep_api} && \
1220 ./bootstrap && \
1221 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1222 ${includedir_flag} && \
1223 make && \
1224 make ${DESTDIR_flag} install || return $RC_FAILED
1225 set_def_compo_flags jobrep_api prefix includes libdir
1226 make_dist || return $RC_DISTFAILED
1227 return $RC_SUCCESS
1228 }
1229
1230 # LCMAPS PLUGINS JOBREP
1231 lcmaps_plugins_jobrep() {
1232 compo_lcmaps_plugins_jobrep=${compo_lcmaps_plugins_jobrep:-lcmaps-plugins-jobrep}
1233 cd ${SOURCE}
1234 get lcmaps_plugins_jobrep && \
1235 cd ${compo_lcmaps_plugins_jobrep} && \
1236 ./bootstrap && \
1237 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1238 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1239 ${jobrep_api_prefix_flag} ${jobrep_api_includes_flag} \
1240 ${jobrep_api_libdir_flag} \
1241 ${globus_prefix_flag} ${globus_flavor_flag} && \
1242 make && \
1243 make ${DESTDIR_flag} install || return $RC_FAILED
1244 make_dist || return $RC_DISTFAILED
1245 return $RC_SUCCESS
1246 }
1247
1248 # SAML2XACML2 LIB:
1249 saml2_xacml2_c_lib() {
1250 compo_saml2_xacml2_c_lib=${compo_saml2_xacml2_c_lib:-saml2-xacml2-c-lib}
1251 gsoap_prefix=${SOURCE}/${compo_saml2_xacml2_c_lib}/gsoap-build
1252 cd ${SOURCE}
1253 export CXXFLAGS="-fPIC ${CXXFLAGS}"
1254 get saml2_xacml2_c_lib && \
1255 cd ${compo_saml2_xacml2_c_lib} && \
1256 # Only for new style SAML2-XACML2-C-lib do we have gsoap as tarball
1257 gsoap_tarball="`ls gsoap-2.7*.tar.gz 2>/dev/null`"
1258 if [ -n "$gsoap_tarball" ];then
1259 tar -zxf ${gsoap_tarball} || echo $RC_FAILED
1260 fi
1261 cd gsoap-2.7 && \
1262 ./configure --prefix=${gsoap_prefix} && \
1263 make && \
1264 make install && \
1265 cd ../xacml-1.0 && \
1266 ./bootstrap && \
1267 ./configure ${prefix_flag} ${libdir_flag} \
1268 --with-gsoap=${gsoap_prefix} && \
1269 make && \
1270 make ${DESTDIR_flag} install || return $RC_FAILED
1271 set_def_compo_flags xacml prefix
1272 make_dist || return $RC_DISTFAILED
1273 return $RC_SUCCESS
1274 }
1275
1276 # LCMAPS PLUGINS SCAS CLIENT:
1277 lcmaps_plugins_scas_client() {
1278 compo_lcmaps_plugins_scas_client=${compo_lcmaps_plugins_scas_client:-lcmaps-plugins-scas-client}
1279 cd ${SOURCE}
1280 get lcmaps_plugins_scas_client && \
1281 cd ${compo_lcmaps_plugins_scas_client} && \
1282 ./bootstrap && \
1283 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1284 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1285 ${xacml_prefix_flag} ${xacml_libdir_flag} && \
1286 make && \
1287 make ${DESTDIR_flag} install || return $RC_FAILED
1288 make_dist || return $RC_DISTFAILED
1289 return $RC_SUCCESS
1290 }
1291
1292 # SCAS
1293 scas() {
1294 compo_scas=${compo_scas:-scas}
1295 # fix for otherwise unlocatable seconday globus deps
1296 if [ -n "$globus_prefix" ];then
1297 ld_library_path_flag="LD_LIBRARY_PATH=${globus_prefix}/lib"
1298 else
1299 ld_library_path_flag=""
1300 fi
1301 cd ${SOURCE}
1302 get scas && \
1303 cd ${compo_scas} && \
1304 ./bootstrap && \
1305 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1306 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1307 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1308 ${xacml_prefix_flag} ${xacml_libdir_flag} \
1309 ${globus_prefix_flag} ${globus_flavor_flag} && \
1310 eval $ld_library_path_flag make && \
1311 make ${DESTDIR_flag} install || return $RC_FAILED
1312 make_dist || return $RC_DISTFAILED
1313 return $RC_SUCCESS
1314 }
1315
1316 # EES
1317 ees() {
1318 compo_ees=${compo_ees:-ees}
1319 cd ${SOURCE}
1320 get ees && \
1321 cd ${compo_ees} && \
1322 ./bootstrap && \
1323 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1324 ${xacml_prefix_flag} ${xacml_libdir_flag} && \
1325 make && \
1326 make ${DESTDIR_flag} install || return $RC_FAILED
1327 make_dist || return $RC_DISTFAILED
1328 return $RC_SUCCESS
1329 }
1330
1331 # LCAS PLUGINS BASIC:
1332 lcas_plugins_basic() {
1333 compo_lcas_plugins_basic=${compo_lcas_plugins_basic:-lcas-plugins-basic}
1334 cd ${SOURCE}
1335 get lcas_plugins_basic && \
1336 cd ${compo_lcas_plugins_basic} && \
1337 ./bootstrap && \
1338 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1339 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1340 ${globus_prefix_flag} ${globus_flavor_flag} && \
1341 make && \
1342 make ${DESTDIR_flag} install || return $RC_FAILED
1343 make_dist || return $RC_DISTFAILED
1344 return $RC_SUCCESS
1345 }
1346
1347 # LCAS PLUGINS CHECK-EXECUTABLE:
1348 lcas_plugins_check_executable() {
1349 compo_lcas_plugins_check_executable=${compo_lcas_plugins_check_executable:-lcas-plugins-check-executable}
1350 cd ${SOURCE}
1351 get lcas_plugins_check_executable && \
1352 cd ${compo_lcas_plugins_check_executable} && \
1353 ./bootstrap && \
1354 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1355 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1356 ${globus_prefix_flag} ${globus_flavor_flag} && \
1357 make && \
1358 make ${DESTDIR_flag} install || return $RC_FAILED
1359 make_dist || return $RC_DISTFAILED
1360 return $RC_SUCCESS
1361 }
1362
1363 # GRIDSITE CORE:
1364 gridsite() {
1365 compo_gridsite=${compo_gridsite:-org.gridsite.core}
1366 cvsrootweb_gridsite=${cvsrootweb_gridsite:-$webcvs}
1367 mygridsite=${mygridsite:-${myprefix:-$GNU_DEF_PFX}}
1368 # Already setup variables for other components
1369 gridsite_prefix=${myDESTDIR}/${mygridsite}
1370 if [ -n "${mylibdir}" ];then
1371 gridsitelibdir=`basename ${mylibdir}`
1372 gridsite_libdir=${gridsite_prefix}/${gridsitelibdir}
1373 else
1374 gridsitelibdir=lib
1375 gridsite_libdir=""
1376 fi
1377 cd ${SOURCE}
1378 get gridsite && \
1379 cd ${compo_gridsite}/src && \
1380 make prefix=${mygridsite} libdir=${gridsitelibdir} && \
1381 make prefix=${myDESTDIR}/${mygridsite} libdir=${gridsitelibdir} install || \
1382 return $RC_FAILED
1383
1384 VERSION=`grep "^PATCH_VERSION" ../VERSION|cut -d= -f2`
1385
1386 # Setup gridsite flag for other compos
1387 set_compo_flags gridsite prefix libdir
1388
1389 make_dist ../gridsite-${VERSION}.src.tar.gz || return $RC_DISTFAILED
1390 return $RC_SUCCESS
1391 }
1392
1393 # LCAS PLUGINS VOMS:
1394 lcas_plugins_voms() {
1395 compo_lcas_plugins_voms=${compo_lcas_plugins_voms:-lcas-plugins-voms}
1396 cd ${SOURCE}
1397 get lcas_plugins_voms && \
1398 cd ${compo_lcas_plugins_voms} && \
1399 ./bootstrap && \
1400 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1401 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1402 ${globus_prefix_flag} ${globus_flavor_flag} \
1403 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} \
1404 ${gridsite_prefix_flag} &&
1405 make && \
1406 make ${DESTDIR_flag} install || return $RC_FAILED
1407 make_dist || return $RC_DISTFAILED
1408 return $RC_SUCCESS
1409 }
1410
1411 # LCAS-LCMAPS GT4 interface:
1412 # Note: only reason for building two extra globus targets
1413 # globus_gridmap_callout_error globus_authz
1414 lcas_lcmaps_gt4_interface() {
1415 compo_lcas_lcmaps_gt4_interface=${compo_lcas_lcmaps_gt4_interface:-lcas-lcmaps-gt4-interface}
1416 cd ${SOURCE}
1417 get lcas_lcmaps_gt4_interface && \
1418 cd ${compo_lcas_lcmaps_gt4_interface} && \
1419 ./bootstrap && \
1420 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1421 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1422 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1423 ${globus_prefix_flag} ${globus_flavor_flag} && \
1424 make && \
1425 make ${DESTDIR_flag} install || return $RC_FAILED
1426 make_dist || return $RC_DISTFAILED
1427 return $RC_SUCCESS
1428 }
1429
1430 ##############################################################################
1431 #
1432 # Define all dependency functions, NOTE: the order of the setdeps statements is
1433 # important!
1434 #
1435 ##############################################################################
1436
1437 # GLOBUS: no dependencies
1438 setdeps globus
1439
1440 # VOMS: no longer depends on globus
1441 setdeps voms
1442
1443 # LCMAPS: depends globus, voms
1444 setdeps lcmaps globus voms
1445
1446 # LCMAPS-INTERFACE: no dependencies
1447 setdeps lcmaps_interface
1448
1449 # LCAS: depends globus
1450 setdeps lcas globus
1451
1452 # LCAS-INTERFACE: no dependencies
1453 setdeps lcas_interface
1454
1455 # GLEXEC: depends lcmaps_interface
1456 setdeps glexec lcmaps_interface
1457
1458 # LCMAPS PLUGINS BASIC: depends lcmaps-interface
1459 setdeps lcmaps_plugins_basic lcmaps_interface
1460
1461 # LCMAPS PLUGINS VERIFY-PROXY: depends lcmaps-interface
1462 setdeps lcmaps_plugins_verify_proxy lcmaps_interface
1463
1464 # LCMAPS PLUGINS VOMS: depends globus, voms, lcmaps-interface
1465 setdeps lcmaps_plugins_voms globus voms lcmaps_interface
1466
1467 # LCMAPS PLUGINS AFS: depends lcmaps-interface
1468 setdeps lcmaps_plugins_afs globus lcmaps_interface
1469
1470 # LCMAPS PLUGINS GUMS: depends lcmaps-interface
1471 setdeps lcmaps_plugins_gums lcmaps_interface
1472
1473 # LCMAPS PLUGINS TRACKING GID: depends lcmaps-interface
1474 setdeps lcmaps_plugins_tracking_groupid lcmaps_interface
1475
1476 # PEP-C LIB: no dependencies
1477 setdeps pep_api
1478
1479 # LCMAPS PLUGINS C-PEP: depends pep-c lib, lcmaps-interface
1480 setdeps lcmaps_plugins_c_pep pep_api lcmaps_interface
1481
1482 # Jobrepository: no dependencies
1483 setdeps jobrep_api
1484
1485 # LCMAPS PLUGINS JOBREP: depends jobrepository lib, lcmaps-interface
1486 setdeps lcmaps_plugins_jobrep jobrep_api globus lcmaps_interface
1487
1488 # SAML2XACML2 LIB: no dependencies
1489 setdeps saml2_xacml2_c_lib
1490
1491 # LCMAPS PLUGINS SCAS CLIENT: depends saml2-xacml2-c-lib, lcmaps-interface
1492 setdeps lcmaps_plugins_scas_client saml2_xacml2_c_lib lcmaps_interface
1493
1494 # SCAS: depends saml2-xacml2-c-lib, lcmaps, lcas
1495 setdeps scas saml2_xacml2_c_lib lcmaps lcas
1496
1497 # EES: depends saml2-xacml2-c-lib
1498 setdeps ees saml2_xacml2_c_lib
1499
1500 # LCAS PLUGINS BASIC: depends globus, lcas-interface
1501 setdeps lcas_plugins_basic globus lcas_interface
1502
1503 # LCAS PLUGINS CHECK-EXECUTABLE: depends globus, lcas-interface
1504 setdeps lcas_plugins_check_executable globus lcas_interface
1505
1506 # GRIDSITE Core:
1507 setdeps gridsite
1508
1509 # LCAS PLUGINS VOMS: depends globus, voms, gridsite-core, lcas-interface
1510 setdeps lcas_plugins_voms globus voms gridsite lcas_interface
1511
1512 # LCAS-LCMAPS GT4 interface: depends globus, lcmaps, common-cpp, lcas, lcas-interface
1513 setdeps lcas_lcmaps_gt4_interface globus lcmaps lcas
1514
1515 ##############################################################################
1516 #
1517 # Build all tools, taking care of dependencies
1518 #
1519 ##############################################################################
1520
1521 # Now that we know all the targets, we can print usage if requested
1522 if [ "$USAGE" -eq 1 ];then
1523 usage
1524 myexit 0
1525 fi
1526
1527 # If we just wanted platform help, print it now
1528 if [ "$PLATFORM" = "help" ];then
1529 globus_etics_platform
1530 myexit 0
1531 fi
1532
1533 # Check source directory...
1534 if [ "`echo $SOURCE|cut -c1`" != "/" ];then
1535 SOURCE="`pwd`/$SOURCE"
1536 warning "Making source directory absolute: $SOURCE"
1537 fi
1538
1539 # When using a file: get targets also from there (instead of only using $*)
1540 TARGETS=""
1541 if [ -n "$TARGETFILE" ];then
1542 # remove everything starting with # (better not # in names...)
1543 TARGETS="`sed 's/#.*$//' $TARGETFILE`"
1544 fi
1545 # If we put something in it:
1546 if [ -n "$TARGETS" ];then
1547 TARGETS="$TARGETS $*"
1548 else
1549 TARGETS="$*"
1550 fi
1551
1552 # Check if anything needs doing...
1553 if [ -z "$TARGETS" ];then
1554 echo "No targets specified, nothing to be done."
1555 myexit 0
1556 fi
1557
1558 # Setup file to save the failed targets into.
1559 if [ -z "$NEWTARGETFILE" ];then
1560 NEWTARGETFILE=$SOURCE/$NEWTARGETFILE_DEFAULT
1561 fi
1562
1563 # Setup myDISTDIR
1564 if [ -z "$myDISTDIR" ];then
1565 myDISTDIR=$SOURCE
1566 fi
1567
1568 # Make sure we have an (empty) temp file
1569 touch $NEWFLAGFILE_TMP
1570 # Setup configure flags specified in file
1571 if [ -n "$FLAGFILE" ];then
1572 lines=`cat $FLAGFILE|wc -l`
1573 lineno=0
1574 while [ $lineno -lt $lines ];do
1575 lineno=`expr $lineno + 1`
1576 line=`sed -n ${lineno}p $FLAGFILE|sed 's/#.*$//'`
1577 if [ -n "$line" ];then
1578 parse_flag "$line"
1579 fi
1580 done
1581 fi
1582
1583 # Setup configure flags specified on cmdline
1584 if [ -n "$FLAGS" ];then
1585 for i in `echo "$FLAGS"`;do
1586 parse_flag $i
1587 done
1588 fi
1589
1590 # Setup file to save the failed targets into.
1591 if [ -z "$NEWFLAGFILE" ];then
1592 NEWFLAGFILE=$SOURCE/$NEWFLAGFILE_DEFAULT
1593 fi
1594
1595 # Find suitable download command
1596 get_download_cmd
1597
1598 # Parse the config options
1599 parse_config
1600
1601 # Figure out the build targets
1602 # Check for special build all target and make all unique
1603 # - substitute 'all' -> $known_targets
1604 # - re-uniquefy
1605 # - remove empty lines
1606 reqs=`echo "$TARGETS"|tr ' ' '\n'|sed "s/^all$/$known_targets/"|tr ' ' '\n'|sort -u|grep -v '^$'`
1607
1608 # loop over all known targets and pick out the requested ones
1609 build_targets=""
1610 for known in `echo $known_targets|tr ' ' '\n'`;do
1611 reqs_new=`echo $reqs|tr ' ' '\n'|grep -v "^$known$"`
1612 # if different, we have a match
1613 if [ "$reqs_new" != "$reqs" ];then
1614 reqs=$reqs_new
1615 build_targets=`echo $build_targets $known`
1616 fi
1617 done
1618 # Anything left is unknown target...
1619 if [ -n "$reqs" ];then
1620 error "Unknown target(s): $reqs"
1621 fi
1622
1623 DISTFAILED=0
1624 MISSING=0
1625 FAILED=0
1626 # Anything to be done?
1627 if [ -n "$build_targets" ];then
1628 # create the source dir
1629 mkdir -p ${SOURCE} || error "Creating of ${SOURCE} FAILED"
1630
1631 # Get globus_flavour just in case we won't build. If it will be build, it
1632 # will be reset afterwards.
1633 globus_flavour
1634
1635 # Do the builds and print results
1636 if [ -z "$STDOUT" ];then
1637 if [ -z "$STDERR" ];then
1638 build
1639 else
1640 build 2> $STDERR
1641 fi
1642 else
1643 if [ -z "$STDERR" ];then
1644 build > $STDOUT
1645 else
1646 build > $STDOUT 2> $STDERR
1647 fi
1648 fi
1649 fi
1650
1651 myexit `expr $DISTFAILED + $MISSING + $FAILED`

Properties

Name Value
svn:executable *

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28