ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/staticperl.sh
(Generate patch)

Comparing App-Staticperl/staticperl.sh (file contents):
Revision 1.47 by root, Mon Jun 27 21:56:41 2011 UTC vs.
Revision 1.49 by root, Sun Jul 10 01:37:56 2011 UTC

8EMAIL="read the documentation <rtfm@example.org>" 8EMAIL="read the documentation <rtfm@example.org>"
9DLCACHE= 9DLCACHE=
10 10
11# perl build variables 11# perl build variables
12MAKE=make 12MAKE=make
13PERL_VERSION=5.12.3 # 5.8.9 is also a good choice 13PERL_VERSION=5.12.4 # 5.8.9 is also a good choice
14PERL_CC=cc 14PERL_CC=cc
15PERL_CONFIGURE="" # additional Configure arguments 15PERL_CONFIGURE="" # additional Configure arguments
16PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG" 16PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG"
17PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" 17PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math"
18 18
132 132
133############################################################################# 133#############################################################################
134# download/configure/compile/install perl 134# download/configure/compile/install perl
135 135
136clean() { 136clean() {
137 rm -rf "$STATICPERL/src/perl-$PERL_VERSION" 137 rm -rf "$STATICPERL/src"
138} 138}
139 139
140realclean() { 140realclean() {
141 rm -f "$PERL_PREFIX/staticstamp.postinstall" 141 rm -f "$PERL_PREFIX/staticstamp.postinstall"
142 rm -f "$PERL_PREFIX/staticstamp.install" 142 rm -f "$PERL_PREFIX/staticstamp.install"
167you can configure a download cache directory via DLCACHE 167you can configure a download cache directory via DLCACHE
168in your .staticperlrc to avoid repeated downloads. 168in your .staticperlrc to avoid repeated downloads.
169EOF 169EOF
170 170
171 rm -f $PERLTAR~ # just to be on the safe side 171 rm -f $PERLTAR~ # just to be on the safe side
172 { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~; } \ 172 { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~ >/dev/null 2>&1; } \
173 || wget -O $PERLTAR~ "$URL" \ 173 || wget -O $PERLTAR~ "$URL" \
174 || curl -f >$PERLTAR~ "$URL" \ 174 || curl -f >$PERLTAR~ "$URL" \
175 || fatal "$URL: unable to download" 175 || fatal "$URL: unable to download"
176 rm -f $PERLTAR 176 rm -f $PERLTAR
177 mv $PERLTAR~ $PERLTAR 177 mv $PERLTAR~ $PERLTAR
300 300
301 sh Configure -S || fatal "Configure -S failed" 301 sh Configure -S || fatal "Configure -S failed"
302 302
303 postconfigure || fatal "postconfigure hook failed" 303 postconfigure || fatal "postconfigure hook failed"
304 304
305 touch staticstamp.configure 305 : > staticstamp.configure
306} 306}
307 307
308write_shellscript() { 308write_shellscript() {
309 { 309 {
310 echo "#!/bin/sh" 310 echo "#!/bin/sh"
328 rm -f "$PERL_PREFIX/staticstamp.install" 328 rm -f "$PERL_PREFIX/staticstamp.install"
329 329
330 "$MAKE" || fatal "make: error while building perl" 330 "$MAKE" || fatal "make: error while building perl"
331 331
332 postbuild || fatal "postbuild hook failed" 332 postbuild || fatal "postbuild hook failed"
333}
334
335_postinstall() {
336 if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then
337 NOCHECK_INSTALL=+
338 instcpan $STATICPERL_MODULES
339 [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES
340
341 postinstall || fatal "postinstall hook failed"
342
343 : > "$PERL_PREFIX/staticstamp.postinstall"
344 fi
333} 345}
334 346
335install() { 347install() {
336 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then 348 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
337 build 349 build
385 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); 397 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>);
386 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); 398 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM");
387 CPAN::Shell->o (conf => q<commit>); 399 CPAN::Shell->o (conf => q<commit>);
388 ' || fatal "error while initialising CPAN" 400 ' || fatal "error while initialising CPAN"
389 401
390 touch "$PERL_PREFIX/staticstamp.install" 402 : > "$PERL_PREFIX/staticstamp.install"
391 fi 403 fi
392 404
405 _postinstall
406}
407
408import() {
409 IMPORT="$1"
410
411 rcd "$STATICPERL"
412
393 if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then 413 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
394 NOCHECK_INSTALL=+ 414 verblock <<EOF
395 instcpan $STATICPERL_MODULES 415import perl from $IMPORT to $STATICPERL
396 [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES 416EOF
397 417
398 postinstall || fatal "postinstall hook failed" 418 rm -rf bin cpan lib patched perl src
419 mkdir -m 755 perl perl/bin
420 ln -s perl/bin/ bin
421 ln -s "$IMPORT" perl/bin/
399 422
400 touch "$PERL_PREFIX/staticstamp.postinstall" 423 : > "$PERL_PREFIX/staticstamp.install"
401 fi 424 fi
425
426 _postinstall
402} 427}
403 428
404############################################################################# 429#############################################################################
405# install a module from CPAN 430# install a module from CPAN
406 431
410 verblock <<EOF 435 verblock <<EOF
411installing modules from CPAN 436installing modules from CPAN
412$@ 437$@
413EOF 438EOF
414 439
415 for mod in "$@"; do 440 #"$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install $_ for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log"
416 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \ 441 "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install $_ for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log"
417 || fatal "$mod: unable to install from CPAN" 442
418 done 443 if grep -q " -- NOT OK\$" "$STATICPERL/instcpan.log"; then
444 fatal "failure while installing modules from CPAN ($@)"
445 fi
419 rm -rf "$STATICPERL/build" 446 rm -f "$STATICPERL/instcpan.log"
420} 447}
421 448
422############################################################################# 449#############################################################################
423# install a module from unpacked sources 450# install a module from unpacked sources
424 451
497 command="${1#--}"; shift 524 command="${1#--}"; shift
498 case "$command" in 525 case "$command" in
499 version ) 526 version )
500 echo "staticperl version $VERSION" 527 echo "staticperl version $VERSION"
501 ;; 528 ;;
502 fetch | configure | build | install | clean | realclean | distclean) 529 fetch | configure | build | install | clean | realclean | distclean )
503 ( "$command" ) || exit 530 ( "$command" ) || exit
531 ;;
532 import )
533 ( import "$1" ) || exit
534 shift
504 ;; 535 ;;
505 instsrc ) 536 instsrc )
506 ( instsrc "$@" ) || exit 537 ( instsrc "$@" ) || exit
507 exit 538 exit
508 ;; 539 ;;
515 exec "$PERL_PREFIX/bin/perl" "$@" 546 exec "$PERL_PREFIX/bin/perl" "$@"
516 exit 547 exit
517 ;; 548 ;;
518 cpan ) 549 cpan )
519 ( install ) || exit 550 ( install ) || exit
551 PERL="$PERL_PREFIX/bin/perl"
552 export PERL
520 exec "$PERL_PREFIX/bin/cpan" "$@" 553 exec "$PERL_PREFIX/bin/cpan" "$@"
521 exit 554 exit
522 ;; 555 ;;
523 mkbundle ) 556 mkbundle )
524 ( install ) || exit 557 ( install ) || exit

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines