ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/staticperl.sh
(Generate patch)

Comparing App-Staticperl/staticperl.sh (file contents):
Revision 1.33 by root, Thu Feb 24 07:10:03 2011 UTC vs.
Revision 1.38 by root, Fri Apr 1 05:58:22 2011 UTC

29esac 29esac
30 30
31# -Wl,--gc-sections makes it impossible to check for undefined references 31# -Wl,--gc-sections makes it impossible to check for undefined references
32# for some reason so we need to patch away the "-no" after Configure and before make :/ 32# for some reason so we need to patch away the "-no" after Configure and before make :/
33# --allow-multiple-definition exists to work around uclibc's pthread static linking bug 33# --allow-multiple-definition exists to work around uclibc's pthread static linking bug
34PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" 34#PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition"
35PERL_LDFLAGS=
35PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself 36PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself
36 37
37# some configuration options for modules 38# some configuration options for modules
38PERL_MM_USE_DEFAULT=1 39PERL_MM_USE_DEFAULT=1
39#CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow 40#CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow
47# which extra modules you might want to install 48# which extra modules you might want to install
48EXTRA_MODULES="" 49EXTRA_MODULES=""
49 50
50# overridable functions 51# overridable functions
51preconfigure() { : ; } 52preconfigure() { : ; }
53patchconfig() { : ; }
52postconfigure() { : ; } 54postconfigure() { : ; }
53postbuild() { : ; } 55postbuild() { : ; }
54postinstall() { : ; } 56postinstall() { : ; }
55 57
56# now source user config, if any 58# now source user config, if any
66# support 68# support
67 69
68MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" 70MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}"
69PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed 71PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed
70 72
71unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG 73unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG
74unset PERL_MM_OPT PERL_MB_OPT
72LC_ALL=C; export LC_ALL # just to be on the safe side 75LC_ALL=C; export LC_ALL # just to be on the safe side
76
77# prepend PATH - not required by staticperl itself, but might make
78# life easier when working in e.g. "staticperl cpan / look"
79PATH="$PERL_PREFIX/perl/bin:$PATH"
73 80
74# set version in a way that Makefile.PL can extract 81# set version in a way that Makefile.PL can extract
75VERSION=VERSION; eval \ 82VERSION=VERSION; eval \
76$VERSION="1.1" 83$VERSION="1.21"
77 84
78BZ2=bz2 85BZ2=bz2
79BZIP2=bzip2 86BZIP2=bzip2
80 87
81fatal() { 88fatal() {
165unpacking perl 172unpacking perl
166EOF 173EOF
167 174
168 mkdir -p unpack 175 mkdir -p unpack
169 rm -rf unpack/perl-$PERL_VERSION 176 rm -rf unpack/perl-$PERL_VERSION
170 $BZIP2 -d <perl-$PERL_VERSION.tar.$BZ2 | tar xfC - unpack \ 177 $BZIP2 -d <perl-$PERL_VERSION.tar.$BZ2 | ( cd unpack && tar xf - ) \
171 || fatal "perl-$PERL_VERSION.tar.$BZ2: error during unpacking" 178 || fatal "perl-$PERL_VERSION.tar.$BZ2: error during unpacking"
172 chmod -R u+w unpack/perl-$PERL_VERSION 179 chmod -R u+w unpack/perl-$PERL_VERSION
173 mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION 180 mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION
174 rmdir -p unpack 181 rmdir -p unpack
175 fi 182 fi
227 234
228 # I hate them for this 235 # I hate them for this
229 grep -q -- -fstack-protector Configure && \ 236 grep -q -- -fstack-protector Configure && \
230 sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure 237 sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure
231 238
232 preconfigure 239 # what did that bloke think
240 grep -q -- usedl=.define hints/darwin.sh && \
241 sedreplace '/^usedl=.define.;$/d' hints/darwin.sh
242
243 preconfigure || fatal "preconfigure hook failed"
233 244
234# trace configure \ 245# trace configure \
235 sh Configure -Duselargefiles \ 246 sh Configure -Duselargefiles \
236 -Uuse64bitint \ 247 -Uuse64bitint \
237 -Dusemymalloc=n \ 248 -Dusemymalloc=n \
269 sedreplace ' 280 sedreplace '
270 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g 281 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g
271 s/ *-fno-stack-protector */ /g 282 s/ *-fno-stack-protector */ /g
272 ' config.sh 283 ' config.sh
273 284
285 patchconfig || fatal "patchconfig hook failed"
286
274 sh Configure -S || fatal "Configure -S failed" 287 sh Configure -S || fatal "Configure -S failed"
275 288
276 postconfigure || fatal "postconfigure hook failed" 289 postconfigure || fatal "postconfigure hook failed"
277 290
278 touch staticstamp.configure 291 touch staticstamp.configure
314 rcd "$PERL_PREFIX" 327 rcd "$PERL_PREFIX"
315 328
316 # create a "make install" replacement for CPAN 329 # create a "make install" replacement for CPAN
317 cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF 330 cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF
318"$MAKE" || exit 331"$MAKE" || exit
332
333# patch CPAN::HandleConfig.pm
334HCPM="$PERL_PREFIX"/lib/CPAN/HandleConfig.pm
335case "\$(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 ;;
347esac
319 348
320if find blib/arch/auto -type f | grep -q -v .exists; then 349if find blib/arch/auto -type f | grep -q -v .exists; then
321 echo Probably an XS module, rebuilding perl 350 echo Probably an XS module, rebuilding perl
322 if "$MAKE" perl; then 351 if "$MAKE" perl; then
323 mv perl "$PERL_PREFIX"/bin/perl~ \ 352 mv perl "$PERL_PREFIX"/bin/perl~ \
335 chmod 755 "$PERL_PREFIX"/bin/cpan-make-install 364 chmod 755 "$PERL_PREFIX"/bin/cpan-make-install
336 365
337 # trick CPAN into avoiding ~/.cpan completely 366 # trick CPAN into avoiding ~/.cpan completely
338 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" 367 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm"
339 368
369 # we call cpan with -MCPAN::MyConfig in this script, but
370 # every make install will patch CPAN::HandleConfig.pm to
371 # protect the user.
372
340 "$PERL_PREFIX"/bin/perl -MCPAN -e ' 373 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
341 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); 374 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
342 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 375 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
343 CPAN::Shell->o (conf => q<init>); 376 CPAN::Shell->o (conf => q<init>);
344 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 377 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
345 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); 378 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build");
347 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); 380 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile");
348 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); 381 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources");
349 CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); 382 CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install");
350 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); 383 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>);
351 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); 384 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>);
385 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM");
352 CPAN::Shell->o (conf => q<commit>); 386 CPAN::Shell->o (conf => q<commit>);
353 ' || fatal "error while initialising CPAN" 387 ' || fatal "error while initialising CPAN"
354 388
355 touch "$PERL_PREFIX/staticstamp.install" 389 touch "$PERL_PREFIX/staticstamp.install"
356 fi 390 fi
376installing modules from CPAN 410installing modules from CPAN
377$@ 411$@
378EOF 412EOF
379 413
380 for mod in "$@"; do 414 for mod in "$@"; do
381 "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ 415 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \
382 || fatal "$mod: unable to install from CPAN" 416 || fatal "$mod: unable to install from CPAN"
383 done 417 done
384 rm -rf "$STATICPERL/build" 418 rm -rf "$STATICPERL/build"
385} 419}
386 420

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines