--- App-Staticperl/staticperl.sh 2011/04/01 05:58:22 1.38 +++ App-Staticperl/staticperl.sh 2011/05/01 07:56:26 1.40 @@ -37,9 +37,10 @@ # some configuration options for modules PERL_MM_USE_DEFAULT=1 +PERL_MM_OPT="MAN1PODS= MAN3PODS=" #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow 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' -export PERL_MM_USE_DEFAULT CORO_INTERFACE EV_EXTRA_DEFS +export PERL_MM_USE_DEFAULT PERL_MM_OPT CORO_INTERFACE EV_EXTRA_DEFS # which extra modules to install by default from CPAN that are # required by mkbundle @@ -67,11 +68,10 @@ ############################################################################# # support -MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG -unset PERL_MM_OPT PERL_MB_OPT +unset PERL_MB_OPT LC_ALL=C; export LC_ALL # just to be on the safe side # prepend PATH - not required by staticperl itself, but might make @@ -291,6 +291,17 @@ touch staticstamp.configure } +write_shellscript() { + { + echo "#!/bin/sh" + echo "STATICPERL=\"$STATICPERL\"" + echo "PERL_PREFIX=\"$PERL_PREFIX\"" + echo "MAKE=\"$MAKE\"" + cat + } >"$PERL_PREFIX/bin/$1" + chmod 755 "$PERL_PREFIX/bin/$1" +} + build() { configure @@ -319,6 +330,8 @@ ln -sf "perl/bin/" "$STATICPERL/bin" ln -sf "perl/lib/" "$STATICPERL/lib" + mkdir "$STATICPERL/patched" + ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten rm -rf "$PERL_PREFIX" # by this rm -rf @@ -327,49 +340,23 @@ rcd "$PERL_PREFIX" # create a "make install" replacement for CPAN - cat >"$PERL_PREFIX"/bin/cpan-make-install <"\$HCPM~" - rm -f "\$HCPM" - mv "\$HCPM~" "\$HCPM" - ;; -esac - -if find blib/arch/auto -type f | grep -q -v .exists; then - echo Probably an XS module, rebuilding perl - if "$MAKE" perl; then - mv perl "$PERL_PREFIX"/bin/perl~ \ - && rm -f "$PERL_PREFIX"/bin/perl \ - && mv "$PERL_PREFIX"/bin/perl~ "$PERL_PREFIX"/bin/perl - "$MAKE" -f Makefile.aperl map_clean - else - "$MAKE" -f Makefile.aperl map_clean - exit 1 - fi -fi + write_shellscript SP-make-install-make <<'EOF' +#CAT make-install-make.sh +EOF -"$MAKE" install UNINST=1 + # create a "patch modules" helper + write_shellscript SP-patch-postinstall <<'EOF' +#CAT patch-postinstall.sh EOF - chmod 755 "$PERL_PREFIX"/bin/cpan-make-install - # trick CPAN into avoiding ~/.cpan completely - echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" + "$PERL_PREFIX/bin/SP-patch-postinstall" - # we call cpan with -MCPAN::MyConfig in this script, but - # every make install will patch CPAN::HandleConfig.pm to - # protect the user. + # help to trick CPAN into avoiding ~/.cpan completely + echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" + # we call cpan with -MCPAN::MyConfig in this script, which + # is strictly unnecssary as we have to patch CPAN anyway, + # so consider it "for good measure". "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); CPAN::Shell->o (conf => q, "'"$STATICPERL"'/cpan"); @@ -379,7 +366,7 @@ CPAN::Shell->o (conf => q, "'"$STATICPERL"'/cpan/prefs"); CPAN::Shell->o (conf => q , "'"$STATICPERL"'/cpan/histfile"); CPAN::Shell->o (conf => q, "'"$STATICPERL"'/cpan/sources"); - CPAN::Shell->o (conf => q, "'"$PERL_PREFIX"'/bin/cpan-make-install"); + CPAN::Shell->o (conf => q, "'"$PERL_PREFIX"'/bin/SP-make-install-make"); CPAN::Shell->o (conf => q, q); CPAN::Shell->o (conf => q, q); CPAN::Shell->o (conf => q, "EUMM"); @@ -438,7 +425,7 @@ "$MAKE" distclean >/dev/null 2>&1 "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" "$MAKE" || fatal "$mod: error building module" - "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" + "$PERL_PREFIX"/bin/SP-make-install-make install || fatal "$mod: error installing module" "$MAKE" distclean >/dev/null 2>&1 exit 0 ) || exit $? @@ -480,6 +467,7 @@ } bundle() { + MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}" catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" CACHE="$STATICPERL/cache" @@ -508,9 +496,14 @@ ( instcpan "$@" ) || exit exit ;; + perl ) + ( install ) || exit + exec "$PERL_PREFIX/bin/perl" "$@" + exit + ;; cpan ) ( install ) || exit - "$PERL_PREFIX/bin/cpan" "$@" + exec "$PERL_PREFIX/bin/cpan" "$@" exit ;; mkbundle )