/[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 2419 - (show annotations) (download) (as text)
Tue Sep 6 10:29:46 2011 UTC (10 years, 11 months ago) by msalle
File MIME type: application/x-shellscript
File size: 52192 byte(s)
Use latest stable GT5 by default.

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 tag=${tag_globus:-5.0.4}
780 major=`echo $tag|cut -d. -f1`
781 minor=`echo $tag|cut -d. -f2`
782 # Where to get which globus toolkit tarball
783 globus_url=${globus_baseurl}gt${major}/${major}.${minor}/${tag}/installers/src/
784 globus_tbz=gt${tag}-all-source-installer.tar.bz2
785 globus_srcdir=`basename ${globus_tbz} .tar.bz2`
786
787 # Note: making globus_gridmap_callout_error globus_authz only needed for gt4
788 # interface.
789 cd ${SOURCE}
790 eval ${wget} ${globus_url}${globus_tbz} > ${globus_tbz} && \
791 tar -jxf ${globus_tbz} && \
792 cd ${globus_srcdir} && \
793 ./configure --prefix=${globus_prefix} \
794 --disable-gridftp --disable-gsiopenssh --disable-myproxy \
795 --disable-rls --disable-drs --disable-rendezvous \
796 --disable-tests --disable-prewsgram --disable-wsgram \
797 --disable-wsjava --disable-wsc --disable-wsmds --disable-wsdel \
798 --disable-wsrft --disable-wscas --disable-wstests \
799 --disable-webmds && \
800 make globus-gsi globus_gridmap_callout_error globus_authz && \
801 make install || return $RC_FAILED
802
803 # Remove .la files for at least globus
804 find ${globus_prefix}/lib -name lib\*.la -exec rm "{}" \;
805
806 # (re)evaluate globus flavour
807 globus_flavour
808
809 # Setup globus flags for other compos
810 set_compo_flags globus prefix flavor
811
812 return $RC_SUCCESS
813 }
814
815 # Set correct globus flavour
816 globus_flavour() {
817 if [ -n "$PLATFORM" ];then
818 case "$PLATFORM" in
819 RH4_32) globus_flavor=gcc32dbg ;;
820 RH5_64) globus_flavor=gcc64dbg ;;
821 SUSE11_64) globus_flavor=gcc64dbg ;;
822 Deb5_64) globus_flavor=gcc64dbg ;;
823 *) echo "Unknown platform: \"$PLATFORM\"" >&2
824 return $RC_FAILED ;;
825 esac
826 else
827 if [ -f "${globus_prefix}/etc/globus_core/flavor_gcc64dbg.gpt" ];then
828 globus_flavor=gcc64dbg
829 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc64.gpt" ];then
830 globus_flavor=gcc64
831 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc32dbg.gpt" ];then
832 globus_flavor=gcc32dbg
833 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc32.gpt" ];then
834 globus_flavor=gcc32
835 else
836 # Assume we're building a flavor-less version
837 globus_flavor=""
838 fi
839 fi
840 return $RC_SUCCESS
841 }
842
843 # wrapper function that either does a source download or etics download
844 globus() {
845 globus_prefix=${myDESTDIR}/${myglobus:-${myprefix:-$GNU_DEF_PFX}}
846 # Now unpack or build globus
847 if [ -z "$PLATFORM" ];then
848 globus_source
849 return $?
850 else
851 globus_etics
852 return $?
853 fi
854 }
855
856 # VOMS development version, directly from CNAF via git, for OpenSSL1.0
857 voms_git() {
858 compo_voms=${compo_voms:-voms}
859 # tag_voms=${tag_voms:-voms_R_2_0_0_RC2}
860 tag_voms=${tag_voms:-origin/new-voms-2-0-series}
861 # tag_voms=${tag_voms:-voms_R_2_0_0}
862 gitrepo_voms=${gitroot_voms:-git://testbed002.cnaf.infn.it/opt/gits/voms.git}
863 cd ${SOURCE}
864 gitget voms && \
865 cd ${compo_voms} && \
866 ./configure --prefix=${myprefix:-$GNU_DEF_PFX} ${libdir_flag} ${sysconfdir_flag} \
867 ${includedir_flag} \
868 --disable-glite --disable-java --with-api-only && \
869 make && \
870 make ${DESTDIR_flag} install || return $RC_FAILED
871 set_def_compo_flags voms prefix includes libdir
872 make_dist || return $RC_DISTFAILED
873 return $RC_SUCCESS
874 }
875
876 # VOMS development version, directly from CNAF via SVN
877 voms_svn() {
878 compo_voms=${compo_voms:-voms}
879 cd ${SOURCE}
880 # optionally remove directory
881 [ $REMOVE -eq 1 ] && rm -rf ${compo_voms}
882 echo "t" |svn co --no-auth-cache --username anonymous --password anonymous \
883 https://svn.forge.cnaf.infn.it/svn/voms/voms/branches/voms-2-0-series ${compo_voms} && \
884 cd ${compo_voms} || return $RC_FAILED
885 # Already setup variables for other components: voms overrides libdir...
886 myvoms=${myprefix:-$GNU_DEF_PFX}
887 voms_prefix=${myDESTDIR}/${myvoms}
888 if [ -n "${mylibdir}" ];then
889 myvomslibdir=${mylibdir}
890 voms_libdir=${myDESTDIR}/${mylibdir}
891 else
892 myvomslibdir=${myvoms}/lib
893 voms_libdir=""
894 fi
895 # Fix for old style includedir
896 if grep -q '@includedir@/glite/security/voms' src/include/Makefile.am ; then
897 # Don't try to improve on includedir, use: <prefix>/include/glite/security
898 myvomsincludedir_flag=""
899 voms_includes=${voms_prefix}/include/glite/security
900 elif [ -n "${myincludedir}" ];then
901 myvomsincludedir_flag="--includedir=${myincludedir}"
902 voms_includes=${myDESTDIR}/${myincludedir}
903 else
904 myvomsincludedir_flag=""
905 voms_includes=""
906 fi
907 ./autogen.sh && \
908 ./configure --prefix=${myvoms} --libdir=${myvomslibdir} ${sysconfdir_flag} \
909 ${myvomsincludedir_flag} \
910 --disable-glite --disable-java --with-api-only && \
911 make && \
912 make ${DESTDIR_flag} libdir=${myvomslibdir} install || return $RC_FAILED
913 set_compo_flags voms prefix includes libdir
914 return $RC_SUCCESS
915 }
916
917 voms_cerncvs() {
918 compo_voms=${compo_voms:-org.glite.security.voms}
919 cvsrootweb_voms=${cvsrootweb_voms:-$webcvs}
920 cd ${SOURCE}
921 get voms && \
922 cd ${compo_voms} || return $RC_FAILED
923 # Already setup variables for other components: voms overrides libdir...
924 myvoms=${myprefix:-$GNU_DEF_PFX}
925 voms_prefix=${myDESTDIR}/${myvoms}
926 if [ -n "${mylibdir}" ];then
927 myvomslibdir=${mylibdir}
928 voms_libdir=${myDESTDIR}/${mylibdir}
929 else
930 myvomslibdir=${myvoms}/lib
931 voms_libdir=""
932 fi
933 # Fix for old style includedir
934 if grep -q '@includedir@/glite/security/voms' src/include/Makefile.am ; then
935 # Don't try to improve on includedir, use: <prefix>/include/glite/security
936 myvomsincludedir_flag=""
937 voms_includes=${voms_prefix}/include/glite/security
938 elif [ -n "${myincludedir}" ];then
939 myvomsincludedir_flag="--includedir=${myincludedir}"
940 voms_includes=${myDESTDIR}/${myincludedir}
941 else
942 myvomsincludedir_flag=""
943 voms_includes=""
944 fi
945 ./autogen.sh && \
946 ./configure --prefix=${myvoms} --libdir=${myvomslibdir} ${sysconfdir_flag} \
947 ${myvomsincludedir_flag} \
948 ${globus_prefix_flag} \
949 --disable-glite --disable-java --with-api-only && \
950 make && \
951 make ${DESTDIR_flag} libdir=${myvomslibdir} install || return $RC_FAILED
952 set_compo_flags voms prefix includes libdir
953 return $RC_SUCCESS
954 }
955
956 # VOMS: (C & C++ API only)
957 voms() {
958 case "$tag_voms" in
959 glite-security-voms_*)
960 voms_cerncvs
961 return $?
962 ;;
963 svn*)
964 voms_svn
965 return $?
966 ;;
967 *)
968 voms_git
969 return $?
970 ;;
971 esac
972 }
973
974 # LCMAPS: Note we can always use the un-threaded flavor for both
975 lcmaps() {
976 compo_lcmaps=${compo_lcmaps:-lcmaps}
977 cd ${SOURCE}
978 get lcmaps && \
979 cd ${compo_lcmaps} && \
980 ./bootstrap && \
981 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
982 ${includedir_flag} \
983 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} \
984 ${globus_prefix_flag} \
985 ${globus_flavor_flag} && \
986 make && \
987 make ${DESTDIR_flag} install || return $RC_FAILED
988 set_def_compo_flags lcmaps prefix includes libdir
989
990 # remove liblcmaps*.la files from installation. It's a hack...
991 warning "Removing liblcmaps\*.la files from $findlibdir"
992 find ${lcmaps_libdir:-${lcmaps_prefix:-${myDESTDIR}/$GNU_DEF_PFX}} \
993 -name liblcmaps\*.la -exec rm "{}" \;
994 rc_lcmaps_interface=$RC_SUCCESS
995
996 make_dist || return $RC_DISTFAILED
997 return $RC_SUCCESS
998 }
999
1000 # LCMAPS-INTERFACE:
1001 lcmaps_interface() {
1002 if [ "$rc_lcmaps" = "$RC_SUCCESS" -o "$rc_lcmaps" = "$RC_DISTFAILED" ];then
1003 warning "No need to build lcmaps_interface: "\
1004 "lcmaps has been build successfully."
1005 return $RC_SUCCESS
1006 fi
1007 dir=lcmaps-interface
1008 compo_lcmaps_interface=${compo_lcmaps_interface:-lcmaps}
1009 cd ${SOURCE}
1010 get lcmaps_interface $dir && \
1011 cd ${dir} && \
1012 ./bootstrap && \
1013 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1014 ${includedir_flag} \
1015 --enable-headers && \
1016 make && \
1017 make ${DESTDIR_flag} install || return $RC_FAILED
1018 set_def_compo_flags lcmaps prefix includes libdir
1019 return $RC_SUCCESS
1020 }
1021
1022 # LCAS:
1023 lcas() {
1024 compo_lcas=${compo_lcas:-lcas}
1025 cd ${SOURCE}
1026 get lcas && \
1027 cd ${compo_lcas} && \
1028 ./bootstrap && \
1029 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1030 ${includedir_flag} \
1031 ${globus_prefix_flag} ${globus_flavor_flag} && \
1032 make && \
1033 make ${DESTDIR_flag} install || return $RC_FAILED
1034 set_def_compo_flags lcas prefix includes libdir
1035 rc_lcas_interface=$RC_SUCCESS
1036 make_dist || return $RC_DISTFAILED
1037 return $RC_SUCCESS
1038 }
1039
1040 # LCAS-INTERFACE:
1041 lcas_interface() {
1042 if [ "$rc_lcas" = "$RC_SUCCESS" -o "$rc_lcas" = "$RC_DISTFAILED" ];then
1043 warning "No need to build lcas_interface: lcas has been build successfully."
1044 return $RC_SUCCESS
1045 fi
1046 dir=lcas-interface
1047 compo_lcas_interface=${compo_lcas_interface:-lcas}
1048 cd ${SOURCE}
1049 get lcas_interface $dir && \
1050 cd ${dir} && \
1051 ./bootstrap && \
1052 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1053 ${includedir_flag} \
1054 --enable-headers && \
1055 make ${DESTDIR_flag} install || return $RC_FAILED
1056 set_def_compo_flags lcas prefix includes libdir
1057 return $RC_SUCCESS
1058 }
1059
1060 # glexec >=0.8
1061 glexec() {
1062 compo_glexec=${compo_glexec:-glexec}
1063 cd ${SOURCE}
1064 get glexec && \
1065 cd ${compo_glexec} && \
1066 ./bootstrap && \
1067 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1068 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1069 make && \
1070 make ${DESTDIR_flag} install || return $RC_FAILED
1071 make_dist || return $RC_DISTFAILED
1072 return $RC_SUCCESS
1073 }
1074
1075 # LCMAPS PLUGINS BASIC:
1076 lcmaps_plugins_basic() {
1077 compo_lcmaps_plugins_basic=${compo_lcmaps_plugins_basic:-lcmaps-plugins-basic}
1078 cd ${SOURCE}
1079 get lcmaps_plugins_basic && \
1080 cd ${compo_lcmaps_plugins_basic} && \
1081 ./bootstrap && \
1082 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1083 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1084 make && \
1085 make ${DESTDIR_flag} install || return $RC_FAILED
1086 make_dist || return $RC_DISTFAILED
1087 return $RC_SUCCESS
1088 }
1089
1090 # LCMAPS PLUGINS VERIFY-PROXY:
1091 lcmaps_plugins_verify_proxy() {
1092 compo_lcmaps_plugins_verify_proxy=${compo_lcmaps_plugins_verify_proxy:-lcmaps-plugins-verify-proxy}
1093 cd ${SOURCE}
1094 get lcmaps_plugins_verify_proxy && \
1095 cd ${compo_lcmaps_plugins_verify_proxy} && \
1096 ./bootstrap && \
1097 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1098 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1099 make && \
1100 make ${DESTDIR_flag} install || return $RC_FAILED
1101 make_dist || return $RC_DISTFAILED
1102 return $RC_SUCCESS
1103 }
1104
1105 # LCMAPS PLUGINS VOMS:
1106 lcmaps_plugins_voms() {
1107 compo_lcmaps_plugins_voms=${compo_lcmaps_plugins_voms:-lcmaps-plugins-voms}
1108 cd ${SOURCE}
1109 get lcmaps_plugins_voms && \
1110 cd ${compo_lcmaps_plugins_voms} && \
1111 ./bootstrap && \
1112 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1113 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1114 ${globus_prefix_flag} ${globus_flavor_flag} \
1115 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} && \
1116 make && \
1117 make ${DESTDIR_flag} install || return $RC_FAILED
1118 make_dist || return $RC_DISTFAILED
1119 return $RC_SUCCESS
1120 }
1121
1122 # LCMAPS PLUGINS AFS:
1123 lcmaps_plugins_afs() {
1124 compo_lcmaps_plugins_afs=${compo_lcmaps_plugins_afs:-lcmaps-plugins-afs}
1125 cd ${SOURCE}
1126 get lcmaps_plugins_afs && \
1127 cd ${compo_lcmaps_plugins_afs} && \
1128 ./bootstrap && \
1129 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1130 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1131 ${globus_prefix_flag} ${globus_flavor_flag} && \
1132 make && \
1133 make ${DESTDIR_flag} install || return $RC_FAILED
1134 make_dist || return $RC_DISTFAILED
1135 return $RC_SUCCESS
1136 }
1137
1138 # LCMAPS PLUGINS GUMS:
1139 lcmaps_plugins_gums() {
1140 compo_lcmaps_plugins_gums=${compo_lcmaps_plugins_gums:-lcmaps-plugins-gums}
1141 cd ${SOURCE}
1142 get lcmaps_plugins_gums && \
1143 cd ${compo_lcmaps_plugins_gums} && \
1144 ./bootstrap && \
1145 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1146 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1147 make && \
1148 make ${DESTDIR_flag} install || return $RC_FAILED
1149 make_dist || return $RC_DISTFAILED
1150 return $RC_SUCCESS
1151 }
1152
1153 # LCMAPS PLUGINS TRACKING GROUPID:
1154 lcmaps_plugins_tracking_groupid() {
1155 compo_lcmaps_plugins_tracking_groupid=${compo_lcmaps_plugins_tracking_groupid:-lcmaps-plugins-tracking-groupid}
1156 cd ${SOURCE}
1157 get lcmaps_plugins_tracking_groupid && \
1158 cd ${compo_lcmaps_plugins_tracking_groupid} && \
1159 ./bootstrap && \
1160 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1161 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1162 make && \
1163 make ${DESTDIR_flag} install || return $RC_FAILED
1164 make_dist || return $RC_DISTFAILED
1165 return $RC_SUCCESS
1166 }
1167
1168 # PEP-C LIB: Will install in same libdir as LCMAPS
1169 pep_api() {
1170 compo_pep_api=${compo_pep_api:-pep-api}
1171 svnroot_pep_api=${svnroot_pep_api_c:-http://svnweb.cern.ch/guest/glxa/pep-c-lib/}
1172 # tag_pep_api=${tag_pep_api:-branches/1_3}
1173 tag_pep_api=${tag_pep_api:-branches/2_0}
1174 # Need fix for 1_3 series, which does not properly treat the datadir.
1175 case "$tag_pep_api" in
1176 branches/1_*)
1177 mypep_api=${myprefix:-$GNU_DEF_PFX}
1178 mypepprefix_flag="--prefix=${mypep_api}"
1179 mypepdatadir_flag="--datadir=${myDESTDIR}/${mypep_api}/share"
1180 ;;
1181 *)
1182 mypep_api=""
1183 mypepprefix_flag=${prefix_flag}
1184 mypepdatadir_flag=""
1185 ;;
1186 esac
1187 cd ${SOURCE}
1188 get pep_api && \
1189 cd ${compo_pep_api} && \
1190 ./autotools.sh && \
1191 ./configure ${mypepprefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1192 ${mypepdatadir_flag} && \
1193 make && \
1194 make ${DESTDIR_flag} install || return $RC_FAILED
1195 set_def_compo_flags pep_api prefix
1196 make doxygen && make_dist || return $RC_DISTFAILED
1197 return $RC_SUCCESS
1198 }
1199
1200 # LCMAPS PLUGINS C-PEP
1201 lcmaps_plugins_c_pep() {
1202 compo_lcmaps_plugins_c_pep=${compo_lcmaps_plugins_c_pep:-lcmaps-plugins-c-pep}
1203 cd ${SOURCE}
1204 get lcmaps_plugins_c_pep && \
1205 cd ${compo_lcmaps_plugins_c_pep} && \
1206 ./bootstrap && \
1207 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1208 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1209 ${pep_api_prefix_flag} ${pep_api_libdir_flag} && \
1210 make && \
1211 make ${DESTDIR_flag} install || return $RC_FAILED
1212 make_dist || return $RC_DISTFAILED
1213 return $RC_SUCCESS
1214 }
1215
1216 # Jobrepository:
1217 jobrep_api() {
1218 compo_jobrep_api=${compo_jobrep_api:-jobrepository}
1219 cd ${SOURCE}
1220 get jobrep_api && \
1221 cd ${compo_jobrep_api} && \
1222 ./bootstrap && \
1223 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1224 ${includedir_flag} && \
1225 make && \
1226 make ${DESTDIR_flag} install || return $RC_FAILED
1227 set_def_compo_flags jobrep_api prefix includes libdir
1228 make_dist || return $RC_DISTFAILED
1229 return $RC_SUCCESS
1230 }
1231
1232 # LCMAPS PLUGINS JOBREP
1233 lcmaps_plugins_jobrep() {
1234 compo_lcmaps_plugins_jobrep=${compo_lcmaps_plugins_jobrep:-lcmaps-plugins-jobrep}
1235 cd ${SOURCE}
1236 get lcmaps_plugins_jobrep && \
1237 cd ${compo_lcmaps_plugins_jobrep} && \
1238 ./bootstrap && \
1239 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1240 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1241 ${jobrep_api_prefix_flag} ${jobrep_api_includes_flag} \
1242 ${jobrep_api_libdir_flag} \
1243 ${globus_prefix_flag} ${globus_flavor_flag} && \
1244 make && \
1245 make ${DESTDIR_flag} install || return $RC_FAILED
1246 make_dist || return $RC_DISTFAILED
1247 return $RC_SUCCESS
1248 }
1249
1250 # SAML2XACML2 LIB:
1251 saml2_xacml2_c_lib() {
1252 compo_saml2_xacml2_c_lib=${compo_saml2_xacml2_c_lib:-saml2-xacml2-c-lib}
1253 gsoap_prefix=${SOURCE}/${compo_saml2_xacml2_c_lib}/gsoap-build
1254 cd ${SOURCE}
1255 export CXXFLAGS="-fPIC ${CXXFLAGS}"
1256 get saml2_xacml2_c_lib && \
1257 cd ${compo_saml2_xacml2_c_lib} && \
1258 # Only for new style SAML2-XACML2-C-lib do we have gsoap as tarball
1259 gsoap_tarball="`ls gsoap-2.7*.tar.gz 2>/dev/null`"
1260 if [ -n "$gsoap_tarball" ];then
1261 tar -zxf ${gsoap_tarball} || echo $RC_FAILED
1262 fi
1263 cd gsoap-2.7 && \
1264 ./configure --prefix=${gsoap_prefix} && \
1265 make && \
1266 make install && \
1267 cd ../xacml-1.0 && \
1268 ./bootstrap && \
1269 ./configure ${prefix_flag} ${libdir_flag} \
1270 --with-gsoap=${gsoap_prefix} && \
1271 make && \
1272 make ${DESTDIR_flag} install || return $RC_FAILED
1273 set_def_compo_flags xacml prefix
1274 make_dist || return $RC_DISTFAILED
1275 return $RC_SUCCESS
1276 }
1277
1278 # LCMAPS PLUGINS SCAS CLIENT:
1279 lcmaps_plugins_scas_client() {
1280 compo_lcmaps_plugins_scas_client=${compo_lcmaps_plugins_scas_client:-lcmaps-plugins-scas-client}
1281 cd ${SOURCE}
1282 get lcmaps_plugins_scas_client && \
1283 cd ${compo_lcmaps_plugins_scas_client} && \
1284 ./bootstrap && \
1285 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1286 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1287 ${xacml_prefix_flag} ${xacml_libdir_flag} && \
1288 make && \
1289 make ${DESTDIR_flag} install || return $RC_FAILED
1290 make_dist || return $RC_DISTFAILED
1291 return $RC_SUCCESS
1292 }
1293
1294 # SCAS
1295 scas() {
1296 compo_scas=${compo_scas:-scas}
1297 # fix for otherwise unlocatable seconday globus deps
1298 if [ -n "$globus_prefix" ];then
1299 ld_library_path_flag="LD_LIBRARY_PATH=${globus_prefix}/lib"
1300 else
1301 ld_library_path_flag=""
1302 fi
1303 cd ${SOURCE}
1304 get scas && \
1305 cd ${compo_scas} && \
1306 ./bootstrap && \
1307 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1308 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1309 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1310 ${xacml_prefix_flag} ${xacml_libdir_flag} \
1311 ${globus_prefix_flag} ${globus_flavor_flag} && \
1312 eval $ld_library_path_flag make && \
1313 make ${DESTDIR_flag} install || return $RC_FAILED
1314 make_dist || return $RC_DISTFAILED
1315 return $RC_SUCCESS
1316 }
1317
1318 # EES
1319 ees() {
1320 compo_ees=${compo_ees:-ees}
1321 cd ${SOURCE}
1322 get ees && \
1323 cd ${compo_ees} && \
1324 ./bootstrap && \
1325 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1326 ${xacml_prefix_flag} ${xacml_libdir_flag} && \
1327 make && \
1328 make ${DESTDIR_flag} install || return $RC_FAILED
1329 make_dist || return $RC_DISTFAILED
1330 return $RC_SUCCESS
1331 }
1332
1333 # LCAS PLUGINS BASIC:
1334 lcas_plugins_basic() {
1335 compo_lcas_plugins_basic=${compo_lcas_plugins_basic:-lcas-plugins-basic}
1336 cd ${SOURCE}
1337 get lcas_plugins_basic && \
1338 cd ${compo_lcas_plugins_basic} && \
1339 ./bootstrap && \
1340 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1341 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1342 ${globus_prefix_flag} ${globus_flavor_flag} && \
1343 make && \
1344 make ${DESTDIR_flag} install || return $RC_FAILED
1345 make_dist || return $RC_DISTFAILED
1346 return $RC_SUCCESS
1347 }
1348
1349 # LCAS PLUGINS CHECK-EXECUTABLE:
1350 lcas_plugins_check_executable() {
1351 compo_lcas_plugins_check_executable=${compo_lcas_plugins_check_executable:-lcas-plugins-check-executable}
1352 cd ${SOURCE}
1353 get lcas_plugins_check_executable && \
1354 cd ${compo_lcas_plugins_check_executable} && \
1355 ./bootstrap && \
1356 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1357 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1358 ${globus_prefix_flag} ${globus_flavor_flag} && \
1359 make && \
1360 make ${DESTDIR_flag} install || return $RC_FAILED
1361 make_dist || return $RC_DISTFAILED
1362 return $RC_SUCCESS
1363 }
1364
1365 # GRIDSITE CORE:
1366 gridsite() {
1367 compo_gridsite=${compo_gridsite:-org.gridsite.core}
1368 cvsrootweb_gridsite=${cvsrootweb_gridsite:-$webcvs}
1369 mygridsite=${mygridsite:-${myprefix:-$GNU_DEF_PFX}}
1370 # Already setup variables for other components
1371 gridsite_prefix=${myDESTDIR}/${mygridsite}
1372 if [ -n "${mylibdir}" ];then
1373 gridsitelibdir=`basename ${mylibdir}`
1374 gridsite_libdir=${gridsite_prefix}/${gridsitelibdir}
1375 else
1376 gridsitelibdir=lib
1377 gridsite_libdir=""
1378 fi
1379 cd ${SOURCE}
1380 get gridsite && \
1381 cd ${compo_gridsite}/src && \
1382 make prefix=${mygridsite} libdir=${gridsitelibdir} && \
1383 make prefix=${myDESTDIR}/${mygridsite} libdir=${gridsitelibdir} install || \
1384 return $RC_FAILED
1385
1386 VERSION=`grep "^PATCH_VERSION" ../VERSION|cut -d= -f2`
1387
1388 # Setup gridsite flag for other compos
1389 set_compo_flags gridsite prefix libdir
1390
1391 make_dist ../gridsite-${VERSION}.src.tar.gz || return $RC_DISTFAILED
1392 return $RC_SUCCESS
1393 }
1394
1395 # LCAS PLUGINS VOMS:
1396 lcas_plugins_voms() {
1397 compo_lcas_plugins_voms=${compo_lcas_plugins_voms:-lcas-plugins-voms}
1398 cd ${SOURCE}
1399 get lcas_plugins_voms && \
1400 cd ${compo_lcas_plugins_voms} && \
1401 ./bootstrap && \
1402 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1403 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1404 ${globus_prefix_flag} ${globus_flavor_flag} \
1405 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} \
1406 ${gridsite_prefix_flag} &&
1407 make && \
1408 make ${DESTDIR_flag} install || return $RC_FAILED
1409 make_dist || return $RC_DISTFAILED
1410 return $RC_SUCCESS
1411 }
1412
1413 # LCAS-LCMAPS GT4 interface:
1414 # Note: only reason for building two extra globus targets
1415 # globus_gridmap_callout_error globus_authz
1416 lcas_lcmaps_gt4_interface() {
1417 compo_lcas_lcmaps_gt4_interface=${compo_lcas_lcmaps_gt4_interface:-lcas-lcmaps-gt4-interface}
1418 cd ${SOURCE}
1419 get lcas_lcmaps_gt4_interface && \
1420 cd ${compo_lcas_lcmaps_gt4_interface} && \
1421 ./bootstrap && \
1422 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1423 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1424 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1425 ${globus_prefix_flag} ${globus_flavor_flag} && \
1426 make && \
1427 make ${DESTDIR_flag} install || return $RC_FAILED
1428 make_dist || return $RC_DISTFAILED
1429 return $RC_SUCCESS
1430 }
1431
1432 ##############################################################################
1433 #
1434 # Define all dependency functions, NOTE: the order of the setdeps statements is
1435 # important!
1436 #
1437 ##############################################################################
1438
1439 # GLOBUS: no dependencies
1440 setdeps globus
1441
1442 # VOMS: no longer depends on globus
1443 setdeps voms
1444
1445 # LCMAPS: depends globus, voms
1446 setdeps lcmaps globus voms
1447
1448 # LCMAPS-INTERFACE: no dependencies
1449 setdeps lcmaps_interface
1450
1451 # LCAS: depends globus
1452 setdeps lcas globus
1453
1454 # LCAS-INTERFACE: no dependencies
1455 setdeps lcas_interface
1456
1457 # GLEXEC: depends lcmaps_interface
1458 setdeps glexec lcmaps_interface
1459
1460 # LCMAPS PLUGINS BASIC: depends lcmaps-interface
1461 setdeps lcmaps_plugins_basic lcmaps_interface
1462
1463 # LCMAPS PLUGINS VERIFY-PROXY: depends lcmaps-interface
1464 setdeps lcmaps_plugins_verify_proxy lcmaps_interface
1465
1466 # LCMAPS PLUGINS VOMS: depends globus, voms, lcmaps-interface
1467 setdeps lcmaps_plugins_voms globus voms lcmaps_interface
1468
1469 # LCMAPS PLUGINS AFS: depends lcmaps-interface
1470 setdeps lcmaps_plugins_afs globus lcmaps_interface
1471
1472 # LCMAPS PLUGINS GUMS: depends lcmaps-interface
1473 setdeps lcmaps_plugins_gums lcmaps_interface
1474
1475 # LCMAPS PLUGINS TRACKING GID: depends lcmaps-interface
1476 setdeps lcmaps_plugins_tracking_groupid lcmaps_interface
1477
1478 # PEP-C LIB: no dependencies
1479 setdeps pep_api
1480
1481 # LCMAPS PLUGINS C-PEP: depends pep-c lib, lcmaps-interface
1482 setdeps lcmaps_plugins_c_pep pep_api lcmaps_interface
1483
1484 # Jobrepository: no dependencies
1485 setdeps jobrep_api
1486
1487 # LCMAPS PLUGINS JOBREP: depends jobrepository lib, lcmaps-interface
1488 setdeps lcmaps_plugins_jobrep jobrep_api globus lcmaps_interface
1489
1490 # SAML2XACML2 LIB: no dependencies
1491 setdeps saml2_xacml2_c_lib
1492
1493 # LCMAPS PLUGINS SCAS CLIENT: depends saml2-xacml2-c-lib, lcmaps-interface
1494 setdeps lcmaps_plugins_scas_client saml2_xacml2_c_lib lcmaps_interface
1495
1496 # SCAS: depends saml2-xacml2-c-lib, lcmaps, lcas
1497 setdeps scas saml2_xacml2_c_lib lcmaps lcas
1498
1499 # EES: depends saml2-xacml2-c-lib
1500 setdeps ees saml2_xacml2_c_lib
1501
1502 # LCAS PLUGINS BASIC: depends globus, lcas-interface
1503 setdeps lcas_plugins_basic globus lcas_interface
1504
1505 # LCAS PLUGINS CHECK-EXECUTABLE: depends globus, lcas-interface
1506 setdeps lcas_plugins_check_executable globus lcas_interface
1507
1508 # GRIDSITE Core:
1509 setdeps gridsite
1510
1511 # LCAS PLUGINS VOMS: depends globus, voms, gridsite-core, lcas-interface
1512 setdeps lcas_plugins_voms globus voms gridsite lcas_interface
1513
1514 # LCAS-LCMAPS GT4 interface: depends globus, lcmaps, common-cpp, lcas, lcas-interface
1515 setdeps lcas_lcmaps_gt4_interface globus lcmaps lcas
1516
1517 ##############################################################################
1518 #
1519 # Build all tools, taking care of dependencies
1520 #
1521 ##############################################################################
1522
1523 # Now that we know all the targets, we can print usage if requested
1524 if [ "$USAGE" -eq 1 ];then
1525 usage
1526 myexit 0
1527 fi
1528
1529 # If we just wanted platform help, print it now
1530 if [ "$PLATFORM" = "help" ];then
1531 globus_etics_platform
1532 myexit 0
1533 fi
1534
1535 # Check source directory...
1536 if [ "`echo $SOURCE|cut -c1`" != "/" ];then
1537 SOURCE="`pwd`/$SOURCE"
1538 warning "Making source directory absolute: $SOURCE"
1539 fi
1540
1541 # When using a file: get targets also from there (instead of only using $*)
1542 TARGETS=""
1543 if [ -n "$TARGETFILE" ];then
1544 # remove everything starting with # (better not # in names...)
1545 TARGETS="`sed 's/#.*$//' $TARGETFILE`"
1546 fi
1547 # If we put something in it:
1548 if [ -n "$TARGETS" ];then
1549 TARGETS="$TARGETS $*"
1550 else
1551 TARGETS="$*"
1552 fi
1553
1554 # Check if anything needs doing...
1555 if [ -z "$TARGETS" ];then
1556 echo "No targets specified, nothing to be done."
1557 myexit 0
1558 fi
1559
1560 # Setup file to save the failed targets into.
1561 if [ -z "$NEWTARGETFILE" ];then
1562 NEWTARGETFILE=$SOURCE/$NEWTARGETFILE_DEFAULT
1563 fi
1564
1565 # Setup myDISTDIR
1566 if [ -z "$myDISTDIR" ];then
1567 myDISTDIR=$SOURCE
1568 fi
1569
1570 # Make sure we have an (empty) temp file
1571 touch $NEWFLAGFILE_TMP
1572 # Setup configure flags specified in file
1573 if [ -n "$FLAGFILE" ];then
1574 lines=`cat $FLAGFILE|wc -l`
1575 lineno=0
1576 while [ $lineno -lt $lines ];do
1577 lineno=`expr $lineno + 1`
1578 line=`sed -n ${lineno}p $FLAGFILE|sed 's/#.*$//'`
1579 if [ -n "$line" ];then
1580 parse_flag "$line"
1581 fi
1582 done
1583 fi
1584
1585 # Setup configure flags specified on cmdline
1586 if [ -n "$FLAGS" ];then
1587 for i in `echo "$FLAGS"`;do
1588 parse_flag $i
1589 done
1590 fi
1591
1592 # Setup file to save the failed targets into.
1593 if [ -z "$NEWFLAGFILE" ];then
1594 NEWFLAGFILE=$SOURCE/$NEWFLAGFILE_DEFAULT
1595 fi
1596
1597 # Find suitable download command
1598 get_download_cmd
1599
1600 # Parse the config options
1601 parse_config
1602
1603 # Figure out the build targets
1604 # Check for special build all target and make all unique
1605 # - substitute 'all' -> $known_targets
1606 # - re-uniquefy
1607 # - remove empty lines
1608 reqs=`echo "$TARGETS"|tr ' ' '\n'|sed "s/^all$/$known_targets/"|tr ' ' '\n'|sort -u|grep -v '^$'`
1609
1610 # loop over all known targets and pick out the requested ones
1611 build_targets=""
1612 for known in `echo $known_targets|tr ' ' '\n'`;do
1613 reqs_new=`echo $reqs|tr ' ' '\n'|grep -v "^$known$"`
1614 # if different, we have a match
1615 if [ "$reqs_new" != "$reqs" ];then
1616 reqs=$reqs_new
1617 build_targets=`echo $build_targets $known`
1618 fi
1619 done
1620 # Anything left is unknown target...
1621 if [ -n "$reqs" ];then
1622 error "Unknown target(s): $reqs"
1623 fi
1624
1625 DISTFAILED=0
1626 MISSING=0
1627 FAILED=0
1628 # Anything to be done?
1629 if [ -n "$build_targets" ];then
1630 # create the source dir
1631 mkdir -p ${SOURCE} || error "Creating of ${SOURCE} FAILED"
1632
1633 # Get globus_flavour just in case we won't build. If it will be build, it
1634 # will be reset afterwards.
1635 globus_flavour
1636
1637 # Do the builds and print results
1638 if [ -z "$STDOUT" ];then
1639 if [ -z "$STDERR" ];then
1640 build
1641 else
1642 build 2> $STDERR
1643 fi
1644 else
1645 if [ -z "$STDERR" ];then
1646 build > $STDOUT
1647 else
1648 build > $STDOUT 2> $STDERR
1649 fi
1650 fi
1651 fi
1652
1653 myexit `expr $DISTFAILED + $MISSING + $FAILED`

Properties

Name Value
svn:executable *

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