--- App-Staticperl/staticperl.sh 2010/12/10 20:29:17 1.14 +++ App-Staticperl/staticperl.sh 2010/12/13 17:35:51 1.20 @@ -7,9 +7,9 @@ CPAN=http://mirror.netcologne.de/cpan # which mirror to use EMAIL="read the documentation " - # perl build variables PERL_VERSION=5.12.2 # 5.8.9 is also a good choice +PERL_CC=cc PERL_CONFIGURE="" # additional Configure arguments PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" @@ -18,7 +18,8 @@ case "$ARCH" in i*86 | x86_64 | amd64 ) - PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 + #PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 + PERL_OPTIMIZE="$PERL_OPTIMIZE" # x86/amd64 case "$ARCH" in i*86 ) PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only @@ -29,8 +30,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 @@ -71,7 +72,7 @@ # set version in a way that Makefile.PL can extract VERSION=VERSION; eval \ -$VERSION=0.9 +$VERSION=0.911 BZ2=bz2 BZIP2=bzip2 @@ -149,6 +150,7 @@ wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ || curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ || fatal "$URL: unable to download" + rm -f perl-$PERL_VERSION.tar.$BZ2 mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 fi @@ -157,6 +159,7 @@ EOF mkdir -p unpack + rm -rf unpack/perl-$PERL_VERSION $BZIP2 -d "$2~" || fatal "error while running sed" + rm -f "$2" mv "$2~" "$2" } @@ -200,9 +204,9 @@ -Uusethreads \ -Uuseithreads \ -Uusemultiplicity \ - -Duseperlio \ -Uusesfio \ -Uuseshrplib \ + -Dcc="$PERL_CC" \ -Dcppflags="$PERL_CPPFLAGS" \ -Dccflags="-g2 -fno-strict-aliasing" \ -Doptimize="$PERL_OPTIMIZE" \ @@ -225,6 +229,7 @@ -Dcf_email="$EMAIL" \ -Dcf_by="$EMAIL" \ $PERL_CONFIGURE \ + -Duseperlio \ -dE || fatal "Configure failed" sedreplace ' @@ -281,7 +286,9 @@ 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 + 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 @@ -375,17 +382,19 @@ podusage() { echo + if [ -e "$PERL_PREFIX/bin/perl" ]; then "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ 'pod2usage -input => *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() {