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.37 by root, Fri Mar 18 19:49:04 2011 UTC vs.
Revision 1.40 by root, Sun May 1 07:56:26 2011 UTC

35PERL_LDFLAGS= 35PERL_LDFLAGS=
36PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself 36PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself
37 37
38# some configuration options for modules 38# some configuration options for modules
39PERL_MM_USE_DEFAULT=1 39PERL_MM_USE_DEFAULT=1
40PERL_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
41EV_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' 42EV_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'
42export PERL_MM_USE_DEFAULT CORO_INTERFACE EV_EXTRA_DEFS 43export 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
46STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" 47STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage"
47 48
65fi 66fi
66 67
67############################################################################# 68#############################################################################
68# support 69# support
69 70
70MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}"
71PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed 71PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed
72 72
73unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG 73unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG
74unset PERL_MB_OPT
74LC_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"
75 80
76# set version in a way that Makefile.PL can extract 81# set version in a way that Makefile.PL can extract
77VERSION=VERSION; eval \ 82VERSION=VERSION; eval \
78$VERSION="1.21" 83$VERSION="1.21"
79 84
284 postconfigure || fatal "postconfigure hook failed" 289 postconfigure || fatal "postconfigure hook failed"
285 290
286 touch staticstamp.configure 291 touch staticstamp.configure
287} 292}
288 293
294write_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
289build() { 305build() {
290 configure 306 configure
291 307
292 rcd "$STATICPERL/src/perl-$PERL_VERSION" 308 rcd "$STATICPERL/src/perl-$PERL_VERSION"
293 309
312EOF 328EOF
313 329
314 ln -sf "perl/bin/" "$STATICPERL/bin" 330 ln -sf "perl/bin/" "$STATICPERL/bin"
315 ln -sf "perl/lib/" "$STATICPERL/lib" 331 ln -sf "perl/lib/" "$STATICPERL/lib"
316 332
333 mkdir "$STATICPERL/patched"
334
317 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten 335 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten
318 rm -rf "$PERL_PREFIX" # by this rm -rf 336 rm -rf "$PERL_PREFIX" # by this rm -rf
319 337
320 "$MAKE" install || fatal "make install: error while installing" 338 "$MAKE" install || fatal "make install: error while installing"
321 339
322 rcd "$PERL_PREFIX" 340 rcd "$PERL_PREFIX"
323 341
324 # create a "make install" replacement for CPAN 342 # create a "make install" replacement for CPAN
325 cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF 343 write_shellscript SP-make-install-make <<'EOF'
326"$MAKE" || exit 344#CAT make-install-make.sh
327
328# patch CPAN::HandleConfig.pm
329HCPM="$PERL_PREFIX"/lib/CPAN/HandleConfig.pm
330case "\$(head -n1 "\$HCPM")" in
331 *CPAN::MyConfig* )
332 ;;
333 * )
334 echo "patching \$HCPM for a safer tomorrow"
335 {
336 echo "use CPAN::MyConfig;"
337 cat "\$HCPM"
338 } >"\$HCPM~"
339 rm -f "\$HCPM"
340 mv "\$HCPM~" "\$HCPM"
341 ;;
342esac
343
344if find blib/arch/auto -type f | grep -q -v .exists; then
345 echo Probably an XS module, rebuilding perl
346 if "$MAKE" perl; then
347 mv perl "$PERL_PREFIX"/bin/perl~ \
348 && rm -f "$PERL_PREFIX"/bin/perl \
349 && mv "$PERL_PREFIX"/bin/perl~ "$PERL_PREFIX"/bin/perl
350 "$MAKE" -f Makefile.aperl map_clean
351 else
352 "$MAKE" -f Makefile.aperl map_clean
353 exit 1
354 fi
355fi
356
357"$MAKE" install UNINST=1
358EOF 345EOF
359 chmod 755 "$PERL_PREFIX"/bin/cpan-make-install
360 346
347 # create a "patch modules" helper
348 write_shellscript SP-patch-postinstall <<'EOF'
349#CAT patch-postinstall.sh
350EOF
351
352 "$PERL_PREFIX/bin/SP-patch-postinstall"
353
361 # trick CPAN into avoiding ~/.cpan completely 354 # help to trick CPAN into avoiding ~/.cpan completely
362 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" 355 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm"
363 356
364 # we call cpan with -MCPAN::MyConfig in this script, but 357 # we call cpan with -MCPAN::MyConfig in this script, which
365 # every make install will patch CPAN::HandleConfig.pm to 358 # is strictly unnecssary as we have to patch CPAN anyway,
366 # protect the user. 359 # so consider it "for good measure".
367
368 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' 360 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
369 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); 361 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
370 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 362 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
371 CPAN::Shell->o (conf => q<init>); 363 CPAN::Shell->o (conf => q<init>);
372 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 364 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
373 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); 365 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build");
374 CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); 366 CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs");
375 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); 367 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile");
376 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); 368 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources");
377 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");
378 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); 370 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>);
379 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); 371 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>);
380 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); 372 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM");
381 CPAN::Shell->o (conf => q<commit>); 373 CPAN::Shell->o (conf => q<commit>);
382 ' || fatal "error while initialising CPAN" 374 ' || fatal "error while initialising CPAN"
431 rcd $mod 423 rcd $mod
432 "$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1 424 "$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1
433 "$MAKE" distclean >/dev/null 2>&1 425 "$MAKE" distclean >/dev/null 2>&1
434 "$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"
435 "$MAKE" || fatal "$mod: error building module" 427 "$MAKE" || fatal "$mod: error building module"
436 "$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"
437 "$MAKE" distclean >/dev/null 2>&1 429 "$MAKE" distclean >/dev/null 2>&1
438 exit 0 430 exit 0
439 ) || exit $? 431 ) || exit $?
440 done 432 done
441} 433}
473#CAT mkbundle 465#CAT mkbundle
474MKBUNDLE 466MKBUNDLE
475} 467}
476 468
477bundle() { 469bundle() {
470 MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}"
478 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" 471 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create"
479 chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" 472 chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE"
480 CACHE="$STATICPERL/cache" 473 CACHE="$STATICPERL/cache"
481 mkdir -p "$CACHE" 474 mkdir -p "$CACHE"
482 "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" 475 "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@"
501 ;; 494 ;;
502 instcpan ) 495 instcpan )
503 ( instcpan "$@" ) || exit 496 ( instcpan "$@" ) || exit
504 exit 497 exit
505 ;; 498 ;;
499 perl )
500 ( install ) || exit
501 exec "$PERL_PREFIX/bin/perl" "$@"
502 exit
503 ;;
506 cpan ) 504 cpan )
507 ( install ) || exit 505 ( install ) || exit
508 "$PERL_PREFIX/bin/cpan" "$@" 506 exec "$PERL_PREFIX/bin/cpan" "$@"
509 exit 507 exit
510 ;; 508 ;;
511 mkbundle ) 509 mkbundle )
512 ( install ) || exit 510 ( install ) || exit
513 bundle "$@" 511 bundle "$@"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines