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.63 by root, Fri Oct 16 02:43:37 2015 UTC vs.
Revision 1.75 by root, Tue Aug 1 03:48:59 2023 UTC

49 49
50# which extra modules you might want to install 50# which extra modules you might want to install
51EXTRA_MODULES="" 51EXTRA_MODULES=""
52 52
53# overridable functions 53# overridable functions
54preconfigure() { : ; } 54preconfigure() { : ; }
55patchconfig() { : ; } 55patchconfig() { : ; }
56postconfigure() { : ; } 56postconfigure() { : ; }
57postbuild() { : ; } 57postbuild() { : ; }
58postcpanconfig() { : ; }
58postinstall() { : ; } 59postinstall() { : ; }
59 60
60# now source user config, if any 61# now source user config, if any
61if [ "$STATICPERLRC" ]; then 62if [ "$STATICPERLRC" ]; then
62 . "$STATICPERLRC" 63 . "$STATICPERLRC"
63else 64else
69############################################################################# 70#############################################################################
70# support 71# support
71 72
72# work around ExtUtils::CBuilder and others 73# work around ExtUtils::CBuilder and others
73export CC="$PERL_CC" 74export CC="$PERL_CC"
74export CFLAGS="$PERL_CFLASGS" 75export CFLAGS="$PERL_CFLAGS"
75export LD="$PERL_CC" 76export LD="$PERL_CC"
76export LDFLAGS="$PERL_LDFLAGS" 77export LDFLAGS="$PERL_LDFLAGS"
77unset LIBS 78unset LIBS
78 79
79PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed 80PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed
86# life easier when working in e.g. "staticperl cpan / look" 87# life easier when working in e.g. "staticperl cpan / look"
87PATH="$PERL_PREFIX/perl/bin:$PATH" 88PATH="$PERL_PREFIX/perl/bin:$PATH"
88 89
89# set version in a way that Makefile.PL can extract 90# set version in a way that Makefile.PL can extract
90VERSION=VERSION; eval \ 91VERSION=VERSION; eval \
91$VERSION="1.44" 92$VERSION="1.46"
92 93
93fatal() { 94fatal() {
94 printf -- "\nFATAL: %s\n\n" "$*" >&2 95 printf -- "\nFATAL: %s\n\n" "$*" >&2
95 exit 1 96 exit 1
96} 97}
146 rm -f "$PERL_PREFIX/staticstamp.install" 147 rm -f "$PERL_PREFIX/staticstamp.install"
147 rm -f "$STATICPERL/src/perl/staticstamp.configure" 148 rm -f "$STATICPERL/src/perl/staticstamp.configure"
148} 149}
149 150
150fetch() { 151fetch() {
152(
151 rcd "$STATICPERL" 153 rcd "$STATICPERL"
152 154
153 mkdir -p src 155 mkdir -p src
154 rcd src 156 rcd src
155 157
216 *.lzma ) UNCOMPRESS="lzma -d" ;; 218 *.lzma ) UNCOMPRESS="lzma -d" ;;
217 *.bz2 ) UNCOMPRESS="bzip2 -d" ;; 219 *.bz2 ) UNCOMPRESS="bzip2 -d" ;;
218 *.gz ) UNCOMPRESS="gzip -d" ;; 220 *.gz ) UNCOMPRESS="gzip -d" ;;
219 *.tar ) UNCOMPRESS="cat" ;; 221 *.tar ) UNCOMPRESS="cat" ;;
220 * ) 222 * )
221 fatal "don't know hot to uncompress $PERL_TAR,\nonly tar, tar.gz, tar.bz2, tar.lzma and tar.xz are supported." 223 fatal "don't know hot to uncompress $PERLTAR,\nonly tar, tar.gz, tar.bz2, tar.lzma and tar.xz are supported."
222 exit 1 224 exit 1
223 ;; 225 ;;
224 esac 226 esac
225 227
226 <"$PERLTAR" $UNCOMPRESS -d | ( cd unpack && tar xf - ) \ 228 <"$PERLTAR" $UNCOMPRESS -d | ( cd unpack && tar xf - ) \
234 fatal "unpacking $PERLTAR did not result in a single directory, don't know how to handle this" 236 fatal "unpacking $PERLTAR did not result in a single directory, don't know how to handle this"
235 fi 237 fi
236 238
237 rm "$PERLTAR" 239 rm "$PERLTAR"
238 fi 240 fi
241) || exit
239} 242}
240 243
241# similar to GNU-sed -i or perl -pi 244# similar to GNU-sed -i or perl -pi
242sedreplace() { 245sedreplace() {
243 sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" 246 sed -e "$1" <"$2" > "$2~" || fatal "error while running sed"
270EOF 273EOF
271 exit 1 274 exit 1
272} 275}
273 276
274configure() { 277configure() {
278(
275 fetch 279 fetch
276 280
277 rcd "$STATICPERL/src/perl" 281 rcd "$STATICPERL/src/perl"
278 282
279 [ -e staticstamp.configure ] && return 283 [ -e staticstamp.configure ] && return
329 -Demail="$EMAIL" \ 333 -Demail="$EMAIL" \
330 -Dcf_email="$EMAIL" \ 334 -Dcf_email="$EMAIL" \
331 -Dcf_by="$EMAIL" \ 335 -Dcf_by="$EMAIL" \
332 $PERL_CONFIGURE \ 336 $PERL_CONFIGURE \
333 -Duseperlio \ 337 -Duseperlio \
338 -Uversiononly \
334 -dE || configure_failure 339 -dE || configure_failure
335 340
336 sedreplace ' 341 sedreplace '
337 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g 342 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g
338 s/ *-fno-stack-protector */ /g 343 s/ *-fno-stack-protector */ /g
343 sh Configure -S || fatal "Configure -S failed" 348 sh Configure -S || fatal "Configure -S failed"
344 349
345 postconfigure || fatal "postconfigure hook failed" 350 postconfigure || fatal "postconfigure hook failed"
346 351
347 : > staticstamp.configure 352 : > staticstamp.configure
353) || exit
348} 354}
349 355
350write_shellscript() { 356write_shellscript() {
351 { 357 {
352 echo "#!/bin/sh" 358 echo "#!/bin/sh"
357 } >"$PERL_PREFIX/bin/$1" 363 } >"$PERL_PREFIX/bin/$1"
358 chmod 755 "$PERL_PREFIX/bin/$1" 364 chmod 755 "$PERL_PREFIX/bin/$1"
359} 365}
360 366
361build() { 367build() {
368(
362 configure 369 configure
363 370
364 rcd "$STATICPERL/src/perl" 371 rcd "$STATICPERL/src/perl"
365 372
366 verblock <<EOF 373 verblock <<EOF
370 rm -f "$PERL_PREFIX/staticstamp.install" 377 rm -f "$PERL_PREFIX/staticstamp.install"
371 378
372 "$MAKE" || fatal "make: error while building perl" 379 "$MAKE" || fatal "make: error while building perl"
373 380
374 postbuild || fatal "postbuild hook failed" 381 postbuild || fatal "postbuild hook failed"
382) || exit
375} 383}
376 384
377_postinstall() { 385_postinstall() {
378 if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then 386 if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then
379 NOCHECK_INSTALL=+ 387 NOCHECK_INSTALL=+
385 : > "$PERL_PREFIX/staticstamp.postinstall" 393 : > "$PERL_PREFIX/staticstamp.postinstall"
386 fi 394 fi
387} 395}
388 396
389install() { 397install() {
398(
390 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then 399 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
391 build 400 build
392 401
393 verblock <<EOF 402 verblock <<EOF
394installing $STATICPERL/src/perl 403installing $STATICPERL/src/perl
401 mkdir "$STATICPERL/patched" 410 mkdir "$STATICPERL/patched"
402 411
403 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten 412 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten
404 rm -rf "$PERL_PREFIX" # by this rm -rf 413 rm -rf "$PERL_PREFIX" # by this rm -rf
405 414
415 rcd "$STATICPERL/src/perl"
416
406 "$MAKE" install || fatal "make install: error while installing" 417 "$MAKE" install || fatal "make install: error while installing"
407 418
408 rcd "$PERL_PREFIX" 419 rcd "$PERL_PREFIX"
409 420
410 # create a "make install" replacement for CPAN 421 # create a "make install" replacement for CPAN
411 write_shellscript SP-make-install-make <<'EOF' 422 write_shellscript SP-make-make <<'end_of_make'
423#CAT make-make.sh
424end_of_make
425
426 # create a "make install" replacement for CPAN
427 write_shellscript SP-make-install-make <<'end_of_make_install_make'
412#CAT make-install-make.sh 428#CAT make-install-make.sh
413EOF 429end_of_make_install_make
414 430
415 # create a "patch modules" helper 431 # create a "patch modules" helper
416 write_shellscript SP-patch-postinstall <<'EOF' 432 write_shellscript SP-patch-postinstall <<'end_of_patch_postinstall'
417#CAT patch-postinstall.sh 433#CAT patch-postinstall.sh
418EOF 434end_of_patch_postinstall
419 435
420 # immediately use it 436 # immediately use it
421 "$PERL_PREFIX/bin/SP-patch-postinstall" 437 "$PERL_PREFIX/bin/SP-patch-postinstall"
422 438
423 # help to trick CPAN into avoiding ~/.cpan completely 439 # help to trick CPAN into avoiding ~/.cpan completely
424 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" 440 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm"
425 441
426 # we call cpan with -MCPAN::MyConfig in this script, which 442 # we call cpan with -MCPAN::MyConfig in this script, which
427 # is strictly unnecssary as we have to patch CPAN anyway, 443 # is strictly unnecessary as we have to patch CPAN anyway,
428 # so consider it "for good measure". 444 # so consider it "for good measure".
429 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' 445 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
430 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); 446 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
447 CPAN::Shell->o (conf => pushy_https => "0");
431 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 448 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
432 CPAN::Shell->o (conf => q<init>); 449 CPAN::Shell->o (conf => q<init>);
433 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 450 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
434 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); 451 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build");
435 CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); 452 CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs");
436 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); 453 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile");
437 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); 454 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources");
438 CPAN::Shell->o (conf => q<makepl_arg>, "MAP_TARGET=perl"); 455 CPAN::Shell->o (conf => q<makepl_arg>, "MAP_TARGET=perl");
456 CPAN::Shell->o (conf => q<make>, "'"$PERL_PREFIX"'/bin/SP-make-make");
439 CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/SP-make-install-make"); 457 CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/SP-make-install-make");
440 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); 458 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>);
441 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<yes>); 459 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<yes>);
460 CPAN::Shell->o (conf => q<recommends_policy>, q<0>);
461 CPAN::Shell->o (conf => q<suggests_policy>, q<0>);
442 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); 462 CPAN::Shell->o (conf => q<prefer_installer>, q<EUMM>);
443 CPAN::Shell->o (conf => q<commit>); 463 CPAN::Shell->o (conf => q<commit>);
444 ' || fatal "error while initialising CPAN" 464 ' || fatal "error while initialising CPAN"
445 465
466 postcpanconfig
467
446 : > "$PERL_PREFIX/staticstamp.install" 468 : > "$PERL_PREFIX/staticstamp.install"
447 fi 469 fi
448 470
449 _postinstall 471 _postinstall
472) || exit
450} 473}
451 474
452import() { 475import() {
476(
453 IMPORT="$1" 477 IMPORT="$1"
454 478
455 rcd "$STATICPERL" 479 rcd "$STATICPERL"
456 480
457 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then 481 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
468 492
469 : > "$PERL_PREFIX/staticstamp.install" 493 : > "$PERL_PREFIX/staticstamp.install"
470 fi 494 fi
471 495
472 _postinstall 496 _postinstall
497) || exit
473} 498}
474 499
475############################################################################# 500#############################################################################
476# install a module from CPAN 501# install a module from CPAN
477 502
478instcpan() { 503instcpan() {
479 [ $NOCHECK_INSTALL ] || install 504 [ $NOCHECK_INSTALL ] || install
480 505
481 verblock <<EOF 506 verblock <<EOF
482installing modules from CPAN 507installing modules from CPAN
483$@ 508$*
484EOF 509EOF
485 510
486 MYCONFIG= 511 MYCONFIG=
487 [ -e "$PERL_PREFIX/.import" ] || MYCONFIG=-MCPAN::MyConfig 512 [ -e "$PERL_PREFIX/.import" ] || MYCONFIG=-MCPAN::MyConfig
488 513
489 "$PERL_PREFIX"/bin/perl $MYCONFIG -MCPAN -e 'notest (install => $_) for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log" 514 "$PERL_PREFIX"/bin/perl $MYCONFIG -MCPAN -e 'notest (install => $_) for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log"
490 515
491 if grep -q " -- NOT OK\$" "$STATICPERL/instcpan.log"; then 516 if grep -q " -- NOT OK\$" "$STATICPERL/instcpan.log"; then
492 fatal "failure while installing modules from CPAN ($@)" 517 fatal "failure while installing modules from CPAN ($*)"
493 fi 518 fi
494 rm -f "$STATICPERL/instcpan.log" 519 rm -f "$STATICPERL/instcpan.log"
495} 520}
496 521
497############################################################################# 522#############################################################################
500instsrc() { 525instsrc() {
501 [ $NOCHECK_INSTALL ] || install 526 [ $NOCHECK_INSTALL ] || install
502 527
503 verblock <<EOF 528 verblock <<EOF
504installing modules from source 529installing modules from source
505$@ 530$*
506EOF 531EOF
507 532
508 for mod in "$@"; do 533 for mod in "$@"; do
509 echo 534 echo
510 echo $mod 535 echo $mod
548catmkbundle() { 573catmkbundle() {
549 { 574 {
550 read dummy 575 read dummy
551 echo "#!$PERL_PREFIX/bin/perl" 576 echo "#!$PERL_PREFIX/bin/perl"
552 cat 577 cat
553 } <<'MKBUNDLE' 578 } <<'end_of_mkbundle'
554#CAT mkbundle 579#CAT mkbundle
555MKBUNDLE 580end_of_mkbundle
556} 581}
557 582
558bundle() { 583bundle() {
559 MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}" 584 MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}"
560 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" 585 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines