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.11 by root, Wed Dec 8 22:27:35 2010 UTC vs.
Revision 1.17 by root, Sun Dec 12 00:38:36 2010 UTC

2 2
3############################################################################# 3#############################################################################
4# configuration to fill in 4# configuration to fill in
5 5
6STATICPERL=~/.staticperl 6STATICPERL=~/.staticperl
7CPAN=http://mirror.netcologne.de/cpan/ # which mirror to use 7CPAN=http://mirror.netcologne.de/cpan # which mirror to use
8EMAIL="read the documentation <rtfm@example.org>" 8EMAIL="read the documentation <rtfm@example.org>"
9 9
10MKBUNDLE="$STATICPERL/mkbundle"
11
12# perl build variables 10# perl build variables
13PERL_PREFIX="$STATICPERL/perl" # where the perl gets installed
14PERL_VERSION=5.12.2 # 5.8.9 is also a good choice 11PERL_VERSION=5.12.2 # 5.8.9 is also a good choice
15PERL_CONFIGURE="" # additional Configure arguments 12PERL_CONFIGURE="" # additional Configure arguments
16PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" 13PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP"
17PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" 14PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math"
18 15
29 ;; 26 ;;
30esac 27esac
31 28
32# -Wl,--gc-sections makes it impossible to check for undefined references 29# -Wl,--gc-sections makes it impossible to check for undefined references
33# for some reason so we need to patch away the "-no" after Configure and before make :/ 30# for some reason so we need to patch away the "-no" after Configure and before make :/
34# -z muldefs is to work around uclibc's pthread static linking bug 31# --allow-multiple-definition exists to work around uclibc's pthread static linking bug
35PERL_LDFLAGS="-Wl,--no-gc-sections -z muldefs" 32PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition"
36PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself 33PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself
37 34
38# some configuration options for modules 35# some configuration options for modules
39export PERL_MM_USE_DEFAULT=1 36export PERL_MM_USE_DEFAULT=1
40#export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow 37#export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow
52postconfigure() { : ; } 49postconfigure() { : ; }
53postbuild() { : ; } 50postbuild() { : ; }
54postinstall() { : ; } 51postinstall() { : ; }
55 52
56# now source user config, if any 53# now source user config, if any
54if [ "$STATICPERLRC" ]; then
55 . "$STATICPERLRC"
56else
57[ -r /etc/staticperlrc ] && . /etc/staticperlrc 57 [ -r /etc/staticperlrc ] && . /etc/staticperlrc
58[ -r ~/.staticperlrc ] && . ~/.staticperlrc 58 [ -r ~/.staticperlrc ] && . ~/.staticperlrc
59[ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" 59 [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc"
60fi
60 61
61############################################################################# 62#############################################################################
62# support 63# support
64
65MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}"
66PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed
67
68unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG
69export LC_ALL=C # just to be on the safe side
63 70
64# set version in a way that Makefile.PL can extract 71# set version in a way that Makefile.PL can extract
65VERSION=VERSION; eval \ 72VERSION=VERSION; eval \
66$VERSION=0.9 73$VERSION=0.911
67 74
68BZ2=bz2 75BZ2=bz2
69BZIP2=bzip2 76BZIP2=bzip2
70 77
71fatal() { 78fatal() {
104############################################################################# 111#############################################################################
105# clean 112# clean
106 113
107distclean() { 114distclean() {
108 verblock <<EOF 115 verblock <<EOF
109deleting everything installed by this script 116 deleting everything installed by this script (rm -rf $STATICPERL)
110EOF 117EOF
111 118
112 rm -rf "$STATICPERL" 119 rm -rf "$STATICPERL"
113} 120}
114 121
147 verblock <<EOF 154 verblock <<EOF
148unpacking perl 155unpacking perl
149EOF 156EOF
150 157
151 mkdir -p unpack 158 mkdir -p unpack
152 $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xC unpack \ 159 $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \
153 || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" 160 || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking"
154 chmod -R u+w unpack/perl-$PERL_VERSION 161 chmod -R u+w unpack/perl-$PERL_VERSION
155 mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION 162 mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION
156 rmdir -p unpack 163 rmdir -p unpack
157 fi 164 fi
254 verblock <<EOF 261 verblock <<EOF
255installing $STATICPERL/src/perl-$PERL_VERSION 262installing $STATICPERL/src/perl-$PERL_VERSION
256to $PERL_PREFIX 263to $PERL_PREFIX
257EOF 264EOF
258 265
259 rm -rf "$PERL_PREFIX" 266 ln -sf "perl/bin/" "$STATICPERL/bin"
260 267 ln -sf "perl/lib/" "$STATICPERL/lib"
268
269 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten
270 rm -rf "$PERL_PREFIX" # by this rm -rf
271
261 make install || fatal "make install: error while installing" 272 make install || fatal "make install: error while installing"
262 273
263 rcd "$PERL_PREFIX" 274 rcd "$PERL_PREFIX"
264 275
265 # create a "make install" replacement for CPAN 276 # create a "make install" replacement for CPAN
361############################################################################# 372#############################################################################
362# main 373# main
363 374
364podusage() { 375podusage() {
365 echo 376 echo
377
366 if [ -e "$PERL_PREFIX/bin/perl" ]; then 378 if [ -e "$PERL_PREFIX/bin/perl" ]; then
367 "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ 379 "$PERL_PREFIX/bin/perl" -MPod::Usage -e \
368 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ 380 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \
369 2>/dev/null && exit 381 2>/dev/null && exit
370 fi 382 fi
383
371 # try whatever perl we can find 384 # try whatever perl we can find
372 perl -MPod::Usage -e \ 385 perl -MPod::Usage -e \
373 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ 386 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \
374 2>/dev/null && exit 387 2>/dev/null && exit
375 388
376 fatal "displaying documentation requires a working perl - try '$0 install' first" 389 fatal "displaying documentation requires a working perl - try '$0 install' to build one in a safe location"
377} 390}
378 391
379usage() { 392usage() {
380 podusage 0 393 podusage 0
381} 394}
391} 404}
392 405
393bundle() { 406bundle() {
394 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" 407 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create"
395 chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" 408 chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE"
409 CACHE="$STATICPERL/cache"
410 mkdir -p "$CACHE"
396 "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" "$@" 411 "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@"
397} 412}
398 413
399if [ $# -gt 0 ]; then 414if [ $# -gt 0 ]; then
400 while [ $# -gt 0 ]; do 415 while [ $# -gt 0 ]; do
401 mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" 416 mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create"
402 mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create" 417 mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create"
403 418
404 command="${1#--}"; shift 419 command="${1#--}"; shift
405 case "$command" in 420 case "$command" in
421 version )
422 echo "staticperl version $VERSION"
423 ;;
406 fetch | configure | build | install | clean | distclean) 424 fetch | configure | build | install | clean | distclean)
407 verblock <<EOF
408$command
409EOF
410 ( "$command" ) 425 ( "$command" )
411 ;; 426 ;;
412 instsrc ) 427 instsrc )
413 ( instsrc "$@" ) 428 ( instsrc "$@" )
414 exit 429 exit

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines