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.25 by root, Tue Dec 28 18:03:47 2010 UTC vs.
Revision 1.38 by root, Fri Apr 1 05:58:22 2011 UTC

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
10# perl build variables 10# perl build variables
11MAKE=make 11MAKE=make
12PERL_VERSION=5.12.2 # 5.8.9 is also a good choice 12PERL_VERSION=5.12.3 # 5.8.9 is also a good choice
13PERL_CC=cc 13PERL_CC=cc
14PERL_CONFIGURE="" # additional Configure arguments 14PERL_CONFIGURE="" # additional Configure arguments
15PERL_CCFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG" 15PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG"
16PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" 16PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math"
17 17
18ARCH="$(uname -m)" 18ARCH="$(uname -m)"
19 19
20case "$ARCH" in 20case "$ARCH" in
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=0.92 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
176} 183}
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 \
239 -Uusethreads \ 250 -Uusethreads \
240 -Uuseithreads \ 251 -Uuseithreads \
241 -Uusemultiplicity \ 252 -Uusemultiplicity \
242 -Uusesfio \ 253 -Uusesfio \
243 -Uuseshrplib \ 254 -Uuseshrplib \
255 -Uinstallusrbinperl \
244 -A ccflags=" $PERL_CCFLAGS" \ 256 -A ccflags=" $PERL_CCFLAGS" \
245 -Dcc="$PERL_CC" \ 257 -Dcc="$PERL_CC" \
246 -Doptimize="$PERL_OPTIMIZE" \ 258 -Doptimize="$PERL_OPTIMIZE" \
247 -Dldflags="$PERL_LDFLAGS" \ 259 -Dldflags="$PERL_LDFLAGS" \
248 -Dlibs="$PERL_LIBS" \ 260 -Dlibs="$PERL_LIBS" \
268 sedreplace ' 280 sedreplace '
269 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g 281 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g
270 s/ *-fno-stack-protector */ /g 282 s/ *-fno-stack-protector */ /g
271 ' config.sh 283 ' config.sh
272 284
285 patchconfig || fatal "patchconfig hook failed"
286
273 sh Configure -S || fatal "Configure -S failed" 287 sh Configure -S || fatal "Configure -S failed"
274 288
275 postconfigure || fatal "postconfigure hook failed" 289 postconfigure || fatal "postconfigure hook failed"
276 290
277 touch staticstamp.configure 291 touch staticstamp.configure
313 rcd "$PERL_PREFIX" 327 rcd "$PERL_PREFIX"
314 328
315 # create a "make install" replacement for CPAN 329 # create a "make install" replacement for CPAN
316 cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF 330 cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF
317"$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
318 348
319if find blib/arch/auto -type f | grep -q -v .exists; then 349if find blib/arch/auto -type f | grep -q -v .exists; then
320 echo Probably an XS module, rebuilding perl 350 echo Probably an XS module, rebuilding perl
321 if "$MAKE" perl; then 351 if "$MAKE" perl; then
322 mv perl "$PERL_PREFIX"/bin/perl~ \ 352 mv perl "$PERL_PREFIX"/bin/perl~ \
334 chmod 755 "$PERL_PREFIX"/bin/cpan-make-install 364 chmod 755 "$PERL_PREFIX"/bin/cpan-make-install
335 365
336 # trick CPAN into avoiding ~/.cpan completely 366 # trick CPAN into avoiding ~/.cpan completely
337 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" 367 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm"
338 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
339 "$PERL_PREFIX"/bin/perl -MCPAN -e ' 373 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
340 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); 374 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
341 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 375 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
342 CPAN::Shell->o (conf => q<init>); 376 CPAN::Shell->o (conf => q<init>);
343 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 377 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
344 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); 378 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build");
346 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); 380 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile");
347 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); 381 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources");
348 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");
349 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); 383 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>);
350 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");
351 CPAN::Shell->o (conf => q<commit>); 386 CPAN::Shell->o (conf => q<commit>);
352 ' || fatal "error while initialising CPAN" 387 ' || fatal "error while initialising CPAN"
353 388
354 touch "$PERL_PREFIX/staticstamp.install" 389 touch "$PERL_PREFIX/staticstamp.install"
355 fi 390 fi
375installing modules from CPAN 410installing modules from CPAN
376$@ 411$@
377EOF 412EOF
378 413
379 for mod in "$@"; do 414 for mod in "$@"; do
380 "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ 415 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \
381 || fatal "$mod: unable to install from CPAN" 416 || fatal "$mod: unable to install from CPAN"
382 done 417 done
383 rm -rf "$STATICPERL/build" 418 rm -rf "$STATICPERL/build"
384} 419}
385 420

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines