… | |
… | |
7 | CPAN=http://mirror.netcologne.de/cpan # which mirror to use |
7 | CPAN=http://mirror.netcologne.de/cpan # which mirror to use |
8 | EMAIL="read the documentation <rtfm@example.org>" |
8 | EMAIL="read the documentation <rtfm@example.org>" |
9 | |
9 | |
10 | # perl build variables |
10 | # perl build variables |
11 | MAKE=make |
11 | MAKE=make |
12 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
12 | PERL_VERSION=5.12.3 # 5.8.9 is also a good choice |
13 | PERL_CC=cc |
13 | PERL_CC=cc |
14 | PERL_CONFIGURE="" # additional Configure arguments |
14 | PERL_CONFIGURE="" # additional Configure arguments |
15 | PERL_CCFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG" |
15 | PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG" |
16 | PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
16 | PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
17 | |
17 | |
18 | ARCH="$(uname -m)" |
18 | ARCH="$(uname -m)" |
19 | |
19 | |
20 | case "$ARCH" in |
20 | case "$ARCH" in |
… | |
… | |
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 |
34 | PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
34 | PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
35 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
35 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 | |
36 | |
37 | # some configuration options for modules |
37 | # some configuration options for modules |
38 | export PERL_MM_USE_DEFAULT=1 |
38 | PERL_MM_USE_DEFAULT=1 |
39 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
39 | #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
40 | export EV_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' |
40 | EV_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' |
|
|
41 | export PERL_MM_USE_DEFAULT CORO_INTERFACE EV_EXTRA_DEFS |
41 | |
42 | |
42 | # which extra modules to install by default from CPAN that are |
43 | # which extra modules to install by default from CPAN that are |
43 | # required by mkbundle |
44 | # required by mkbundle |
44 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
45 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
45 | |
46 | |
… | |
… | |
66 | |
67 | |
67 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
68 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
68 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
69 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
69 | |
70 | |
70 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
71 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
71 | export LC_ALL=C # just to be on the safe side |
72 | LC_ALL=C; export LC_ALL # just to be on the safe side |
72 | |
73 | |
73 | # set version in a way that Makefile.PL can extract |
74 | # set version in a way that Makefile.PL can extract |
74 | VERSION=VERSION; eval \ |
75 | VERSION=VERSION; eval \ |
75 | $VERSION=0.912 |
76 | $VERSION="1.2" |
76 | |
77 | |
77 | BZ2=bz2 |
78 | BZ2=bz2 |
78 | BZIP2=bzip2 |
79 | BZIP2=bzip2 |
79 | |
80 | |
80 | fatal() { |
81 | fatal() { |
… | |
… | |
151 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
152 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
152 | trying $URL |
153 | trying $URL |
153 | EOF |
154 | EOF |
154 | |
155 | |
155 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
156 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
|
|
157 | curl -f >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
156 | wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
158 | || wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
157 | || curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
|
|
158 | || fatal "$URL: unable to download" |
159 | || fatal "$URL: unable to download" |
159 | rm -f perl-$PERL_VERSION.tar.$BZ2 |
160 | rm -f perl-$PERL_VERSION.tar.$BZ2 |
160 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
161 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
161 | fi |
162 | fi |
162 | |
163 | |
… | |
… | |
164 | unpacking perl |
165 | unpacking perl |
165 | EOF |
166 | EOF |
166 | |
167 | |
167 | mkdir -p unpack |
168 | mkdir -p unpack |
168 | rm -rf unpack/perl-$PERL_VERSION |
169 | rm -rf unpack/perl-$PERL_VERSION |
169 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \ |
170 | $BZIP2 -d <perl-$PERL_VERSION.tar.$BZ2 | ( cd unpack && tar x ) \ |
170 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
171 | || fatal "perl-$PERL_VERSION.tar.$BZ2: error during unpacking" |
171 | chmod -R u+w unpack/perl-$PERL_VERSION |
172 | chmod -R u+w unpack/perl-$PERL_VERSION |
172 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
173 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
173 | rmdir -p unpack |
174 | rmdir -p unpack |
174 | fi |
175 | fi |
175 | } |
176 | } |
… | |
… | |
238 | -Uusethreads \ |
239 | -Uusethreads \ |
239 | -Uuseithreads \ |
240 | -Uuseithreads \ |
240 | -Uusemultiplicity \ |
241 | -Uusemultiplicity \ |
241 | -Uusesfio \ |
242 | -Uusesfio \ |
242 | -Uuseshrplib \ |
243 | -Uuseshrplib \ |
|
|
244 | -Uinstallusrbinperl \ |
243 | -A ccflags=" $PERL_CCFLAGS" \ |
245 | -A ccflags=" $PERL_CCFLAGS" \ |
244 | -Dcc="$PERL_CC" \ |
246 | -Dcc="$PERL_CC" \ |
245 | -Doptimize="$PERL_OPTIMIZE" \ |
247 | -Doptimize="$PERL_OPTIMIZE" \ |
246 | -Dldflags="$PERL_LDFLAGS" \ |
248 | -Dldflags="$PERL_LDFLAGS" \ |
247 | -Dlibs="$PERL_LIBS" \ |
249 | -Dlibs="$PERL_LIBS" \ |
… | |
… | |
313 | |
315 | |
314 | # create a "make install" replacement for CPAN |
316 | # create a "make install" replacement for CPAN |
315 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
317 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
316 | "$MAKE" || exit |
318 | "$MAKE" || exit |
317 | |
319 | |
|
|
320 | # patch CPAN::HandleConfig.pm |
|
|
321 | HCPM="$PERL_PREFIX"/lib/CPAN/HandleConfig.pm |
|
|
322 | case "\$(head -n1 "\$HCPM")" in |
|
|
323 | *CPAN::MyConfig* ) |
|
|
324 | ;; |
|
|
325 | * ) |
|
|
326 | echo "patching \$HCPM for a safer tomorrow" |
|
|
327 | { |
|
|
328 | echo "use CPAN::MyConfig;" |
|
|
329 | cat "\$HCPM" |
|
|
330 | } >"\$HCPM~" |
|
|
331 | rm -f "\$HCPM" |
|
|
332 | mv "\$HCPM~" "\$HCPM" |
|
|
333 | ;; |
|
|
334 | esac |
|
|
335 | |
318 | if find blib/arch/auto -type f | grep -q -v .exists; then |
336 | if find blib/arch/auto -type f | grep -q -v .exists; then |
319 | echo Probably an XS module, rebuilding perl |
337 | echo Probably an XS module, rebuilding perl |
320 | if "$MAKE" perl; then |
338 | if "$MAKE" perl; then |
321 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
339 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
322 | && rm -f "$PERL_PREFIX"/bin/perl \ |
340 | && rm -f "$PERL_PREFIX"/bin/perl \ |
… | |
… | |
333 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
351 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
334 | |
352 | |
335 | # trick CPAN into avoiding ~/.cpan completely |
353 | # trick CPAN into avoiding ~/.cpan completely |
336 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
354 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
337 | |
355 | |
|
|
356 | # we call cpan with -MCPAN::MyConfig in this script, but |
|
|
357 | # every make install will patch CPAN::HandleConfig.pm to |
|
|
358 | # protect the user. |
|
|
359 | |
338 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
360 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
339 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
361 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
340 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
362 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
341 | CPAN::Shell->o (conf => q<init>); |
363 | CPAN::Shell->o (conf => q<init>); |
342 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
364 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
343 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
365 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
… | |
… | |
345 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
367 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
346 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
368 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
347 | 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/cpan-make-install"); |
348 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
370 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
349 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
371 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
|
|
372 | CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); |
350 | CPAN::Shell->o (conf => q<commit>); |
373 | CPAN::Shell->o (conf => q<commit>); |
351 | ' || fatal "error while initialising CPAN" |
374 | ' || fatal "error while initialising CPAN" |
352 | |
375 | |
353 | touch "$PERL_PREFIX/staticstamp.install" |
376 | touch "$PERL_PREFIX/staticstamp.install" |
354 | fi |
377 | fi |
… | |
… | |
374 | installing modules from CPAN |
397 | installing modules from CPAN |
375 | $@ |
398 | $@ |
376 | EOF |
399 | EOF |
377 | |
400 | |
378 | for mod in "$@"; do |
401 | for mod in "$@"; do |
379 | "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ |
402 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \ |
380 | || fatal "$mod: unable to install from CPAN" |
403 | || fatal "$mod: unable to install from CPAN" |
381 | done |
404 | done |
382 | rm -rf "$STATICPERL/build" |
405 | rm -rf "$STATICPERL/build" |
383 | } |
406 | } |
384 | |
407 | |