/[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 2205 - (show annotations) (download) (as text)
Thu Feb 24 10:06:22 2011 UTC (10 years, 11 months ago) by msalle
File MIME type: application/x-shellscript
File size: 51018 byte(s)
Make failing dist tarball creation a non-fatal and separate error.
Hence dependencies can still be successful. It will still be added to the failed
components file to ease rebuilding.
Also update the default svn root to the non-https Nikhef ndpf svn.

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

Properties

Name Value
svn:executable *

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