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.16 by root, Sat Dec 11 15:51:38 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
391} 402}
392 403
393bundle() { 404bundle() {
394 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" 405 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create"
395 chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" 406 chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE"
407 CACHE="$STATICPERL/cache"
408 mkdir -p "$CACHE"
396 "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" "$@" 409 "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@"
397} 410}
398 411
399if [ $# -gt 0 ]; then 412if [ $# -gt 0 ]; then
400 while [ $# -gt 0 ]; do 413 while [ $# -gt 0 ]; do
401 mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" 414 mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create"
402 mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create" 415 mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create"
403 416
404 command="${1#--}"; shift 417 command="${1#--}"; shift
405 case "$command" in 418 case "$command" in
419 version )
420 echo "staticperl version $VERSION"
421 ;;
406 fetch | configure | build | install | clean | distclean) 422 fetch | configure | build | install | clean | distclean)
407 verblock <<EOF
408$command
409EOF
410 ( "$command" ) 423 ( "$command" )
411 ;; 424 ;;
412 instsrc ) 425 instsrc )
413 ( instsrc "$@" ) 426 ( instsrc "$@" )
414 exit 427 exit

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines