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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2115 - (show annotations) (download) (as text)
Wed Dec 1 15:12:20 2010 UTC (11 years, 1 month ago) by msalle
File MIME type: application/x-shellscript
File size: 36436 byte(s)
- new local function copy_files: srcdir targetdir files, only copies files when
  targetdir/file doesn't yet exist.


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.1.1-1
15
16 SOURCE_DEFAULT=/tmp/source # Where to download sources
17 BUILD_DEFAULT=/tmp/build # Where to install binaries
18
19 webcvs=http://glite.cvs.cern.ch/cgi-bin/glite.cgi/ # Web CVS location
20 globus_baseurl=http://www.globus.org/ftppub/ # Base for globus tarball
21 globus_flav=unset
22
23 # Valid return codes: anything less than RC_FAILED is non-blocking
24 RC_SUCCESS=0
25 RC_SKIPPED=1
26 RC_FAILED=2
27 RC_MISSDEP=4
28
29 # Set defaults
30 PROG=`basename $0`
31 DEPEND=1 # Do dependency checks when building all
32 REMOVE=0 # Do NOT remove directories before downloading etc.
33 EXIT_ON_ERROR=0 # Continue on failing target
34 USAGE=0 # printing of usage is not a default (-;
35 CONFIG="" # No default configuration file
36 STDOUT="" # No file for stdout
37 STDERR="" # No file for stderr
38 PLATFORM="" # No default platform (only used for globus from etics)
39 SOURCE="$SOURCE_DEFAULT" # where to download sources
40 BUILD="$BUILD_DEFAULT" # where to install binaries
41
42 # Define error function
43 error() {
44 echo "$PROG: $*" >&2
45 exit 1
46 }
47
48 # Define warning function
49 warning() {
50 echo "$PROG: $*" >&2
51 }
52
53 # Parse command line options
54 while getopts ":c:i:s:b:g:dhrxo:e:p:v" i ; do
55 case "$i" in
56 c) CONFIG="$OPTARG" ;;
57 i) INPUT="$OPTARG" ;;
58 s) SOURCE="$OPTARG" ;;
59 b) BUILD="$OPTARG" ;;
60 g) GLOBUS="$OPTARG" ;;
61 d) DEPEND=0 ;;
62 h) USAGE=1 ;;
63 r) REMOVE=1 ;;
64 x) EXIT_ON_ERROR=1 ;;
65 o) STDOUT="$OPTARG" ;;
66 e) STDERR="$OPTARG" ;;
67 p) PLATFORM="$OPTARG" ;;
68 v) echo "$PROG version: $VERSION"
69 exit 0 ;;
70 :) echo "$PROG: option requires an argument -- '$OPTARG'" >&2
71 echo "Try \`$PROG -h' for more information." >&2
72 exit 1 ;;
73 \?) echo "$PROG: invalid option -- '$OPTARG'" >&2
74 echo "Try \`$PROG -h' for more information." >&2
75 exit 1 ;;
76 esac
77 done
78 shift `expr $OPTIND - 1`
79
80 # Check source/build directories...
81 if [ "`echo $SOURCE|cut -c1`" != "/" ];then
82 SOURCE="`pwd`/$SOURCE"
83 warning "Making source directory absolute: $SOURCE"
84 fi
85 if [ "`echo $BUILD|cut -c1`" != "/" ];then
86 BUILD="`pwd`/$BUILD"
87 warning "Making build directory absolute: $BUILD"
88 fi
89 globus=${GLOBUS:-${BUILD}/globus} # Where to install/find globus
90 gridsite=${BUILD}/gridsite # Where to install/find gridsite
91 glite=${BUILD}/glite # Where to find glite builds
92 # Check globus directory...
93 if [ "`echo $globus|cut -c1`" != "/" ];then
94 globus="`pwd`/$globus"
95 warning "Making globus directory absolute: $globus"
96 fi
97
98 prefix=${glite} # Where to install glite builds
99
100 # When using a file: get targets from there, otherwise use $*
101 if [ -n "$INPUT" ];then
102 # remove everything starting with # (better not # in names...)
103 targets="`sed 's/#.*$//' $INPUT` $*"
104 else
105 targets="$*"
106 fi
107
108 # Check we don't have duplicates!
109 duplicates=`echo $targets|tr ' ' '\n'|sort|uniq -d|tr '\n' ' '`
110 if [ -n "$duplicates" ];then
111 error "Duplicate targets defined: $duplicates"
112 fi
113
114
115 ##############################################################################
116 # Convenience functions
117 ##############################################################################
118
119
120 # Prints usage message
121 usage() {
122 echo "Usage: `basename $0` [options] [targets]"
123 echo
124 echo "Options:"
125 echo " -c <config> get build options from config file."
126 echo " -i <file> get targets from file, any targets on the cmdline"\
127 "are added."
128 echo " -s specify directory where to checkout sources,"
129 echo " default ${SOURCE_DEFAULT}"
130 echo " -b specify install directory,"\
131 "default ${BUILD_DEFAULT}"
132 echo " -g specify globus directory,"\
133 "default ${BUILD_DEFAULT}/globus"
134 echo " -d don't check dependencies."
135 echo " -r remove (old) source directories before checkout."
136 echo " -x exit on first failing target (default continue)."
137 echo " -o <file> send checkout/build stdout to given file."
138 echo " -e <file> send checkout/build stderr to given file."
139 echo " -p <platform> download globus for this platform from etics/VDT"\
140 "instead of"
141 echo " building from source, \"-p help\" prints"\
142 "valid options."
143 echo " -h show this helptext."
144 echo
145 echo "Exit values:"
146 echo " 1 non-build related error"
147 echo " $RC_FAILED at least one build failed, but no failed dependencies"
148 echo " $RC_MISSDEP at least one build missed dependencies, but no build"\
149 "failed"
150 echo " `expr $RC_FAILED + $RC_MISSDEP` at least one build failed and at"\
151 "least on build missed dependencies"
152 echo
153 echo "Format for config file:"
154 echo "<target> [tag:<value>] [compo:<value>] [cvsroot:<value>]"\
155 "[svnroot:<value>] [coopts:<value>]"
156 echo "where"
157 echo " tag specifies CVS or SVN tag"
158 echo " compo specifies glite component name"\
159 "(e.g. org.glite.security.voms)"
160 echo " cvsroot specifies CVSROOT, when empty use CERN webcvs"
161 echo " svnroot specifies full SVN URL (including component)"
162 echo " coopts specifies checkout options for CVS/SVN"
163 echo "A configline can be continued using the \\ char."
164 echo "After a # the remainder of the line is ignored."
165 echo "SVN will only be used if cvsroot is unset AND svnroot is set."
166 echo "coopts are inserted after the checkout command for cvs or svn."
167 echo
168 echo "Notes:"
169 echo "1. when the special target all is specified,"\
170 "all known targets are built."
171 echo "2. targets are build in the specified order, first those in a"\
172 "optional input"
173 echo " file, then those on the command line."
174 echo "3. when checking dependencies, only dependencies which are"\
175 "actually being"
176 echo " build will be checked."
177 echo
178 echo "Known targets:"
179 for target in $known_targets;do
180 echo " $target"
181 done
182 echo
183 return $RC_SUCCESS
184 }
185
186 # Function which is used to create the dependency checking functions.
187 # arguments:
188 # $1 - target
189 # $2... - dependencies
190 setdeps() {
191 if [ $# -eq 0 ];then
192 echo "Error: $0 needs at least one argument." >&2
193 return $RC_FAILED
194 fi
195
196 # target
197 target=$1; shift
198 known_targets="$known_targets $target"
199
200 eval rc_$target=$RC_SKIPPED
201
202 depstring=""
203 # Only when we DO want dependency checking...
204 if [ $DEPEND -eq 1 ];then
205 while [ $# -gt 0 ];do
206 # Use RC_FAILED as default for rc_$1 in case it's not defined
207 depstring="$depstring \${rc_$1:-\$RC_FAILED} -lt \$RC_FAILED"
208 shift
209 if [ $# -gt 0 ];then
210 depstring="$depstring -a"
211 fi
212 done
213 fi
214
215 # define the dep_ function
216 if [ -n "$depstring" ];then
217 eval "dep_$target() {
218 if [ $depstring ];then
219 $target
220 rc_$target=\$?
221 else
222 rc_$target=\$RC_MISSDEP
223 fi
224 return \$rc_$target
225 }"
226 else
227 eval "dep_$target() {
228 $target
229 rc_$target=\$?
230 return \$rc_$target
231 }"
232 fi
233 }
234
235 # function to get a suitable download command with cmdline args. The result will
236 # be in variable $wget
237 # Expected format:
238 # $wget $URL > $outputfile
239 get_download_cmd() {
240 func=get_downloadcmd
241 if which wget > /dev/null 2> /dev/null;then
242 wget="wget -nv -O -"
243 elif which curl > /dev/null 2> /dev/null;then
244 wget="curl -s"
245 elif which lynx > /dev/null 2> /dev/null;then
246 wget="lynx -dump -source"
247 else
248 error "$func: Cannot find download tool such as wget, curl, lynx etc."
249 fi
250 }
251
252 # function that parses the CONFIG file and sets all the tag_ compo_ cvsroot_
253 # svnroot_ variables
254 # We cannot use subshells in order to get the vars in the current shell, which
255 # sometimes obfuscates the code a bit.
256 parse_config() {
257 lines=`cat $CONFIG|wc -l`
258 lineno=0
259 line=""
260 cont=0
261 while [ $lineno -lt $lines ];do
262 lineno=`expr $lineno + 1`
263 readline=`sed -n ${lineno}p $CONFIG`
264 # replace trailing [whitespace] \ [whitespace] by a single space
265 subline=`echo "${readline}"|sed 's/[ \t]*\\\[ \t]*$/ /'`
266 line="${line}${subline}"
267 # Continue when continuation char, empty line, or comment line
268 if [ "$subline" != "$readline" ];then
269 cont=1
270 continue
271 fi
272 # line is ready, parse the components
273 first=1
274 for field in `echo $line`;do
275 # first char == '#' ? then go to next line
276 [ "`echo "$field"|cut -c1`" = '#' ] && break
277 # Now differentiate between first compo and others
278 if [ $first -eq 1 ];then
279 name=$field
280 # Make sure we reset the variables
281 eval "tag_$name=\"\""
282 eval "compo_$name=\"\""
283 eval "cvsroot_$name=\"\""
284 eval "svnroot_$name=\"\""
285 eval "coopts_$name=\"\""
286 first=0
287 else
288 case "$field" in
289 tag:*) eval tag_$name=\$\{field#tag:\} ;;
290 compo:*) eval compo_$name=\$\{field#compo:\} ;;
291 cvsroot:*) eval cvsroot_$name=\$\{field#cvsroot:\} ;;
292 svnroot:*) eval svnroot_$name=\$\{field#svnroot:\} ;;
293 coopts:) eval coopts_$name=\$\{field#coopts:\} ;;
294 esac
295 fi
296 done
297 # reset line and cont
298 line=""
299 cont=0
300 done
301 if [ $cont -ne 0 ];then
302 error "Unexpected end of file while parsing $CONFIG"
303 fi
304 }
305
306 # cvs checkout wrapper: a wget + untar is much faster than anonymous cvs
307 # checkout, especially due to a 30 sec. timeout of the CVS server.
308 cvsget() {
309 name="$1"
310 dir="$2"
311 [ -z "$name" ] && return $RC_FAILED
312 eval compo=\$\{compo_$name\}
313 eval tag=\$\{tag_$name\}
314 eval cvsroot=\$\{cvsroot_$name\}
315 eval coopts=\$\{coopts_$name\}
316 if [ -n "$cvsroot" ];then
317 # optionally remove directory
318 [ $REMOVE -eq 1 ] && rm -rf ${dir:-$compo}
319 # use cvs checkout
320 cvs -d $cvsroot co $coopts \
321 ${tag:+-r $tag} \
322 ${dir:+-d $dir} $compo || return $RC_FAILED
323 else
324 # Use tarball installation: always remove old dir
325 rm -rf ${dir:-$compo}
326 url="${webcvs}${compo}.tar.gz?view=tar${tag:+&pathrev=$tag}"
327 # If custom directory: download in tmpdir and later move to dir
328 if [ -n "$dir" ];then
329 tmpdir=tmpdir.$$
330 mkdir ${tmpdir} && cd ${tmpdir} || return $RC_FAILED
331 fi
332 # Retrieve tarball and untar on the fly
333 eval "${wget} \"$url\"" | tar -zvxf - || return $RC_FAILED
334 # Move downloaded dir into $dir and cleanup
335 if [ -n "$dir" ];then
336 cd .. && \
337 mv ${tmpdir}/${compo} $dir && \
338 rmdir ${tmpdir} || return $RC_FAILED
339 unset tmpdir
340 fi
341 fi
342
343 return $RC_SUCCESS
344 }
345
346 # svn checkout wrapper
347 svnget() {
348 name="$1"
349 dir="$2"
350 [ -z "$name" ] && return $RC_FAILED
351 eval compo=\$\{compo_$name\}
352 eval tag=\$\{tag_$name\}
353 eval svnroot=\$\{svnroot_$name\}
354 eval coopts=\$\{coopts_$name\}
355 realdir=${dir:-$compo}
356 # optionally remove directory
357 [ $REMOVE -eq 1 ] && rm -rf ${realdir}
358 svn co $coopts ${svnroot}${tag} ${realdir} || return $RC_FAILED
359 unset realdir
360
361 return $RC_SUCCESS
362 }
363
364 # general cvs and svn wrapper: use svn ONLY when cvsroot is NOT defined AND
365 # svnroot is defined. In all other cases, use cvsroot
366 get() {
367 name="$1"
368 dir="$2"
369 [ -z "$name" ] && return $RC_FAILED
370 eval cvsroot=\$\{cvsroot_$name\}
371 eval svnroot=\$\{svnroot_$name\}
372 if [ -z "$cvsroot" -a -n "$svnroot" ] ; then
373 svnget $name $dir
374 else
375 cvsget $name $dir
376 fi
377 return $?
378 }
379
380 # Copy function to copy
381 copy_files() {
382 src=$1; dst=$2;
383 [ -z "$src" -o -z "$dst" ] && return $RC_FAILED
384 shift; shift;
385 for file in $* ; do
386 if [ ! -e ${dst}/$file ];then
387 cp -p ${src}/$file $dst || return $RC_FAILED
388 fi
389 done
390 return $RC_SUCCESS
391 }
392
393 # Print function for results:
394 # $1 - name of component, result is in $rc_<name of component>
395 print_result() {
396 tool=$1
397 eval rc=\$rc_$tool
398 [ "$rc" = "$RC_SKIPPED" ] && return
399 case "$rc" in
400 $RC_SUCCESS) result="SUCCESS" ;;
401 $RC_MISSDEP) result="MISSING DEPS"
402 MISSING=$RC_MISSDEP ;;
403 $RC_FAILED) result="FAILED"
404 FAILED=$RC_FAILED ;;
405 *) result="UNKNOWN: $rc" ;;
406 esac
407 printf "%-30s: %s\n" "$tool" "$result"
408 }
409
410 # Build the targets and print the results
411 build() {
412 t0=`date +%s`
413 # build the targets
414 for target in $build_targets;do
415 eval dep_$target
416 [ $EXIT_ON_ERROR -eq 1 -a $? -ge $RC_FAILED ] && break
417 done
418 t1=`date +%s`
419
420 # Print results
421 for target in $known_targets;do
422 print_result $target
423 done
424 echo "Total build time: `expr $t1 - $t0` seconds"
425 }
426
427 ##############################################################################
428 #
429 # Define all building functions
430 #
431 ##############################################################################
432
433 # GLOBUS
434
435
436 # print known platforms for globus tarball
437 globus_etics_platform() {
438 echo "Valid platforms are:"
439 echo " RH4_32"
440 echo " RH5_64"
441 echo " SUSE11_64"
442 echo " Deb5_64"
443 }
444
445 # globus from VDT/etics tarball
446 globus_etics() {
447 # Find correct globus for platform
448 case "$PLATFORM" in
449 RH4_32)
450 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.3-VDT-1.6.1/slc4_ia32_gcc346/
451 globus_tgz=globus-4.0.3-VDT-1.6.1-7.tar.gz
452 globus_flav=gcc32dbg
453 ;;
454 RH5_64)
455 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.7-VDT-1.10.1/sl5_x86_64_gcc412/
456 globus_tgz=globus-4.0.7-VDT-1.10.1-1.tar.gz
457 globus_flav=gcc64dbg
458 ;;
459 SUSE11_64)
460 globus_url=http://eticssoft.web.cern.ch/eticssoft/repository//vdt/globus/4.0.7-VDT-1.10.1/SUSE11_x86_64_gcc432/
461 globus_tgz=globus-4.0.7-VDT-1.10.1-1.tar.gz
462 globus_flav=gcc64dbg
463 ;;
464 Deb5_64)
465 globus_url=http://etics-repository.cern.ch/repository/download/registered/vdt/globus/4.0.8-VDT-2.0.0/deb5_x86_64_gcc432/
466 globus_tgz=globus-4.0.8-VDT-2.0.0-2.tar.gz
467 globus_flav=gcc64dbg
468 ;;
469 *)
470 echo "Unknown platform: \"$PLATFORM\"" >&2
471 globus_etics_platform >&2
472 exit 1
473 ;;
474 esac
475
476 # Now download, unpack, and update the tarball
477 cd ${SOURCE}
478 mkdir -p ${globus} && \
479 eval ${wget} ${globus_url}${globus_tgz} > ${globus_tgz} && \
480 tar -C ${globus} -zxf ${globus_tgz} && \
481 cd ${globus} && \
482 find -type f -name \*.la|while read file;do
483 sed s+/opt/globus+${globus}+g ${file} > ${file}.new && \
484 mv -f ${file}.new ${file}
485 done || return $RC_FAILED
486
487 return $RC_SUCCESS
488 }
489
490 # globus directly from source tarball
491 globus_source() {
492 tag=${tag_globus:-4.0.8}
493 major=`echo $tag|cut -d. -f1`
494 minor=`echo $tag|cut -d. -f2`
495 # Where to get which globus toolkit tarball
496 globus_url=${globus_baseurl}gt${major}/${major}.${minor}/${tag}/installers/src/
497 globus_tbz=gt${tag}-all-source-installer.tar.bz2
498 globus_srcdir=`basename ${globus_tbz} .tar.bz2`
499
500 # Note: making globus_gridmap_callout_error globus_authz only needed for gt4
501 # interface.
502 cd ${SOURCE}
503 eval ${wget} ${globus_url}${globus_tbz} > ${globus_tbz} && \
504 tar -jxf ${globus_tbz} && \
505 cd ${globus_srcdir} && \
506 ./configure --prefix=${globus} \
507 --disable-gridftp --disable-gsiopenssh --disable-myproxy \
508 --disable-rls --disable-drs --disable-rendezvous \
509 --disable-tests --disable-prewsgram --disable-wsgram \
510 --disable-wsjava --disable-wsc --disable-wsmds --disable-wsdel \
511 --disable-wsrft --disable-wscas --disable-wstests \
512 --disable-webmds && \
513 make globus-gsi globus_gridmap_callout_error globus_authz && \
514 make install || return $RC_FAILED
515
516 # (re)evaluate globus flavour
517 globus_flavour
518 if [ $? -eq $RC_FAILED ];then
519 echo "ERROR: Cannot determine globus flavour." >&2
520 echo " Check ${globus}/etc/globus_core/*.gpt" >&2
521 return $RC_FAILED
522 fi
523 return $RC_SUCCESS
524 }
525
526 # Set correct globus flavour
527 globus_flavour() {
528 if [ -n "$PLATFORM" ];then
529 case "$PLATFORM" in
530 RH4_32) globus_flav=gcc32dbg ;;
531 RH5_64) globus_flav=gcc64dbg ;;
532 SUSE11_64) globus_flav=gcc64dbg ;;
533 Deb5_64) globus_flav=gcc64dbg ;;
534 *) echo "Unknown platform: \"$PLATFORM\"" >&2
535 return $RC_FAILED ;;
536 esac
537 else
538 if [ -f "${globus}/etc/globus_core/flavor_gcc64dbg.gpt" ];then
539 globus_flav=gcc64dbg
540 elif [ -f "${globus}/etc/globus_core/flavor_gcc64.gpt" ];then
541 globus_flav=gcc64
542 elif [ -f "${globus}/etc/globus_core/flavor_gcc32dbg.gpt" ];then
543 globus_flav=gcc32dbg
544 elif [ -f "${globus}/etc/globus_core/flavor_gcc32.gpt" ];then
545 globus_flav=gcc32
546 else
547 return $RC_FAILED
548 fi
549 fi
550 return $RC_SUCCESS
551 }
552
553 # wrapper function that either does a source download or etics download
554 globus() {
555 if [ -z "$PLATFORM" ];then
556 globus_source
557 else
558 globus_etics
559 fi
560 }
561
562 # VOMS development version, directly from CNAF via git, for OpenSSL1.0
563 voms_git() {
564 compo_voms=${compo_voms:-org.glite.security.voms}
565 cd ${SOURCE}
566 git clone -n git://testbed002.cnaf.infn.it/opt/gits/voms.git $compo_voms && \
567 cd ${compo_voms} && \
568 git checkout fedora13 && \
569 ./autogen.sh && \
570 ./configure --prefix=${prefix} --disable-java --with-api-only && \
571 make && \
572 make install || return $RC_FAILED
573 return $RC_SUCCESS
574 }
575
576 # VOMS development version, directly from CNAF
577 voms_devel() {
578 compo_voms=${compo_voms:-org.glite.security.voms}
579 cd ${SOURCE}
580 echo "t" | svn co --no-auth-cache --username anonymous --password anonymous https://svn.forge.cnaf.infn.it/svn/voms/voms/branches/voms-2-0-series org.glite.security.voms && \
581 cd ${compo_voms} && \
582 ./autogen.sh && \
583 ./configure --prefix=${prefix} --with-globus-prefix=${globus} \
584 --disable-java --with-api-only && \
585 make && \
586 make install || return $RC_FAILED
587 return $RC_SUCCESS
588 }
589
590 # VOMS: (C & C++ API only)
591 voms() {
592 if [ "$tag_voms" = "devel" ];then
593 voms_devel
594 return $?
595 elif [ "$tag_voms" = "git" ];then
596 voms_git
597 return $?
598 fi
599 compo_voms=${compo_voms:-org.glite.security.voms}
600 cd ${SOURCE}
601 get voms && \
602 cd ${compo_voms} && \
603 ./configure --prefix=${prefix} --with-globus-prefix=${globus} \
604 --disable-java --with-api-only && \
605 make && \
606 make install || return $RC_FAILED
607 return $RC_SUCCESS
608 }
609
610 # BUILD COMMON-CPP:
611 common_cpp() {
612 compo_common_cpp=${compo_common_cpp:-org.glite.build.common-cpp}
613 cd ${SOURCE}
614 get common_cpp || return $RC_FAILED
615 return $RC_SUCCESS
616 }
617
618 # LCMAPS: Note we can always use the un-threaded flavor for both
619 lcmaps() {
620 compo_lcmaps=${compo_lcmaps:-org.glite.security.lcmaps}
621 cd ${SOURCE}
622 get lcmaps && \
623 cd ${compo_lcmaps} && \
624 copy_files ../${compo_common_cpp}/m4 ./project \
625 globus.m4 glite.m4 glite_security.m4 lcmaps.m4 && \
626 ./bootstrap && \
627 ./configure --prefix=${prefix} --with-glite-location=${glite} \
628 --with-globus-prefix=${globus} \
629 --with-globus-thr-flavor=${globus_flav} \
630 --with-globus-nothr-flavor=${globus_flav} \
631 --with-gsi-mode && \
632 make && \
633 make install || return $RC_FAILED
634 return $RC_SUCCESS
635 }
636
637 # LCMAPS-INTERFACE:
638 lcmaps_interface() {
639 dir=org.glite.security.lcmaps-interface
640 compo_lcmaps_interface=${compo_lcmaps_interface:-org.glite.security.lcmaps}
641 cd ${SOURCE}
642 get lcmaps_interface $dir && \
643 cd ${dir} && \
644 copy_files ../${compo_common_cpp}/m4 ./project \
645 globus.m4 glite.m4 glite_security.m4 lcmaps.m4 && \
646 ./bootstrap && \
647 ./configure --prefix=${prefix} --with-glite-location=${glite} \
648 --with-gsi-mode --enable-headers && \
649 make && \
650 make install || return $RC_FAILED
651 return $RC_SUCCESS
652 }
653
654 # LCAS:
655 lcas() {
656 compo_lcas=${compo_lcas:-org.glite.security.lcas}
657 cd ${SOURCE}
658 get lcas && \
659 cd ${compo_lcas} && \
660 copy_files ../${compo_common_cpp}/m4 ./project \
661 /glite.m4 globus.m4 lcmaps.m4 && \
662 ./bootstrap && \
663 ./configure --prefix=${prefix} --with-glite-location=${glite} \
664 --with-globus-prefix=${globus} \
665 --with-globus-thr-flavor=${globus_flav}pthr \
666 --with-globus-nothr-flavor=${globus_flav} && \
667 make && \
668 make install || return $RC_FAILED
669 return $RC_SUCCESS
670 }
671
672 # LCAS-INTERFACE:
673 lcas_interface() {
674 compo_lcas_interface=${compo_lcas_interface:-org.glite.security.lcas-interface}
675 cd ${SOURCE}
676 get lcas_interface && \
677 cd ${compo_lcas_interface} && \
678 copy_files ../${compo_common_cpp}/m4 ./project glite.m4 && \
679 ./bootstrap && \
680 ./configure --prefix=${prefix} && \
681 make install || return $RC_FAILED
682 return $RC_SUCCESS
683 }
684
685 # glexec old style (pre 0.8)
686 # GLEXEC: extra LDFLAG needed (only) for certain platforms, incl Debian-5 64
687 glexec_pre08() {
688 compo_glexec=${compo_glexec:-org.glite.security.glexec}
689 cd ${SOURCE}
690 get glexec && \
691 cd ${compo_glexec} && \
692 cp -fp ../org.glite.build.common-cpp/m4/glite.m4 \
693 ../org.glite.build.common-cpp/m4/globus.m4 \
694 ../org.glite.build.common-cpp/m4/lcmaps.m4 ./project && \
695 ./bootstrap && \
696 LDFLAGS="-Wl,-rpath -Wl,${globus}/lib" \
697 ./configure --prefix=${prefix} \
698 --with-glite-location=${glite} \
699 --with-globus-prefix=${globus} \
700 --with-globus-thr-flavor=${globus_flav}pthr \
701 --with-globus-nothr-flavor=${globus_flav} && \
702 make && \
703 make install || return $RC_FAILED
704 return $RC_SUCCESS
705 }
706
707 # glexec, check if it is old or new style: in case old style, use glexec_pre08
708 # instead
709 glexec() {
710 oldglexec=`echo $tag_glexec|grep '^glite-security-glexec_R_0_[0-7]'`
711 if [ -n "$oldglexec" ];then
712 glexec_pre08
713 return $?
714 fi
715 # Remainder is glexec >=0.8
716 compo_glexec=${compo_glexec:-org.glite.security.glexec}
717 cd ${SOURCE}
718 get glexec && \
719 cd ${compo_glexec} && \
720 copy_files ../${compo_common_cpp}/m4 ./project glite.m4 && \
721 ./bootstrap && \
722 ./configure --prefix=${prefix} --with-glite-location=${glite} && \
723 make && \
724 make install || return $RC_FAILED
725 return $RC_SUCCESS
726 }
727
728 # LCMAPS PLUGINS BASIC:
729 lcmaps_plugins_basic() {
730 compo_lcmaps_plugins_basic=${compo_lcmaps_plugins_basic:-org.glite.security.lcmaps-plugins-basic}
731 cd ${SOURCE}
732 get lcmaps_plugins_basic && \
733 cd ${compo_lcmaps_plugins_basic} && \
734 copy_files ../${compo_common_cpp}/m4 ./project \
735 glite.m4 globus.m4 lcmaps.m4 gridlist.m4 && \
736 ./bootstrap && \
737 ./configure --prefix=${prefix} --with-glite-location=${glite} \
738 --with-globus-prefix=${globus} \
739 --with-globus-thr-flavor=${globus_flav}pthr \
740 --with-globus-nothr-flavor=${globus_flav} && \
741 make && \
742 make install || return $RC_FAILED
743 return $RC_SUCCESS
744 }
745
746 # LCMAPS PLUGINS VERIFY-PROXY:
747 lcmaps_plugins_verify_proxy() {
748 compo_lcmaps_plugins_verify_proxy=${compo_lcmaps_plugins_verify_proxy:-org.glite.security.lcmaps-plugins-verify-proxy}
749 cd ${SOURCE}
750 get lcmaps_plugins_verify_proxy && \
751 cd ${compo_lcmaps_plugins_verify_proxy} && \
752 copy_files ../${compo_common_cpp}/m4 ./project \
753 glite.m4 glite_security.m4 && \
754 ./bootstrap && \
755 ./configure --prefix=${prefix} --with-glite-location=${glite} && \
756 make && \
757 make install || return $RC_FAILED
758 return $RC_SUCCESS
759 }
760
761 # LCMAPS PLUGINS VOMS:
762 lcmaps_plugins_voms() {
763 compo_lcmaps_plugins_voms=${compo_lcmaps_plugins_voms:-org.glite.security.lcmaps-plugins-voms}
764 cd ${SOURCE}
765 get lcmaps_plugins_voms && \
766 cd ${compo_lcmaps_plugins_voms} && \
767 copy_files ../${compo_common_cpp}/m4 ./project \
768 glite.m4 glite_security.m4 globus.m4 lcmaps.m4 gridlist.m4 && \
769 ./bootstrap && \
770 ./configure --prefix=${glite} --with-glite-location=${glite} \
771 --with-globus-prefix=${globus} \
772 --with-globus-thr-flavor=${globus_flav}pthr \
773 --with-globus-nothr-flavor=${globus_flav} && \
774 make && \
775 make install || return $RC_FAILED
776 return $RC_SUCCESS
777 }
778
779 # LCMAPS PLUGINS AFS:
780 lcmaps_plugins_afs() {
781 compo_lcmaps_plugins_afs=${compo_lcmaps_plugins_afs:-org.glite.security.lcmaps-plugins-afs}
782 cd ${SOURCE}
783 get lcmaps_plugins_afs && \
784 cd ${compo_lcmaps_plugins_afs} && \
785 copy_files ../${compo_common_cpp}/m4 ./project \
786 /glite.m4 globus.m4 && \
787 ./bootstrap && \
788 ./configure --prefix=${glite} --with-glite-location=${glite} \
789 --with-globus-prefix=${globus} \
790 --with-globus-thr-flavor=${globus_flav}pthr \
791 --with-globus-nothr-flavor=${globus_flav} && \
792 make && \
793 make install || return $RC_FAILED
794 return $RC_SUCCESS
795 }
796
797 # LCMAPS PLUGINS GUMS:
798 lcmaps_plugins_gums() {
799 compo_lcmaps_plugins_gums=${compo_lcmaps_plugins_gums:-org.glite.security.lcmaps-plugins-gums}
800 cd ${SOURCE}
801 get lcmaps_plugins_gums && \
802 cd ${compo_lcmaps_plugins_gums} && \
803 copy_files ../${compo_common_cpp}/m4 ./project \
804 glite.m4 glite_security.m4 globus.m4 && \
805 ./bootstrap && \
806 ./configure --prefix=${glite} --with-glite-location=${glite} \
807 --with-globus-prefix=${globus} \
808 --with-globus-thr-flavor=${globus_flav}pthr \
809 --with-globus-nothr-flavor=${globus_flav} && \
810 make && \
811 make install || return $RC_FAILED
812 return $RC_SUCCESS
813 }
814
815 # PEP-C LIB: Will install in same libdir as LCMAPS
816 pep_c_lib() {
817 compo_pep_c_lib=${compo_pep_c_lib:-org.glite.authz.pep-c}
818 svnroot_pep_c_lib=${svnroot_pep_c_lib:-http://svnweb.cern.ch/guest/glxa/pep-c-lib/tags/}
819 tag_pep_c_lib=${tag_pep_c_lib:-1_3_0}
820 cd ${SOURCE}
821 # Make sure PEP-C is installed in lcmaps directory or else use default.
822 [ -f "${glite}/lib64/liblcmaps.so" ] && \
823 pepclibdir=${glite}/lib64 || \
824 pepclibdir=${glite}/lib
825 get pep_c_lib && \
826 cd ${compo_pep_c_lib} && \
827 ./autotools.sh && \
828 ./configure --prefix=${glite} --libdir=${pepclibdir} && \
829 make && \
830 make html && \
831 make install || return $RC_FAILED
832 return $RC_SUCCESS
833 }
834
835 # LCMAPS PLUGINS C-PEP
836 lcmaps_plugins_c_pep() {
837 compo_lcmaps_plugins_c_pep=${compo_lcmaps_plugins_c_pep:-org.glite.security.lcmaps-plugins-c-pep}
838 cd ${SOURCE}
839 get lcmaps_plugins_c_pep && \
840 cd ${compo_lcmaps_plugins_c_pep} && \
841 copy_files ../${compo_common_cpp}/m4 ./project \
842 glite.m4 glite_security.m4 && \
843 ./bootstrap && \
844 ./configure --prefix=${glite} --with-glite-location=${glite} && \
845 make && \
846 make install || return $RC_FAILED
847 return $RC_SUCCESS
848 }
849
850 # SAML2XACML2 LIB:
851 saml2_xacml2_c_lib() {
852 compo_saml2_xacml2_c_lib=${compo_saml2_xacml2_c_lib:-org.glite.security.saml2-xacml2-c-lib}
853 cd ${SOURCE}
854 export CXXFLAGS="-fPIC ${CXXFLAGS}"
855 get saml2_xacml2_c_lib && \
856 cd ${compo_saml2_xacml2_c_lib} && \
857 copy_files ../${compo_common_cpp}/m4 ./project glite.m4 && \
858 # Only for new style SAML2-XACML2-C-lib do we have gsoap as tarball
859 gsoap_tarball="`ls gsoap-2.7*.tar.gz 2>/dev/null`"
860 if [ -n "$gsoap_tarball" ];then
861 tar -zxf ${gsoap_tarball} || echo $RC_FAILED
862 fi
863 cd gsoap-2.7 && \
864 ../autogen.sh && \
865 ./configure --prefix=${glite} && \
866 make && \
867 make install && \
868 cd ../xacml-1.0 && \
869 ../autogen.sh && \
870 ./configure --prefix=${glite} --with-gsoap=${glite} && \
871 make && \
872 make install || return $RC_FAILED
873 return $RC_SUCCESS
874 }
875
876 # LCMAPS PLUGINS SCAS CLIENT:
877 lcmaps_plugins_scas_client() {
878 compo_lcmaps_plugins_scas_client=${compo_lcmaps_plugins_scas_client:-org.glite.security.lcmaps-plugins-scas-client}
879 cd ${SOURCE}
880 get lcmaps_plugins_scas_client && \
881 cd ${compo_lcmaps_plugins_scas_client} && \
882 copy_files ../${compo_common_cpp}/m4 ./project \
883 glite.m4 glite_security.m4 lcmaps.m4 && \
884 ./bootstrap && \
885 ./configure --prefix=${glite} --with-glite-location=${glite} && \
886 make && \
887 make install || return $RC_FAILED
888 return $RC_SUCCESS
889 }
890
891 # SCAS
892 scas() {
893 compo_scas=${compo_scas:-org.glite.security.scas}
894 cd ${SOURCE}
895 get scas && \
896 cd ${compo_scas} && \
897 copy_files ../${compo_common_cpp}/m4 ./project \
898 globus.m4 glite.m4 glite_security.m4 lcmaps.m4 && \
899 ./bootstrap && \
900 ./configure --prefix=${prefix} --with-glite-location=${glite} \
901 --with-globus-prefix=${globus} \
902 --with-globus-thr-flavor=${globus_flav}pthr \
903 --with-globus-nothr-flavor=${globus_flav} && \
904 make && \
905 make install || return $RC_FAILED
906 return $RC_SUCCESS
907 }
908
909 # EES
910 ees() {
911 compo_ees=${compo_ees:-ees}
912 # If no svn root is given, use the defaults, depending on tag
913 if [ -z "$svnroot_ees" ];then
914 if [ -z "$tag_ees" -o "$tag_ees" = "HEAD" ];then # develop version
915 unset tag_ees
916 svnroot_ees=https://svn@ndpfsvn.nikhef.nl/repos/pdpsoft/trunk/grid-mw-security/ees
917 else
918 svnroot_ees=https://svn@ndpfsvn.nikhef.nl/repos/pdpsoft/tags/
919 fi
920 fi
921 cd ${SOURCE}
922 get ees && \
923 cd ${compo_ees} && \
924 copy_files ../${compo_common_cpp}/m4 ./m4 \
925 glite.m4 glite_security.m4 && \
926 sh ./autogen.sh && \
927 ./configure --prefix=${prefix} --with-glite-location=${glite} \
928 --with-saml2xacml2=${glite} && \
929 make && \
930 make install || return $RC_FAILED
931 return $RC_SUCCESS
932 }
933
934 # LCAS PLUGINS BASIC:
935 lcas_plugins_basic() {
936 compo_lcas_plugins_basic=${compo_lcas_plugins_basic:-org.glite.security.lcas-plugins-basic}
937 cd ${SOURCE}
938 get lcas_plugins_basic && \
939 cd ${compo_lcas_plugins_basic} && \
940 copy_files ../${compo_common_cpp}/m4 ./project \
941 glite.m4 globus.m4 gridlist.m4 && \
942 ./bootstrap && \
943 ./configure --prefix=${glite} --with-glite-location=${glite} \
944 --with-globus-prefix=${globus} \
945 --with-globus-thr-flavor=${globus_flav}pthr \
946 --with-globus-nothr-flavor=${globus_flav} && \
947 make && \
948 make install || return $RC_FAILED
949 return $RC_SUCCESS
950 }
951
952 # LCAS PLUGINS CHECK-EXECUTABLE:
953 lcas_plugins_check_executable() {
954 compo_lcas_plugins_check_executable=${compo_lcas_plugins_check_executable:-org.glite.security.lcas-plugins-check-executable}
955 cd ${SOURCE}
956 get lcas_plugins_check_executable && \
957 cd ${compo_lcas_plugins_check_executable} && \
958 copy_files ../${compo_common_cpp}/m4 ./project \
959 glite.m4 globus.m4 gridlist.m4 && \
960 ./bootstrap && \
961 ./configure --prefix=${glite} --with-glite-location=${glite} \
962 --with-globus-prefix=${globus} \
963 --with-globus-thr-flavor=${globus_flav}pthr \
964 --with-globus-nothr-flavor=${globus_flav} && \
965 make && \
966 make install || return $RC_FAILED
967 return $RC_SUCCESS
968 }
969
970 # GRIDSITE CORE:
971 gridsite_core() {
972 compo_gridsite_core=${compo_gridsite_core:-org.gridsite.core}
973 # Take libdir from lcas
974 [ -f "${glite}/lib64/liblcas.so" ] && \
975 gridsitelibdir=lib64 || \
976 gridsitelibdir=lib
977 cd ${SOURCE}
978 get gridsite_core && \
979 cd ${compo_gridsite_core}/src && \
980 make prefix=${gridsite} libdir=${gridsitelibdir} && \
981 make prefix=${gridsite} install || return $RC_FAILED
982 return $RC_SUCCESS
983 }
984
985 # LCAS PLUGINS VOMS:
986 lcas_plugins_voms() {
987 compo_lcas_plugins_voms=${compo_lcas_plugins_voms:-org.glite.security.lcas-plugins-voms}
988 cd ${SOURCE}
989 get lcas_plugins_voms && \
990 cd ${compo_lcas_plugins_voms} && \
991 copy_files ../${compo_common_cpp}/m4 ./project \
992 glite.m4 glite_security.m4 globus.m4 gridsite.m4 gridlist.m4 && \
993 ./bootstrap && \
994 ./configure --prefix=${glite} --with-glite-location=${glite} \
995 --with-globus-prefix=${globus} \
996 --with-globus-thr-flavor=${globus_flav}pthr \
997 --with-globus-nothr-flavor=${globus_flav} \
998 --with-gridsite-prefix=${gridsite} \
999 --with-gridsite-ssl=system && \
1000 make && \
1001 make install || return $RC_FAILED
1002 return $RC_SUCCESS
1003 }
1004
1005 # LCAS-LCMAPS GT4 interface:
1006 # Note: only reason for building two extra globus targets
1007 # globus_gridmap_callout_error globus_authz
1008 lcas_lcmaps_gt4_interface() {
1009 compo_lcas_lcmaps_gt4_interface=${compo_lcas_lcmaps_gt4_interface:-org.glite.security.lcas-lcmaps-gt4-interface}
1010 cd ${SOURCE}
1011 get lcas_lcmaps_gt4_interface && \
1012 cd ${compo_lcas_lcmaps_gt4_interface} && \
1013 copy_files ../${compo_common_cpp}/m4 ./project \
1014 glite.m4 globus.m4 lcmaps.m4 && \
1015 ./bootstrap && \
1016 ./configure --prefix=${prefix} \
1017 --with-glite-location=${glite} \
1018 --with-globus-prefix=${globus} \
1019 --with-globus-thr-flavor=${globus_flav}pthr \
1020 --with-globus-nothr-flavor=${globus_flav} && \
1021 make && \
1022 make install || return $RC_FAILED
1023 return $RC_SUCCESS
1024 }
1025
1026 ##############################################################################
1027 #
1028 # Define all dependency functions, NOTE: the order of the setdeps statements is
1029 # important!
1030 #
1031 ##############################################################################
1032
1033 # GLOBUS: no dependencies
1034 setdeps globus
1035
1036 # BUILD COMMON-CPP: no dependencies
1037 setdeps common_cpp
1038
1039 # VOMS: depends globus
1040 setdeps voms globus
1041
1042 # LCMAPS: depends globus, voms, common-cpp
1043 setdeps lcmaps globus voms
1044
1045 # LCMAPS-INTERFACE: depends common-cpp
1046 setdeps lcmaps_interface
1047
1048 # LCAS: depends globus, common-cpp
1049 setdeps lcas globus common_cpp
1050
1051 # LCAS-INTERFACE: depends common-cpp
1052 setdeps lcas_interface common_cpp
1053
1054 # GLEXEC: depends common-cpp, lcmaps_interface
1055 setdeps glexec common_cpp lcmaps_interface
1056
1057 # LCMAPS PLUGINS BASIC: depends globus, lcmaps, common-cpp
1058 setdeps lcmaps_plugins_basic globus lcmaps common_cpp
1059
1060 # LCMAPS PLUGINS VERIFY-PROXY: depends lcmaps, common-cpp
1061 setdeps lcmaps_plugins_verify_proxy lcmaps common_cpp
1062
1063 # LCMAPS PLUGINS VOMS: depends globus, voms, lcmaps, common-cpp
1064 setdeps lcmaps_plugins_voms globus voms lcmaps common_cpp
1065
1066 # LCMAPS PLUGINS AFS: depends lcmaps, common-cpp
1067 setdeps lcmaps_plugins_afs lcmaps common_cpp
1068
1069 # LCMAPS PLUGINS GUMS: depends lcmaps, common-cpp
1070 setdeps lcmaps_plugins_gums lcmaps common_cpp
1071
1072 # PEP-C LIB: Not dependent on LCMAPS, but need to install it in right place
1073 setdeps pep_c_lib lcmaps
1074
1075 # LCMAPS PLUGINS C-PEP: depends lcmaps, pep-c lib, common-cpp
1076 setdeps lcmaps_plugins_c_pep lcmaps pep_c_lib common_cpp
1077
1078 # SAML2XACML2 LIB: depends common-cpp
1079 setdeps saml2_xacml2_c_lib common_cpp
1080
1081 # LCMAPS PLUGINS SCAS CLIENT: depends saml2-xacml2-c-lib, common-cpp
1082 setdeps lcmaps_plugins_scas_client lcmaps saml2_xacml2_c_lib common_cpp
1083
1084 # SCAS: depends saml2-xacml2-c-lib, common-cpp, lcmaps
1085 setdeps scas saml2_xacml2_c_lib common_cpp lcmaps
1086
1087 # EES: depends saml2-xacml2-c-lib, common-cpp
1088 setdeps ees saml2_xacml2_c_lib common_cpp
1089
1090 # LCAS PLUGINS BASIC: depends globus, lcas, common-cpp
1091 setdeps lcas_plugins_basic globus lcas common_cpp
1092
1093 # LCAS PLUGINS CHECK-EXECUTABLE: depends globus, lcas, common-cpp
1094 setdeps lcas_plugins_check_executable globus lcas common_cpp
1095
1096 # GRIDSITE Core:
1097 setdeps gridsite_core
1098
1099 # LCAS PLUGINS VOMS: depends globus, voms, lcas, common-cpp, gridsite
1100 setdeps lcas_plugins_voms globus voms lcas common_cpp gridsite_core
1101
1102 # LCAS-LCMAPS GT4 interface: depends globus, lcmaps, common-cpp, lcas, lcas-interface
1103 setdeps lcas_lcmaps_gt4_interface globus lcmaps common_cpp lcas lcas_interface
1104
1105 ##############################################################################
1106 #
1107 # Build all tools, taking care of dependencies
1108 #
1109 ##############################################################################
1110
1111 # Now that we know all the targets, we can print usage if requested
1112 if [ "$USAGE" -eq 1 ];then
1113 usage
1114 exit 0
1115 fi
1116
1117 # If we just wanted platform help, print it now
1118 if [ "$PLATFORM" = "help" ];then
1119 globus_etics_platform
1120 exit 0
1121 fi
1122
1123 # Check if anything needs doing...
1124 if [ -z "$targets" ];then
1125 echo "No targets specified, nothing to be done."
1126 exit 0
1127 fi
1128
1129 # Find suitable download command
1130 get_download_cmd
1131
1132 # Parse the config file, if one is specified
1133 if [ -n "$CONFIG" ];then
1134 parse_config
1135 fi
1136
1137 # Figure out the build targets
1138 build_targets=""
1139 # Check for special build all target
1140 if [ "$targets" = "all" ];then
1141 build_targets=$known_targets
1142 else
1143 for target in $targets;do
1144 echo $known_targets|tr ' ' '\n'|grep -q "^$target$" && \
1145 build_targets="$build_targets $target" || \
1146 echo "Skipping unknown target \"$target\"" >&2
1147 done
1148 fi
1149
1150 MISSING=0
1151 FAILED=0
1152 # Anything to be done?
1153 if [ -n "$build_targets" ];then
1154 # create the source dir
1155 mkdir -p ${SOURCE} || error "Creating of ${SOURCE} FAILED"
1156
1157 # Get globus_flavour just in case we won't build. If it will be build, it
1158 # will be reset afterwards.
1159 globus_flavour
1160
1161 # make sure default common_cpp is defined, as it is used by so many.
1162 compo_common_cpp=${compo_common_cpp:-org.glite.build.common-cpp}
1163
1164 # Do the builds and print results
1165 if [ -z "$STDOUT" ];then
1166 if [ -z "$STDERR" ];then
1167 build
1168 else
1169 build 2> $STDERR
1170 fi
1171 else
1172 if [ -z "$STDERR" ];then
1173 build > $STDOUT
1174 else
1175 build > $STDOUT 2> $STDERR
1176 fi
1177 fi
1178 fi
1179
1180 exit `expr $MISSING + $FAILED`

Properties

Name Value
svn:executable *

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