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