… | |
… | |
35 | PERL_LDFLAGS= |
35 | PERL_LDFLAGS= |
36 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
37 | |
37 | |
38 | # some configuration options for modules |
38 | # some configuration options for modules |
39 | PERL_MM_USE_DEFAULT=1 |
39 | PERL_MM_USE_DEFAULT=1 |
|
|
40 | PERL_MM_OPT="MAN1PODS= MAN3PODS=" |
40 | #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
41 | #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
41 | EV_EXTRA_DEFS='-DEV_FEATURES=4+8+16+64 -DEV_USE_SELECT=0 -DEV_USE_POLL=1 -DEV_USE_EPOLL=1 -DEV_NO_LOOPS -DEV_COMPAT3=0' |
42 | EV_EXTRA_DEFS='-DEV_FEATURES=4+8+16+64 -DEV_USE_SELECT=0 -DEV_USE_POLL=1 -DEV_USE_EPOLL=1 -DEV_NO_LOOPS -DEV_COMPAT3=0' |
42 | export PERL_MM_USE_DEFAULT CORO_INTERFACE EV_EXTRA_DEFS |
43 | export PERL_MM_USE_DEFAULT PERL_MM_OPT CORO_INTERFACE EV_EXTRA_DEFS |
43 | |
44 | |
44 | # which extra modules to install by default from CPAN that are |
45 | # which extra modules to install by default from CPAN that are |
45 | # required by mkbundle |
46 | # required by mkbundle |
46 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
47 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
47 | |
48 | |
… | |
… | |
65 | fi |
66 | fi |
66 | |
67 | |
67 | ############################################################################# |
68 | ############################################################################# |
68 | # support |
69 | # support |
69 | |
70 | |
70 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
|
|
71 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
71 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
72 | |
72 | |
73 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
73 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
74 | unset PERL_MM_OPT PERL_MB_OPT |
74 | unset PERL_MB_OPT |
75 | LC_ALL=C; export LC_ALL # just to be on the safe side |
75 | LC_ALL=C; export LC_ALL # just to be on the safe side |
76 | |
76 | |
77 | # prepend PATH - not required by staticperl itself, but might make |
77 | # prepend PATH - not required by staticperl itself, but might make |
78 | # life easier when working in e.g. "staticperl cpan / look" |
78 | # life easier when working in e.g. "staticperl cpan / look" |
79 | PATH="$PERL_PREFIX/perl/bin:$PATH" |
79 | PATH="$PERL_PREFIX/perl/bin:$PATH" |
… | |
… | |
289 | postconfigure || fatal "postconfigure hook failed" |
289 | postconfigure || fatal "postconfigure hook failed" |
290 | |
290 | |
291 | touch staticstamp.configure |
291 | touch staticstamp.configure |
292 | } |
292 | } |
293 | |
293 | |
|
|
294 | write_shellscript() { |
|
|
295 | { |
|
|
296 | echo "#!/bin/sh" |
|
|
297 | echo "STATICPERL=\"$STATICPERL\"" |
|
|
298 | echo "PERL_PREFIX=\"$PERL_PREFIX\"" |
|
|
299 | echo "MAKE=\"$MAKE\"" |
|
|
300 | cat |
|
|
301 | } >"$PERL_PREFIX/bin/$1" |
|
|
302 | chmod 755 "$PERL_PREFIX/bin/$1" |
|
|
303 | } |
|
|
304 | |
294 | build() { |
305 | build() { |
295 | configure |
306 | configure |
296 | |
307 | |
297 | rcd "$STATICPERL/src/perl-$PERL_VERSION" |
308 | rcd "$STATICPERL/src/perl-$PERL_VERSION" |
298 | |
309 | |
… | |
… | |
317 | EOF |
328 | EOF |
318 | |
329 | |
319 | ln -sf "perl/bin/" "$STATICPERL/bin" |
330 | ln -sf "perl/bin/" "$STATICPERL/bin" |
320 | ln -sf "perl/lib/" "$STATICPERL/lib" |
331 | ln -sf "perl/lib/" "$STATICPERL/lib" |
321 | |
332 | |
|
|
333 | mkdir "$STATICPERL/patched" |
|
|
334 | |
322 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
335 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
323 | rm -rf "$PERL_PREFIX" # by this rm -rf |
336 | rm -rf "$PERL_PREFIX" # by this rm -rf |
324 | |
337 | |
325 | "$MAKE" install || fatal "make install: error while installing" |
338 | "$MAKE" install || fatal "make install: error while installing" |
326 | |
339 | |
327 | rcd "$PERL_PREFIX" |
340 | rcd "$PERL_PREFIX" |
328 | |
341 | |
329 | # create a "make install" replacement for CPAN |
342 | # create a "make install" replacement for CPAN |
330 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
343 | write_shellscript SP-make-install-make <<'EOF' |
331 | "$MAKE" || exit |
344 | #CAT make-install-make.sh |
332 | |
|
|
333 | # patch CPAN::HandleConfig.pm |
|
|
334 | HCPM="$PERL_PREFIX"/lib/CPAN/HandleConfig.pm |
|
|
335 | case "\$(head -n1 "\$HCPM")" in |
|
|
336 | *CPAN::MyConfig* ) |
|
|
337 | ;; |
|
|
338 | * ) |
|
|
339 | echo "patching \$HCPM for a safer tomorrow" |
|
|
340 | { |
|
|
341 | echo "use CPAN::MyConfig;" |
|
|
342 | cat "\$HCPM" |
|
|
343 | } >"\$HCPM~" |
|
|
344 | rm -f "\$HCPM" |
|
|
345 | mv "\$HCPM~" "\$HCPM" |
|
|
346 | ;; |
|
|
347 | esac |
|
|
348 | |
|
|
349 | if find blib/arch/auto -type f | grep -q -v .exists; then |
|
|
350 | echo Probably an XS module, rebuilding perl |
|
|
351 | if "$MAKE" perl; then |
|
|
352 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
|
|
353 | && rm -f "$PERL_PREFIX"/bin/perl \ |
|
|
354 | && mv "$PERL_PREFIX"/bin/perl~ "$PERL_PREFIX"/bin/perl |
|
|
355 | "$MAKE" -f Makefile.aperl map_clean |
|
|
356 | else |
|
|
357 | "$MAKE" -f Makefile.aperl map_clean |
|
|
358 | exit 1 |
|
|
359 | fi |
|
|
360 | fi |
|
|
361 | |
|
|
362 | "$MAKE" install UNINST=1 |
|
|
363 | EOF |
345 | EOF |
364 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
|
|
365 | |
346 | |
|
|
347 | # create a "patch modules" helper |
|
|
348 | write_shellscript SP-patch-postinstall <<'EOF' |
|
|
349 | #CAT patch-postinstall.sh |
|
|
350 | EOF |
|
|
351 | |
|
|
352 | "$PERL_PREFIX/bin/SP-patch-postinstall" |
|
|
353 | |
366 | # trick CPAN into avoiding ~/.cpan completely |
354 | # help to trick CPAN into avoiding ~/.cpan completely |
367 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
355 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
368 | |
356 | |
369 | # we call cpan with -MCPAN::MyConfig in this script, but |
357 | # we call cpan with -MCPAN::MyConfig in this script, which |
370 | # every make install will patch CPAN::HandleConfig.pm to |
358 | # is strictly unnecssary as we have to patch CPAN anyway, |
371 | # protect the user. |
359 | # so consider it "for good measure". |
372 | |
|
|
373 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
360 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
374 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
361 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
375 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
362 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
376 | CPAN::Shell->o (conf => q<init>); |
363 | CPAN::Shell->o (conf => q<init>); |
377 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
364 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
378 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
365 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
379 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
366 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
380 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
367 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
381 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
368 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
382 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
369 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/SP-make-install-make"); |
383 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
370 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
384 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
371 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
385 | CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); |
372 | CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); |
386 | CPAN::Shell->o (conf => q<commit>); |
373 | CPAN::Shell->o (conf => q<commit>); |
387 | ' || fatal "error while initialising CPAN" |
374 | ' || fatal "error while initialising CPAN" |
… | |
… | |
436 | rcd $mod |
423 | rcd $mod |
437 | "$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1 |
424 | "$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1 |
438 | "$MAKE" distclean >/dev/null 2>&1 |
425 | "$MAKE" distclean >/dev/null 2>&1 |
439 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
426 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
440 | "$MAKE" || fatal "$mod: error building module" |
427 | "$MAKE" || fatal "$mod: error building module" |
441 | "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
428 | "$PERL_PREFIX"/bin/SP-make-install-make install || fatal "$mod: error installing module" |
442 | "$MAKE" distclean >/dev/null 2>&1 |
429 | "$MAKE" distclean >/dev/null 2>&1 |
443 | exit 0 |
430 | exit 0 |
444 | ) || exit $? |
431 | ) || exit $? |
445 | done |
432 | done |
446 | } |
433 | } |
… | |
… | |
478 | #CAT mkbundle |
465 | #CAT mkbundle |
479 | MKBUNDLE |
466 | MKBUNDLE |
480 | } |
467 | } |
481 | |
468 | |
482 | bundle() { |
469 | bundle() { |
|
|
470 | MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}" |
483 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
471 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
484 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
472 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
485 | CACHE="$STATICPERL/cache" |
473 | CACHE="$STATICPERL/cache" |
486 | mkdir -p "$CACHE" |
474 | mkdir -p "$CACHE" |
487 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" |
475 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" |
… | |
… | |
506 | ;; |
494 | ;; |
507 | instcpan ) |
495 | instcpan ) |
508 | ( instcpan "$@" ) || exit |
496 | ( instcpan "$@" ) || exit |
509 | exit |
497 | exit |
510 | ;; |
498 | ;; |
|
|
499 | perl ) |
|
|
500 | ( install ) || exit |
|
|
501 | exec "$PERL_PREFIX/bin/perl" "$@" |
|
|
502 | exit |
|
|
503 | ;; |
511 | cpan ) |
504 | cpan ) |
512 | ( install ) || exit |
505 | ( install ) || exit |
513 | "$PERL_PREFIX/bin/cpan" "$@" |
506 | exec "$PERL_PREFIX/bin/cpan" "$@" |
514 | exit |
507 | exit |
515 | ;; |
508 | ;; |
516 | mkbundle ) |
509 | mkbundle ) |
517 | ( install ) || exit |
510 | ( install ) || exit |
518 | bundle "$@" |
511 | exec bundle "$@" |
519 | exit |
512 | exit |
520 | ;; |
513 | ;; |
521 | mkperl ) |
514 | mkperl ) |
522 | ( install ) || exit |
515 | ( install ) || exit |
523 | bundle --perl "$@" |
516 | exec bundle --perl "$@" |
524 | exit |
517 | exit |
525 | ;; |
518 | ;; |
526 | mkapp ) |
519 | mkapp ) |
527 | ( install ) || exit |
520 | ( install ) || exit |
528 | bundle --app "$@" |
521 | exec bundle --app "$@" |
529 | exit |
522 | exit |
530 | ;; |
523 | ;; |
531 | help ) |
524 | help ) |
532 | podusage 2 |
525 | podusage 2 |
533 | ;; |
526 | ;; |