--- App-Staticperl/staticperl.sh 2010/12/07 20:03:15 1.9 +++ App-Staticperl/staticperl.sh 2010/12/12 00:38:36 1.17 @@ -4,13 +4,10 @@ # configuration to fill in STATICPERL=~/.staticperl -CPAN=http://mirror.netcologne.de/cpan/ # which mirror to use +CPAN=http://mirror.netcologne.de/cpan # which mirror to use EMAIL="read the documentation " -MKBUNDLE="$STATICPERL/mkbundle" - # perl build variables -PERL_PREFIX="$STATICPERL/perl" # where the perl gets installed PERL_VERSION=5.12.2 # 5.8.9 is also a good choice PERL_CONFIGURE="" # additional Configure arguments PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" @@ -31,8 +28,8 @@ # -Wl,--gc-sections makes it impossible to check for undefined references # for some reason so we need to patch away the "-no" after Configure and before make :/ -# -z muldefs is to work around uclibc's pthread static linking bug -PERL_LDFLAGS="-Wl,--no-gc-sections -z muldefs" +# --allow-multiple-definition exists to work around uclibc's pthread static linking bug +PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself # some configuration options for modules @@ -54,16 +51,26 @@ postinstall() { : ; } # now source user config, if any -[ -r /etc/staticperlrc ] && . /etc/staticperlrc -[ -r ~/.staticperlrc ] && . ~/.staticperlrc -[ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" +if [ "$STATICPERLRC" ]; then + . "$STATICPERLRC" +else + [ -r /etc/staticperlrc ] && . /etc/staticperlrc + [ -r ~/.staticperlrc ] && . ~/.staticperlrc + [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" +fi ############################################################################# # support +MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" +PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed + +unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG +export LC_ALL=C # just to be on the safe side + # set version in a way that Makefile.PL can extract VERSION=VERSION; eval \ -$VERSION=0.1 +$VERSION=0.911 BZ2=bz2 BZIP2=bzip2 @@ -106,7 +113,7 @@ distclean() { verblock <"$PERL_PREFIX"/bin/cpan-make-install < *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ 2>/dev/null && exit fi + # try whatever perl we can find perl -MPod::Usage -e \ 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ 2>/dev/null && exit - fatal "displaying documentation requires a working perl - try '$0 install' first" + fatal "displaying documentation requires a working perl - try '$0 install' to build one in a safe location" } usage() { @@ -387,7 +406,9 @@ bundle() { catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" - "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" "$@" + CACHE="$STATICPERL/cache" + mkdir -p "$CACHE" + "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" } if [ $# -gt 0 ]; then @@ -397,10 +418,10 @@ command="${1#--}"; shift case "$command" in + version ) + echo "staticperl version $VERSION" + ;; fetch | configure | build | install | clean | distclean) - verblock <