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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2230 - (show annotations) (download) (as text)
Thu Mar 17 10:07:39 2011 UTC (10 years, 10 months ago) by msalle
File MIME type: application/x-shellscript
File size: 51145 byte(s)
Removing age, to follow new style in mwsec.

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.2.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 [ -n "$myDESTDIR" ] && DESTDIR_flag=$flag
384 ;;
385
386 DISTDIR=*)
387 eval my$flag ;;
388
389 globus=*|gridsite=*)
390 eval my$flag ;;
391
392 # prefix/includes flags for *other* components.
393 globus-prefix=*|\
394 gridsite-prefix=*|gridsite-libdir=*|\
395 voms-prefix=*|voms-includes=*|voms-libdir=*|\
396 lcmaps-prefix=*|lcmaps-includes=*|lcmaps-libdir=*|\
397 lcas-prefix=*|lcas-includes=*|lcas-libdir=*|\
398 jobrep-api-prefix=*|jobrep-api-includes=*|jobrep-api-libdir=*|\
399 pep-api-prefix=*|pep-api-libdir=*|\
400 xacml-prefix=*|xacml-libdir=*)
401 var=`echo $flag|cut -d= -f1|tr '-' '_'`
402 value=`echo $flag|cut -d= -f2`
403 eval ${var}="$value"
404 eval ${var}_flag="--with-$flag" ;;
405
406 # globus flavor for other components.
407 globus-flavor=*)
408 globus_flavor=`echo $flag|cut -d= -f2`
409 globus_flavor_flag="--with-globus-nothr-flavor=$globus_flavor" ;;
410
411 *) error "Unknown configure flag \"$flag\" specified" ;;
412 esac
413 echo "$flag" >> $NEWFLAGFILE_TMP
414 }
415
416 # Saves configuration flags from temporary file
417 save_flags() {
418 rm -f $NEWFLAGFILE
419 echo "# WARNING: this is a CREATED file, local changes will (probably) get lost" \
420 > $NEWFLAGFILE
421 echo "# This file contains all configure flags:" >> $NEWFLAGFILE
422 echo "# $PROG -f $NEWFLAGFILE" >> $NEWFLAGFILE
423 for flag in `cut -d'=' -f1 $NEWFLAGFILE_TMP|sort -u`;do
424 case "$flag" in
425 prefix|libdir|includedir|sysconfdir|DESTDIR|DISTDIR)
426 eval value="\$my$flag"
427 eval echo "$flag=$value" >> $NEWFLAGFILE ;;
428 globus|gridsite)
429 eval value="\$my$flag"
430 eval rc=\$rc_$flag
431 # Only save these build flags if the component failed
432 if [ "$rc" = "$RC_FAILED" -o "$rc" = "$RC_MISSDEP" ];then
433 eval echo "$flag=$value" >> $NEWFLAGFILE
434 fi ;;
435 *-prefix|*-includes|*-libdir|globus-flavor)
436 eval value="\$`echo $flag|tr '-' '_'`"
437 eval echo "$flag=$value" >> $NEWFLAGFILE ;;
438 *) error "Unknown configure flag \"$flag\" found" ;;
439 esac
440 done
441 rm -f $NEWFLAGFILE_TMP
442 }
443
444 # cvs checkout wrapper: a wget + untar is much faster than anonymous cvs
445 # checkout, especially due to a 30 sec. timeout of the CVS server.
446 cvsget() {
447 name="$1"
448 dir="$2"
449 [ -z "$name" ] && return $RC_FAILED
450 eval compo=\$\{compo_$name\}
451 eval tag=\$\{tag_$name\}
452 eval cvsroot=\$\{cvsroot_$name\}
453 eval coopts=\$\{coopts_$name\}
454 # optionally remove directory
455 [ $REMOVE -eq 1 ] && rm -rf ${dir:-$compo}
456 # use cvs checkout
457 cvs -d $cvsroot co $coopts \
458 ${tag:+-r $tag} \
459 ${dir:+-d $dir} $compo || return $RC_FAILED
460
461 return $RC_SUCCESS
462 }
463
464 cvswebget() {
465 name="$1"
466 dir="$2"
467 [ -z "$name" ] && return $RC_FAILED
468 eval compo=\$\{compo_$name\}
469 eval tag=\$\{tag_$name\}
470 eval cvsrootweb=\$\{cvsrootweb_$name\}
471 eval coopts=\$\{coopts_$name\}
472 url="${cvsrootweb:-$webcvs}${compo}.tar.gz?view=tar${tag:+&pathrev=$tag}"
473 # Use tarball installation: always remove old dir
474 rm -rf ${dir:-$compo}
475 # If custom directory: download in tmpdir and later move to dir
476 if [ -n "$dir" ];then
477 tmpdir=tmpdir.$$
478 mkdir ${tmpdir} && cd ${tmpdir} || return $RC_FAILED
479 fi
480 # Retrieve tarball and untar on the fly
481 eval "${wget} \"$url\"" | tar -zvxf - || return $RC_FAILED
482 # Move downloaded dir into $dir and cleanup
483 if [ -n "$dir" ];then
484 cd .. && \
485 mv ${tmpdir}/${compo} $dir && \
486 rmdir ${tmpdir} || return $RC_FAILED
487 unset tmpdir
488 fi
489
490 return $RC_SUCCESS
491 }
492
493 # svn checkout wrapper
494 svnget() {
495 name="$1"
496 dir="$2"
497 [ -z "$name" ] && return $RC_FAILED
498 eval compo=\$\{compo_$name\}
499 eval tag=\$\{tag_$name:-trunk/$compo\}
500 eval svnroot=\$\{svnroot_$name:-$mwsec_svnroot\}
501 eval coopts=\$\{coopts_$name\}
502 realdir=${dir:-$compo}
503 # optionally remove directory
504 [ $REMOVE -eq 1 ] && rm -rf ${realdir}
505 svn co $coopts ${svnroot}${tag} ${realdir} || return $RC_FAILED
506 unset realdir
507
508 return $RC_SUCCESS
509 }
510
511 # git checkout wrapper
512 gitget() {
513 name="$1"
514 dir="$2"
515 [ -z "$name" ] && return $RC_FAILED
516 eval compo=\$\{compo_$name\}
517 eval tag=\$\{tag_$name\}
518 eval gitrepo=\$\{gitrepo_$name\}
519 [ -z "$gitrepo" ] && return $RC_FAILED
520 #eval coopts=\$\{coopts_$name\}
521 realdir=${dir:-$compo}
522 # optionally remove directory
523 [ $REMOVE -eq 1 ] && rm -rf ${realdir}
524 if [ -d ${realdir} ];then
525 cd ${realdir} && \
526 git checkout ${tag} && \
527 git fetch && \
528 git reset --hard || return $RC_FAILED
529 cd ..
530 else
531 if [ -n "${tag}" ] ; then
532 git clone -n ${gitrepo} ${realdir} && \
533 cd ${realdir} && \
534 git checkout ${tag} || return $RC_FAILED
535 cd ..
536 else
537 git clone ${gitrepo} ${realdir} || return $RC_FAILED
538 fi
539 fi
540 }
541
542 # general cvs and svn wrapper: use svn ONLY when cvsroot is NOT defined AND
543 # svnroot is defined. In all other cases, use cvsroot
544 get() {
545 name="$1"
546 dir="$2"
547 [ -z "$name" ] && return $RC_FAILED
548 eval cvsroot=\$\{cvsroot_$name\}
549 eval cvsrootweb=\$\{cvsrootweb_$name\}
550 eval svnroot=\$\{svnroot_$name\}
551 eval gitrepo=\$\{gitrepo_$name\}
552 if [ -n "$cvsroot" ] ; then
553 cvsget $name $dir
554 elif [ -n "$cvsrootweb" ] ; then
555 cvswebget $name $dir
556 elif [ -n "$gitrepo" ] ; then
557 gitget $name $dir
558 else
559 svnget $name $dir
560 fi
561 return $?
562 }
563
564 # Print function for results:
565 # $1 - name of component, result is in $rc_<name of component>
566 print_result() {
567 tool=$1
568 eval rc=\$rc_$tool
569 [ "$rc" = "$RC_SKIPPED" ] && return
570 case "$rc" in
571 $RC_SUCCESS) result="SUCCESS" ;;
572 $RC_DISTFAILED) result="DIST TARBALL FAILED"
573 echo "$tool" >> $NEWTARGETFILE
574 DISTFAILED=$RC_DISTFAILED ;;
575 $RC_MISSDEP) result="MISSING DEPS"
576 echo "$tool" >> $NEWTARGETFILE
577 MISSING=$RC_MISSDEP ;;
578 $RC_FAILED) result="FAILED"
579 echo "$tool" >> $NEWTARGETFILE
580 FAILED=$RC_FAILED ;;
581 *) result="UNKNOWN: $rc" ;;
582 esac
583 printf "%-30s: %s\n" "$tool" "$result"
584 }
585
586 # Creates dist tarball and moves it to the ${SOURCE} directory.
587 make_dist() {
588 if [ $DIST -eq 1 ];then
589 # Allow for an optionally given tarball
590 if [ -n "$1" ];then
591 tarball=$1
592 else
593 package=`grep "^PACKAGE *= *" Makefile|sed 's/PACKAGE *= *//'`
594 version=`grep "^VERSION *= *" Makefile|sed 's/VERSION *= *//'`
595 tarball=${package}-${version}.tar.gz
596 fi
597 if [ -f "$tarball" ];then
598 rm -f $tarball
599 fi
600 make dist || return $RC_DISTFAILED
601 mkdir -p ${myDISTDIR} && mv $tarball ${myDISTDIR} || return $RC_DISTFAILED
602 fi
603 return $RC_SUCCESS
604 }
605
606 # Build the targets and print the results
607 build() {
608 t0=`date +%s`
609 # build the targets
610 for target in $build_targets;do
611 eval dep_$target
612 [ $EXIT_ON_ERROR -eq 1 -a $? -ge $RC_FAILED ] && break
613 done
614 t1=`date +%s`
615
616 if [ -n "$NEWTARGETFILE" ];then
617 rm -f $NEWTARGETFILE
618 echo "# WARNING: this is a CREATED file, local changes will "\
619 "(probably) get lost" > $NEWTARGETFILE
620 echo "# This file contains all failed components:" >> $NEWTARGETFILE
621 echo "# $PROG -i $NEWTARGETFILE" >> $NEWTARGETFILE
622 fi
623 # Print results
624 for target in $known_targets;do
625 print_result $target
626 done
627 # Save flags file
628 save_flags
629
630 echo "Total build time: `expr $t1 - $t0` seconds"
631 }
632
633 # Sets the default configure flags for a built component, and saves them to the tmp file.
634 set_def_compo_flags() {
635 compo=$1; shift
636 name=`echo $compo|tr '_' '-'`
637 for var in $*;do
638 case "$var" in
639 prefix)
640 if [ -n "$myDESTDIR" -o -n "$myprefix" ];then
641 value="${myDESTDIR}/${myprefix:-$GNU_DEF_PFX}"
642 eval ${compo}_${var}="$value"
643 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
644 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
645 fi
646 ;;
647 includes)
648 # Only set includes flags when we have overridden the default
649 # location, otherwise prefix is sufficient.
650 if [ -n "$myincludedir" ];then
651 value="${myDESTDIR}/${myincludedir}"
652 eval ${compo}_${var}="$value"
653 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
654 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
655 fi
656 ;;
657 libdir)
658 # Only set libdir flags when we have overridden the default
659 # location, otherwise prefix is sufficient.
660 if [ -n "$mylibdir" ];then
661 value="${myDESTDIR}/${mylibdir}"
662 eval ${compo}_${var}="$value"
663 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
664 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
665 fi
666 ;;
667 *) error "Unknown flag type \"$var\" specified"
668 ;;
669 esac
670 done
671 }
672
673 # Sets configure flags for a built component assuming the ${compo}_* is already set.
674 # Then saves the flags to the tmp file.
675 set_compo_flags() {
676 compo=$1; shift
677 name=`echo $compo|tr '_' '-'`
678 for var in $*;do
679 eval ${compo}_${var}_flag=""
680 eval value=\$${compo}_${var}
681 if [ -n "$value" ];then
682 case "$var" in
683 prefix)
684 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
685 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
686 ;;
687 includes)
688 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
689 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
690 ;;
691 libdir)
692 eval ${compo}_${var}_flag="--with-${name}-${var}=$value"
693 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
694 ;;
695 flavor)
696 eval ${compo}_${var}_flag="--with-${name}-nothr-${var}=$value"
697 echo "${name}-${var}=$value" >> $NEWFLAGFILE_TMP
698 ;;
699 *) error "Unknown flag type \"$var\" specified"
700 ;;
701 esac
702 fi
703 done
704 }
705
706 ##############################################################################
707 #
708 # Define all building functions
709 #
710 ##############################################################################
711
712 # GLOBUS
713
714
715 # print known platforms for globus tarball
716 globus_etics_platform() {
717 echo "Valid platforms are:"
718 echo " RH4_32"
719 echo " RH5_64"
720 echo " SUSE11_64"
721 echo " Deb5_64"
722 }
723
724 # globus from VDT/etics tarball
725 globus_etics() {
726 # Find correct globus for platform
727 case "$PLATFORM" in
728 RH4_32)
729 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.3-VDT-1.6.1/slc4_ia32_gcc346/
730 globus_tgz=globus-4.0.3-VDT-1.6.1-7.tar.gz
731 globus_flavor=gcc32dbg
732 ;;
733 RH5_64)
734 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.7-VDT-1.10.1/sl5_x86_64_gcc412/
735 globus_tgz=globus-4.0.7-VDT-1.10.1-1.tar.gz
736 globus_flavor=gcc64dbg
737 ;;
738 SUSE11_64)
739 globus_url=http://eticssoft.web.cern.ch/eticssoft/repository//vdt/globus/4.0.7-VDT-1.10.1/SUSE11_x86_64_gcc432/
740 globus_tgz=globus-4.0.7-VDT-1.10.1-1.tar.gz
741 globus_flavor=gcc64dbg
742 ;;
743 Deb5_64)
744 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.8-VDT-2.0.0/deb5_x86_64_gcc432/
745 globus_tgz=globus-4.0.8-VDT-2.0.0-2.tar.gz
746 globus_flavor=gcc64dbg
747 ;;
748 *)
749 echo "Unknown platform: \"$PLATFORM\"" >&2
750 globus_etics_platform >&2
751 myexit 1
752 ;;
753 esac
754
755 # Now download, unpack, and update the tarball
756 cd ${SOURCE}
757 mkdir -p ${globus_prefix} && \
758 eval ${wget} ${globus_url}${globus_tgz} > ${globus_tgz} && \
759 tar -C ${globus_prefix} -zxf ${globus_tgz} && \
760 cd ${globus_prefix} && \
761 find . -type f -name lib\*.la|while read file;do
762 sed s+/opt/globus+${globus_prefix}+g ${file} > ${file}.new && \
763 mv -f ${file}.new ${file}
764 done || return $RC_FAILED
765
766 # Setup globus flags for other compos
767 set_compo_flags globus prefix flavor
768
769 return $RC_SUCCESS
770 }
771
772 # globus directly from source tarball
773 globus_source() {
774 tag=${tag_globus:-4.0.8}
775 major=`echo $tag|cut -d. -f1`
776 minor=`echo $tag|cut -d. -f2`
777 # Where to get which globus toolkit tarball
778 globus_url=${globus_baseurl}gt${major}/${major}.${minor}/${tag}/installers/src/
779 globus_tbz=gt${tag}-all-source-installer.tar.bz2
780 globus_srcdir=`basename ${globus_tbz} .tar.bz2`
781
782 # Note: making globus_gridmap_callout_error globus_authz only needed for gt4
783 # interface.
784 cd ${SOURCE}
785 eval ${wget} ${globus_url}${globus_tbz} > ${globus_tbz} && \
786 tar -jxf ${globus_tbz} && \
787 cd ${globus_srcdir} && \
788 ./configure --prefix=${globus_prefix} \
789 --disable-gridftp --disable-gsiopenssh --disable-myproxy \
790 --disable-rls --disable-drs --disable-rendezvous \
791 --disable-tests --disable-prewsgram --disable-wsgram \
792 --disable-wsjava --disable-wsc --disable-wsmds --disable-wsdel \
793 --disable-wsrft --disable-wscas --disable-wstests \
794 --disable-webmds && \
795 make globus-gsi globus_gridmap_callout_error globus_authz && \
796 make install || return $RC_FAILED
797
798 # Remove .la files for at least globus
799 find ${globus_prefix}/lib -name lib\*.la -exec rm "{}" \;
800
801 # (re)evaluate globus flavour
802 globus_flavour
803
804 # Setup globus flags for other compos
805 set_compo_flags globus prefix flavor
806
807 return $RC_SUCCESS
808 }
809
810 # Set correct globus flavour
811 globus_flavour() {
812 if [ -n "$PLATFORM" ];then
813 case "$PLATFORM" in
814 RH4_32) globus_flavor=gcc32dbg ;;
815 RH5_64) globus_flavor=gcc64dbg ;;
816 SUSE11_64) globus_flavor=gcc64dbg ;;
817 Deb5_64) globus_flavor=gcc64dbg ;;
818 *) echo "Unknown platform: \"$PLATFORM\"" >&2
819 return $RC_FAILED ;;
820 esac
821 else
822 if [ -f "${globus_prefix}/etc/globus_core/flavor_gcc64dbg.gpt" ];then
823 globus_flavor=gcc64dbg
824 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc64.gpt" ];then
825 globus_flavor=gcc64
826 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc32dbg.gpt" ];then
827 globus_flavor=gcc32dbg
828 elif [ -f "${globus_prefix}/etc/globus_core/flavor_gcc32.gpt" ];then
829 globus_flavor=gcc32
830 else
831 # Assume we're building a flavor-less version
832 globus_flavor=""
833 fi
834 fi
835 return $RC_SUCCESS
836 }
837
838 # wrapper function that either does a source download or etics download
839 globus() {
840 globus_prefix=${myDESTDIR}/${myglobus:-${myprefix:-$GNU_DEF_PFX}}
841 # Now unpack or build globus
842 if [ -z "$PLATFORM" ];then
843 globus_source
844 return $?
845 else
846 globus_etics
847 return $?
848 fi
849 }
850
851 # VOMS development version, directly from CNAF via git, for OpenSSL1.0
852 voms_git() {
853 compo_voms=${compo_voms:-voms}
854 # tag_voms=${tag_voms:-voms_R_2_0_0_RC2}
855 tag_voms=${tag_voms:-origin/new-voms-2-0-series}
856 gitrepo_voms=${gitroot_voms:-git://testbed002.cnaf.infn.it/opt/gits/voms.git}
857 cd ${SOURCE}
858 gitget voms && \
859 cd ${compo_voms} && \
860 ./configure --prefix=${myprefix:-$GNU_DEF_PFX} ${libdir_flag} ${sysconfdir_flag} \
861 ${includedir_flag} \
862 --disable-glite --disable-java --with-api-only && \
863 make && \
864 make ${DESTDIR_flag} install || return $RC_FAILED
865 make_dist || return $RC_DISTFAILED
866 set_def_compo_flags voms prefix includes libdir
867 return $RC_SUCCESS
868 }
869
870 # VOMS development version, directly from CNAF via SVN
871 voms_svn() {
872 compo_voms=${compo_voms:-voms}
873 cd ${SOURCE}
874 # optionally remove directory
875 [ $REMOVE -eq 1 ] && rm -rf ${compo_voms}
876 echo "t" |svn co --no-auth-cache --username anonymous --password anonymous \
877 https://svn.forge.cnaf.infn.it/svn/voms/voms/branches/voms-2-0-series ${compo_voms} && \
878 cd ${compo_voms} || return $RC_FAILED
879 # Already setup variables for other components: voms overrides libdir...
880 myvoms=${myprefix:-$GNU_DEF_PFX}
881 voms_prefix=${myDESTDIR}/${myvoms}
882 if [ -n "${mylibdir}" ];then
883 myvomslibdir=${mylibdir}
884 voms_libdir=${myDESTDIR}/${mylibdir}
885 else
886 myvomslibdir=${myvoms}/lib
887 voms_libdir=""
888 fi
889 # Fix for old style includedir
890 if grep -q '@includedir@/glite/security/voms' src/include/Makefile.am ; then
891 # Don't try to improve on includedir, use: <prefix>/include/glite/security
892 myvomsincludedir_flag=""
893 voms_includes=${voms_prefix}/include/glite/security
894 elif [ -n "${myincludedir}" ];then
895 myvomsincludedir_flag="--includedir=${myincludedir}"
896 voms_includes=${myDESTDIR}/${myincludedir}
897 else
898 myvomsincludedir_flag=""
899 voms_includes=""
900 fi
901 ./autogen.sh && \
902 ./configure --prefix=${myvoms} --libdir=${myvomslibdir} ${sysconfdir_flag} \
903 ${myvomsincludedir_flag} \
904 --disable-glite --disable-java --with-api-only && \
905 make && \
906 make ${DESTDIR_flag} libdir=${myvomslibdir} install || return $RC_FAILED
907 set_compo_flags voms prefix includes libdir
908 return $RC_SUCCESS
909 }
910
911 voms_cerncvs() {
912 compo_voms=${compo_voms:-org.glite.security.voms}
913 cvsrootweb_voms=${cvsrootweb_voms:-$webcvs}
914 cd ${SOURCE}
915 get voms && \
916 cd ${compo_voms} || return $RC_FAILED
917 # Already setup variables for other components: voms overrides libdir...
918 myvoms=${myprefix:-$GNU_DEF_PFX}
919 voms_prefix=${myDESTDIR}/${myvoms}
920 if [ -n "${mylibdir}" ];then
921 myvomslibdir=${mylibdir}
922 voms_libdir=${myDESTDIR}/${mylibdir}
923 else
924 myvomslibdir=${myvoms}/lib
925 voms_libdir=""
926 fi
927 # Fix for old style includedir
928 if grep -q '@includedir@/glite/security/voms' src/include/Makefile.am ; then
929 # Don't try to improve on includedir, use: <prefix>/include/glite/security
930 myvomsincludedir_flag=""
931 voms_includes=${voms_prefix}/include/glite/security
932 elif [ -n "${myincludedir}" ];then
933 myvomsincludedir_flag="--includedir=${myincludedir}"
934 voms_includes=${myDESTDIR}/${myincludedir}
935 else
936 myvomsincludedir_flag=""
937 voms_includes=""
938 fi
939 ./autogen.sh && \
940 ./configure --prefix=${myvoms} --libdir=${myvomslibdir} ${sysconfdir_flag} \
941 ${myvomsincludedir_flag} \
942 ${globus_prefix_flag} \
943 --disable-glite --disable-java --with-api-only && \
944 make && \
945 make ${DESTDIR_flag} libdir=${myvomslibdir} install || return $RC_FAILED
946 set_compo_flags voms prefix includes libdir
947 return $RC_SUCCESS
948 }
949
950 # VOMS: (C & C++ API only)
951 voms() {
952 case "$tag_voms" in
953 glite-security-voms_*)
954 voms_cerncvs
955 return $?
956 ;;
957 svn*)
958 voms_svn
959 return $?
960 ;;
961 *)
962 voms_git
963 return $?
964 ;;
965 esac
966 }
967
968 # LCMAPS: Note we can always use the un-threaded flavor for both
969 lcmaps() {
970 compo_lcmaps=${compo_lcmaps:-lcmaps}
971 cd ${SOURCE}
972 get lcmaps && \
973 cd ${compo_lcmaps} && \
974 ./bootstrap && \
975 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
976 ${includedir_flag} \
977 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} \
978 ${globus_prefix_flag} \
979 ${globus_flavor_flag} && \
980 make && \
981 make ${DESTDIR_flag} install || return $RC_FAILED
982 set_def_compo_flags lcmaps prefix includes libdir
983
984 # remove liblcmaps*.la files from installation. It's a hack...
985 warning "Removing liblcmaps\*.la files from $findlibdir"
986 find ${lcmaps_libdir:-${lcmaps_prefix:-${myDESTDIR}/$GNU_DEF_PFX}} \
987 -name liblcmaps\*.la -exec rm "{}" \;
988 rc_lcmaps_interface=$RC_SUCCESS
989
990 make_dist || return $RC_DISTFAILED
991 return $RC_SUCCESS
992 }
993
994 # LCMAPS-INTERFACE:
995 lcmaps_interface() {
996 if [ "$rc_lcmaps" = "$RC_SUCCESS" -o "$rc_lcmaps" = "$RC_DISTFAILED" ];then
997 warning "No need to build lcmaps_interface: "\
998 "lcmaps has been build successfully."
999 return $RC_SUCCESS
1000 fi
1001 dir=lcmaps-interface
1002 compo_lcmaps_interface=${compo_lcmaps_interface:-lcmaps}
1003 cd ${SOURCE}
1004 get lcmaps_interface $dir && \
1005 cd ${dir} && \
1006 ./bootstrap && \
1007 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1008 ${includedir_flag} \
1009 --enable-headers && \
1010 make && \
1011 make ${DESTDIR_flag} install || return $RC_FAILED
1012 set_def_compo_flags lcmaps prefix includes libdir
1013 return $RC_SUCCESS
1014 }
1015
1016 # LCAS:
1017 lcas() {
1018 compo_lcas=${compo_lcas:-lcas}
1019 cd ${SOURCE}
1020 get lcas && \
1021 cd ${compo_lcas} && \
1022 ./bootstrap && \
1023 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1024 ${includedir_flag} \
1025 ${globus_prefix_flag} ${globus_flavor_flag} && \
1026 make && \
1027 make ${DESTDIR_flag} install || return $RC_FAILED
1028 set_def_compo_flags lcas prefix includes libdir
1029 rc_lcas_interface=$RC_SUCCESS
1030 make_dist || return $RC_DISTFAILED
1031 return $RC_SUCCESS
1032 }
1033
1034 # LCAS-INTERFACE:
1035 lcas_interface() {
1036 if [ "$rc_lcas" = "$RC_SUCCESS" -o "$rc_lcas" = "$RC_DISTFAILED" ];then
1037 warning "No need to build lcas_interface: lcas has been build successfully."
1038 return $RC_SUCCESS
1039 fi
1040 dir=lcas-interface
1041 compo_lcas_interface=${compo_lcas_interface:-lcas}
1042 cd ${SOURCE}
1043 get lcas_interface $dir && \
1044 cd ${dir} && \
1045 ./bootstrap && \
1046 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1047 ${includedir_flag} \
1048 --enable-headers && \
1049 make ${DESTDIR_flag} install || return $RC_FAILED
1050 set_def_compo_flags lcas prefix includes libdir
1051 return $RC_SUCCESS
1052 }
1053
1054 # glexec >=0.8
1055 glexec() {
1056 compo_glexec=${compo_glexec:-glexec}
1057 cd ${SOURCE}
1058 get glexec && \
1059 cd ${compo_glexec} && \
1060 ./bootstrap && \
1061 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1062 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1063 make && \
1064 make ${DESTDIR_flag} install || return $RC_FAILED
1065 make_dist || return $RC_DISTFAILED
1066 return $RC_SUCCESS
1067 }
1068
1069 # LCMAPS PLUGINS BASIC:
1070 lcmaps_plugins_basic() {
1071 compo_lcmaps_plugins_basic=${compo_lcmaps_plugins_basic:-lcmaps-plugins-basic}
1072 cd ${SOURCE}
1073 get lcmaps_plugins_basic && \
1074 cd ${compo_lcmaps_plugins_basic} && \
1075 ./bootstrap && \
1076 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1077 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1078 make && \
1079 make ${DESTDIR_flag} install || return $RC_FAILED
1080 make_dist || return $RC_DISTFAILED
1081 return $RC_SUCCESS
1082 }
1083
1084 # LCMAPS PLUGINS VERIFY-PROXY:
1085 lcmaps_plugins_verify_proxy() {
1086 compo_lcmaps_plugins_verify_proxy=${compo_lcmaps_plugins_verify_proxy:-lcmaps-plugins-verify-proxy}
1087 cd ${SOURCE}
1088 get lcmaps_plugins_verify_proxy && \
1089 cd ${compo_lcmaps_plugins_verify_proxy} && \
1090 ./bootstrap && \
1091 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1092 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1093 make && \
1094 make ${DESTDIR_flag} install || return $RC_FAILED
1095 make_dist || return $RC_DISTFAILED
1096 return $RC_SUCCESS
1097 }
1098
1099 # LCMAPS PLUGINS VOMS:
1100 lcmaps_plugins_voms() {
1101 compo_lcmaps_plugins_voms=${compo_lcmaps_plugins_voms:-lcmaps-plugins-voms}
1102 cd ${SOURCE}
1103 get lcmaps_plugins_voms && \
1104 cd ${compo_lcmaps_plugins_voms} && \
1105 ./bootstrap && \
1106 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1107 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1108 ${globus_prefix_flag} ${globus_flavor_flag} \
1109 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} && \
1110 make && \
1111 make ${DESTDIR_flag} install || return $RC_FAILED
1112 make_dist || return $RC_DISTFAILED
1113 return $RC_SUCCESS
1114 }
1115
1116 # LCMAPS PLUGINS AFS:
1117 lcmaps_plugins_afs() {
1118 compo_lcmaps_plugins_afs=${compo_lcmaps_plugins_afs:-lcmaps-plugins-afs}
1119 cd ${SOURCE}
1120 get lcmaps_plugins_afs && \
1121 cd ${compo_lcmaps_plugins_afs} && \
1122 ./bootstrap && \
1123 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1124 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1125 ${globus_prefix_flag} ${globus_flavor_flag} && \
1126 make && \
1127 make ${DESTDIR_flag} install || return $RC_FAILED
1128 make_dist || return $RC_DISTFAILED
1129 return $RC_SUCCESS
1130 }
1131
1132 # LCMAPS PLUGINS GUMS:
1133 lcmaps_plugins_gums() {
1134 compo_lcmaps_plugins_gums=${compo_lcmaps_plugins_gums:-lcmaps-plugins-gums}
1135 cd ${SOURCE}
1136 get lcmaps_plugins_gums && \
1137 cd ${compo_lcmaps_plugins_gums} && \
1138 ./bootstrap && \
1139 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1140 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} && \
1141 make && \
1142 make ${DESTDIR_flag} install || return $RC_FAILED
1143 make_dist || return $RC_DISTFAILED
1144 return $RC_SUCCESS
1145 }
1146
1147 # PEP-C LIB: Will install in same libdir as LCMAPS
1148 pep_api() {
1149 compo_pep_api=${compo_pep_api:-pep-api}
1150 svnroot_pep_api=${svnroot_pep_api_c:-http://svnweb.cern.ch/guest/glxa/pep-c-lib/}
1151 # tag_pep_api=${tag_pep_api:-branches/1_3}
1152 tag_pep_api=${tag_pep_api:-branches/2_0}
1153 # Need fix for 1_3 series, which does not properly treat the datadir.
1154 case "$tag_pep_api" in
1155 branches/1_*)
1156 mypep_api=${myprefix:-$GNU_DEF_PFX}
1157 mypepprefix_flag="--prefix=${mypep_api}"
1158 mypepdatadir_flag="--datadir=${myDESTDIR}/${mypep_api}/share"
1159 ;;
1160 *)
1161 mypep_api=""
1162 mypepprefix_flag=${prefix_flag}
1163 mypepdatadir_flag=""
1164 ;;
1165 esac
1166 cd ${SOURCE}
1167 get pep_api && \
1168 cd ${compo_pep_api} && \
1169 ./autotools.sh && \
1170 ./configure ${mypepprefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1171 ${mypepdatadir_flag} && \
1172 make && \
1173 make ${DESTDIR_flag} install || return $RC_FAILED
1174 set_def_compo_flags pep_api prefix
1175 make doxygen && make_dist || return $RC_DISTFAILED
1176 return $RC_SUCCESS
1177 }
1178
1179 # LCMAPS PLUGINS C-PEP
1180 lcmaps_plugins_c_pep() {
1181 compo_lcmaps_plugins_c_pep=${compo_lcmaps_plugins_c_pep:-lcmaps-plugins-c-pep}
1182 cd ${SOURCE}
1183 get lcmaps_plugins_c_pep && \
1184 cd ${compo_lcmaps_plugins_c_pep} && \
1185 ./bootstrap && \
1186 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1187 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1188 ${pep_api_prefix_flag} ${pep_api_libdir_flag} && \
1189 make && \
1190 make ${DESTDIR_flag} install || return $RC_FAILED
1191 make_dist || return $RC_DISTFAILED
1192 return $RC_SUCCESS
1193 }
1194
1195 # Jobrepository:
1196 jobrep_api() {
1197 compo_jobrep_api=${compo_jobrep_api:-jobrepository}
1198 cd ${SOURCE}
1199 get jobrep_api && \
1200 cd ${compo_jobrep_api} && \
1201 ./bootstrap && \
1202 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1203 ${includedir_flag} && \
1204 make && \
1205 make ${DESTDIR_flag} install || return $RC_FAILED
1206 set_def_compo_flags jobrep_api prefix includes libdir
1207 make_dist || return $RC_DISTFAILED
1208 return $RC_SUCCESS
1209 }
1210
1211 # LCMAPS PLUGINS JOBREP
1212 lcmaps_plugins_jobrep() {
1213 compo_lcmaps_plugins_jobrep=${compo_lcmaps_plugins_jobrep:-lcmaps-plugins-jobrep}
1214 cd ${SOURCE}
1215 get lcmaps_plugins_jobrep && \
1216 cd ${compo_lcmaps_plugins_jobrep} && \
1217 ./bootstrap && \
1218 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1219 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1220 ${jobrep_api_prefix_flag} ${jobrep_api_includes_flag} \
1221 ${jobrep_api_libdir_flag} \
1222 ${globus_prefix_flag} ${globus_flavor_flag} && \
1223 make && \
1224 make ${DESTDIR_flag} install || return $RC_FAILED
1225 make_dist || return $RC_DISTFAILED
1226 return $RC_SUCCESS
1227 }
1228
1229 # SAML2XACML2 LIB:
1230 saml2_xacml2_c_lib() {
1231 compo_saml2_xacml2_c_lib=${compo_saml2_xacml2_c_lib:-saml2-xacml2-c-lib}
1232 gsoap_prefix=${SOURCE}/${compo_saml2_xacml2_c_lib}/gsoap-build
1233 cd ${SOURCE}
1234 export CXXFLAGS="-fPIC ${CXXFLAGS}"
1235 get saml2_xacml2_c_lib && \
1236 cd ${compo_saml2_xacml2_c_lib} && \
1237 # Only for new style SAML2-XACML2-C-lib do we have gsoap as tarball
1238 gsoap_tarball="`ls gsoap-2.7*.tar.gz 2>/dev/null`"
1239 if [ -n "$gsoap_tarball" ];then
1240 tar -zxf ${gsoap_tarball} || echo $RC_FAILED
1241 fi
1242 cd gsoap-2.7 && \
1243 ./configure --prefix=${gsoap_prefix} && \
1244 make && \
1245 make install && \
1246 cd ../xacml-1.0 && \
1247 ./bootstrap && \
1248 ./configure ${prefix_flag} ${libdir_flag} \
1249 --with-gsoap=${gsoap_prefix} && \
1250 make && \
1251 make ${DESTDIR_flag} install || return $RC_FAILED
1252 set_def_compo_flags xacml prefix
1253 make_dist || return $RC_DISTFAILED
1254 return $RC_SUCCESS
1255 }
1256
1257 # LCMAPS PLUGINS SCAS CLIENT:
1258 lcmaps_plugins_scas_client() {
1259 compo_lcmaps_plugins_scas_client=${compo_lcmaps_plugins_scas_client:-lcmaps-plugins-scas-client}
1260 cd ${SOURCE}
1261 get lcmaps_plugins_scas_client && \
1262 cd ${compo_lcmaps_plugins_scas_client} && \
1263 ./bootstrap && \
1264 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1265 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1266 ${xacml_prefix_flag} ${xacml_libdir_flag} && \
1267 make && \
1268 make ${DESTDIR_flag} install || return $RC_FAILED
1269 make_dist || return $RC_DISTFAILED
1270 return $RC_SUCCESS
1271 }
1272
1273 # SCAS
1274 scas() {
1275 compo_scas=${compo_scas:-scas}
1276 cd ${SOURCE}
1277 get scas && \
1278 cd ${compo_scas} && \
1279 ./bootstrap && \
1280 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1281 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1282 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1283 ${xacml_prefix_flag} ${xacml_libdir_flag} \
1284 ${globus_prefix_flag} ${globus_flavor_flag} && \
1285 make && \
1286 make ${DESTDIR_flag} install || return $RC_FAILED
1287 make_dist || return $RC_DISTFAILED
1288 return $RC_SUCCESS
1289 }
1290
1291 # EES
1292 ees() {
1293 compo_ees=${compo_ees:-ees}
1294 cd ${SOURCE}
1295 get ees && \
1296 cd ${compo_ees} && \
1297 ./bootstrap && \
1298 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1299 ${xacml_prefix_flag} ${xacml_libdir_flag} && \
1300 make && \
1301 make ${DESTDIR_flag} install || return $RC_FAILED
1302 make_dist || return $RC_DISTFAILED
1303 return $RC_SUCCESS
1304 }
1305
1306 # LCAS PLUGINS BASIC:
1307 lcas_plugins_basic() {
1308 compo_lcas_plugins_basic=${compo_lcas_plugins_basic:-lcas-plugins-basic}
1309 cd ${SOURCE}
1310 get lcas_plugins_basic && \
1311 cd ${compo_lcas_plugins_basic} && \
1312 ./bootstrap && \
1313 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1314 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1315 ${globus_prefix_flag} ${globus_flavor_flag} && \
1316 make && \
1317 make ${DESTDIR_flag} install || return $RC_FAILED
1318 make_dist || return $RC_DISTFAILED
1319 return $RC_SUCCESS
1320 }
1321
1322 # LCAS PLUGINS CHECK-EXECUTABLE:
1323 lcas_plugins_check_executable() {
1324 compo_lcas_plugins_check_executable=${compo_lcas_plugins_check_executable:-lcas-plugins-check-executable}
1325 cd ${SOURCE}
1326 get lcas_plugins_check_executable && \
1327 cd ${compo_lcas_plugins_check_executable} && \
1328 ./bootstrap && \
1329 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1330 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1331 ${globus_prefix_flag} ${globus_flavor_flag} && \
1332 make && \
1333 make ${DESTDIR_flag} install || return $RC_FAILED
1334 make_dist || return $RC_DISTFAILED
1335 return $RC_SUCCESS
1336 }
1337
1338 # GRIDSITE CORE:
1339 gridsite() {
1340 compo_gridsite=${compo_gridsite:-org.gridsite.core}
1341 cvsrootweb_gridsite=${cvsrootweb_gridsite:-$webcvs}
1342 mygridsite=${mygridsite:-${myprefix:-$GNU_DEF_PFX}}
1343 # Already setup variables for other components
1344 gridsite_prefix=${myDESTDIR}/${mygridsite}
1345 if [ -n "${mylibdir}" ];then
1346 gridsitelibdir=`basename ${mylibdir}`
1347 gridsite_libdir=${gridsite_prefix}/${gridsitelibdir}
1348 else
1349 gridsitelibdir=lib
1350 gridsite_libdir=""
1351 fi
1352 cd ${SOURCE}
1353 get gridsite && \
1354 cd ${compo_gridsite}/src && \
1355 make prefix=${mygridsite} libdir=${gridsitelibdir} && \
1356 make prefix=${myDESTDIR}/${mygridsite} libdir=${gridsitelibdir} install || \
1357 return $RC_FAILED
1358
1359 VERSION=`grep "^PATCH_VERSION" ../VERSION|cut -d= -f2`
1360
1361 # Setup gridsite flag for other compos
1362 set_compo_flags gridsite prefix libdir
1363
1364 make_dist ../gridsite-${VERSION}.src.tar.gz || return $RC_DISTFAILED
1365 return $RC_SUCCESS
1366 }
1367
1368 # LCAS PLUGINS VOMS:
1369 lcas_plugins_voms() {
1370 compo_lcas_plugins_voms=${compo_lcas_plugins_voms:-lcas-plugins-voms}
1371 cd ${SOURCE}
1372 get lcas_plugins_voms && \
1373 cd ${compo_lcas_plugins_voms} && \
1374 ./bootstrap && \
1375 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1376 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1377 ${globus_prefix_flag} ${globus_flavor_flag} \
1378 ${voms_prefix_flag} ${voms_includes_flag} ${voms_libdir_flag} \
1379 ${gridsite_prefix_flag} &&
1380 make && \
1381 make ${DESTDIR_flag} install || return $RC_FAILED
1382 make_dist || return $RC_DISTFAILED
1383 return $RC_SUCCESS
1384 }
1385
1386 # LCAS-LCMAPS GT4 interface:
1387 # Note: only reason for building two extra globus targets
1388 # globus_gridmap_callout_error globus_authz
1389 lcas_lcmaps_gt4_interface() {
1390 compo_lcas_lcmaps_gt4_interface=${compo_lcas_lcmaps_gt4_interface:-lcas-lcmaps-gt4-interface}
1391 cd ${SOURCE}
1392 get lcas_lcmaps_gt4_interface && \
1393 cd ${compo_lcas_lcmaps_gt4_interface} && \
1394 ./bootstrap && \
1395 ./configure ${prefix_flag} ${libdir_flag} ${sysconfdir_flag} \
1396 ${lcas_prefix_flag} ${lcas_includes_flag} ${lcas_libdir_flag} \
1397 ${lcmaps_prefix_flag} ${lcmaps_includes_flag} ${lcmaps_libdir_flag} \
1398 ${globus_prefix_flag} ${globus_flavor_flag} && \
1399 make && \
1400 make ${DESTDIR_flag} install || return $RC_FAILED
1401 make_dist || return $RC_DISTFAILED
1402 return $RC_SUCCESS
1403 }
1404
1405 ##############################################################################
1406 #
1407 # Define all dependency functions, NOTE: the order of the setdeps statements is
1408 # important!
1409 #
1410 ##############################################################################
1411
1412 # GLOBUS: no dependencies
1413 setdeps globus
1414
1415 # VOMS: no longer depends on globus
1416 setdeps voms
1417
1418 # LCMAPS: depends globus, voms
1419 setdeps lcmaps globus voms
1420
1421 # LCMAPS-INTERFACE: no dependencies
1422 setdeps lcmaps_interface
1423
1424 # LCAS: depends globus
1425 setdeps lcas globus
1426
1427 # LCAS-INTERFACE: no dependencies
1428 setdeps lcas_interface
1429
1430 # GLEXEC: depends lcmaps_interface
1431 setdeps glexec lcmaps_interface
1432
1433 # LCMAPS PLUGINS BASIC: depends lcmaps-interface
1434 setdeps lcmaps_plugins_basic lcmaps_interface
1435
1436 # LCMAPS PLUGINS VERIFY-PROXY: depends lcmaps-interface
1437 setdeps lcmaps_plugins_verify_proxy lcmaps_interface
1438
1439 # LCMAPS PLUGINS VOMS: depends globus, voms, lcmaps-interface
1440 setdeps lcmaps_plugins_voms globus voms lcmaps_interface
1441
1442 # LCMAPS PLUGINS AFS: depends lcmaps-interface
1443 setdeps lcmaps_plugins_afs globus lcmaps_interface
1444
1445 # LCMAPS PLUGINS GUMS: depends lcmaps-interface
1446 setdeps lcmaps_plugins_gums lcmaps_interface
1447
1448 # PEP-C LIB: no dependencies
1449 setdeps pep_api
1450
1451 # LCMAPS PLUGINS C-PEP: depends pep-c lib, lcmaps-interface
1452 setdeps lcmaps_plugins_c_pep pep_api lcmaps_interface
1453
1454 # Jobrepository: no dependencies
1455 setdeps jobrep_api
1456
1457 # LCMAPS PLUGINS JOBREP: depends jobrepository lib, lcmaps-interface
1458 setdeps lcmaps_plugins_jobrep jobrep_api globus lcmaps_interface
1459
1460 # SAML2XACML2 LIB: no dependencies
1461 setdeps saml2_xacml2_c_lib
1462
1463 # LCMAPS PLUGINS SCAS CLIENT: depends saml2-xacml2-c-lib, lcmaps-interface
1464 setdeps lcmaps_plugins_scas_client saml2_xacml2_c_lib lcmaps_interface
1465
1466 # SCAS: depends saml2-xacml2-c-lib, lcmaps, lcas
1467 setdeps scas saml2_xacml2_c_lib lcmaps lcas
1468
1469 # EES: depends saml2-xacml2-c-lib
1470 setdeps ees saml2_xacml2_c_lib
1471
1472 # LCAS PLUGINS BASIC: depends globus, lcas-interface
1473 setdeps lcas_plugins_basic globus lcas_interface
1474
1475 # LCAS PLUGINS CHECK-EXECUTABLE: depends globus, lcas-interface
1476 setdeps lcas_plugins_check_executable globus lcas_interface
1477
1478 # GRIDSITE Core:
1479 setdeps gridsite
1480
1481 # LCAS PLUGINS VOMS: depends globus, voms, gridsite-core, lcas-interface
1482 setdeps lcas_plugins_voms globus voms gridsite lcas_interface
1483
1484 # LCAS-LCMAPS GT4 interface: depends globus, lcmaps, common-cpp, lcas, lcas-interface
1485 setdeps lcas_lcmaps_gt4_interface globus lcmaps lcas
1486
1487 ##############################################################################
1488 #
1489 # Build all tools, taking care of dependencies
1490 #
1491 ##############################################################################
1492
1493 # Now that we know all the targets, we can print usage if requested
1494 if [ "$USAGE" -eq 1 ];then
1495 usage
1496 myexit 0
1497 fi
1498
1499 # If we just wanted platform help, print it now
1500 if [ "$PLATFORM" = "help" ];then
1501 globus_etics_platform
1502 myexit 0
1503 fi
1504
1505 # Check source directory...
1506 if [ "`echo $SOURCE|cut -c1`" != "/" ];then
1507 SOURCE="`pwd`/$SOURCE"
1508 warning "Making source directory absolute: $SOURCE"
1509 fi
1510
1511 # When using a file: get targets also from there (instead of only using $*)
1512 TARGETS=""
1513 if [ -n "$TARGETFILE" ];then
1514 # remove everything starting with # (better not # in names...)
1515 TARGETS="`sed 's/#.*$//' $TARGETFILE`"
1516 fi
1517 # If we put something in it:
1518 if [ -n "$TARGETS" ];then
1519 TARGETS="$TARGETS $*"
1520 else
1521 TARGETS="$*"
1522 fi
1523
1524 # Check if anything needs doing...
1525 if [ -z "$TARGETS" ];then
1526 echo "No targets specified, nothing to be done."
1527 myexit 0
1528 fi
1529
1530 # Setup file to save the failed targets into.
1531 if [ -z "$NEWTARGETFILE" ];then
1532 NEWTARGETFILE=$SOURCE/$NEWTARGETFILE_DEFAULT
1533 fi
1534
1535 # Setup myDISTDIR
1536 if [ -z "$myDISTDIR" ];then
1537 myDISTDIR=$SOURCE
1538 fi
1539
1540 # Make sure we have an (empty) temp file
1541 touch $NEWFLAGFILE_TMP
1542 # Setup configure flags specified in file
1543 if [ -n "$FLAGFILE" ];then
1544 lines=`cat $FLAGFILE|wc -l`
1545 lineno=0
1546 while [ $lineno -lt $lines ];do
1547 lineno=`expr $lineno + 1`
1548 line=`sed -n ${lineno}p $FLAGFILE|sed 's/#.*$//'`
1549 if [ -n "$line" ];then
1550 parse_flag "$line"
1551 fi
1552 done
1553 fi
1554
1555 # Setup configure flags specified on cmdline
1556 if [ -n "$FLAGS" ];then
1557 for i in `echo "$FLAGS"`;do
1558 parse_flag $i
1559 done
1560 fi
1561
1562 # Setup file to save the failed targets into.
1563 if [ -z "$NEWFLAGFILE" ];then
1564 NEWFLAGFILE=$SOURCE/$NEWFLAGFILE_DEFAULT
1565 fi
1566
1567 # Find suitable download command
1568 get_download_cmd
1569
1570 # Parse the config options
1571 parse_config
1572
1573 # Figure out the build targets
1574 # Check for special build all target and make all unique
1575 # - substitute 'all' -> $known_targets
1576 # - re-uniquefy
1577 # - remove empty lines
1578 reqs=`echo "$TARGETS"|tr ' ' '\n'|sed "s/^all$/$known_targets/"|tr ' ' '\n'|sort -u|grep -v '^$'`
1579
1580 # loop over all known targets and pick out the requested ones
1581 build_targets=""
1582 for known in `echo $known_targets|tr ' ' '\n'`;do
1583 reqs_new=`echo $reqs|tr ' ' '\n'|grep -v "^$known$"`
1584 # if different, we have a match
1585 if [ "$reqs_new" != "$reqs" ];then
1586 reqs=$reqs_new
1587 build_targets=`echo $build_targets $known`
1588 fi
1589 done
1590 # Anything left is unknown target...
1591 if [ -n "$reqs" ];then
1592 error "Unknown target(s): $reqs"
1593 fi
1594
1595 DISTFAILED=0
1596 MISSING=0
1597 FAILED=0
1598 # Anything to be done?
1599 if [ -n "$build_targets" ];then
1600 # create the source dir
1601 mkdir -p ${SOURCE} || error "Creating of ${SOURCE} FAILED"
1602
1603 # Get globus_flavour just in case we won't build. If it will be build, it
1604 # will be reset afterwards.
1605 globus_flavour
1606
1607 # Do the builds and print results
1608 if [ -z "$STDOUT" ];then
1609 if [ -z "$STDERR" ];then
1610 build
1611 else
1612 build 2> $STDERR
1613 fi
1614 else
1615 if [ -z "$STDERR" ];then
1616 build > $STDOUT
1617 else
1618 build > $STDOUT 2> $STDERR
1619 fi
1620 fi
1621 fi
1622
1623 myexit `expr $DISTFAILED + $MISSING + $FAILED`

Properties

Name Value
svn:executable *

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