… | |
… | |
29 | esac |
29 | esac |
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 |
34 | PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
34 | #PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
|
|
35 | PERL_LDFLAGS= |
35 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 | |
37 | |
37 | # some configuration options for modules |
38 | # some configuration options for modules |
38 | PERL_MM_USE_DEFAULT=1 |
39 | PERL_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 |
48 | EXTRA_MODULES="" |
49 | EXTRA_MODULES="" |
49 | |
50 | |
50 | # overridable functions |
51 | # overridable functions |
51 | preconfigure() { : ; } |
52 | preconfigure() { : ; } |
|
|
53 | patchconfig() { : ; } |
52 | postconfigure() { : ; } |
54 | postconfigure() { : ; } |
53 | postbuild() { : ; } |
55 | postbuild() { : ; } |
54 | postinstall() { : ; } |
56 | postinstall() { : ; } |
55 | |
57 | |
56 | # now source user config, if any |
58 | # now source user config, if any |
… | |
… | |
66 | # support |
68 | # support |
67 | |
69 | |
68 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
70 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
69 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
71 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
70 | |
72 | |
71 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
73 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
|
|
74 | unset PERL_MM_OPT PERL_MB_OPT |
72 | LC_ALL=C; export LC_ALL # just to be on the safe side |
75 | LC_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" |
|
|
79 | PATH="$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 |
75 | VERSION=VERSION; eval \ |
82 | VERSION=VERSION; eval \ |
76 | $VERSION="1.1" |
83 | $VERSION="1.21" |
77 | |
84 | |
78 | BZ2=bz2 |
85 | BZ2=bz2 |
79 | BZIP2=bzip2 |
86 | BZIP2=bzip2 |
80 | |
87 | |
81 | fatal() { |
88 | fatal() { |
… | |
… | |
165 | unpacking perl |
172 | unpacking perl |
166 | EOF |
173 | EOF |
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 |
… | |
… | |
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 \ |
… | |
… | |
269 | sedreplace ' |
280 | sedreplace ' |
270 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
281 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
271 | s/ *-fno-stack-protector */ /g |
282 | s/ *-fno-stack-protector */ /g |
272 | ' config.sh |
283 | ' config.sh |
273 | |
284 | |
|
|
285 | patchconfig || fatal "patchconfig hook failed" |
|
|
286 | |
274 | sh Configure -S || fatal "Configure -S failed" |
287 | sh Configure -S || fatal "Configure -S failed" |
275 | |
288 | |
276 | postconfigure || fatal "postconfigure hook failed" |
289 | postconfigure || fatal "postconfigure hook failed" |
277 | |
290 | |
278 | touch staticstamp.configure |
291 | touch staticstamp.configure |
… | |
… | |
314 | rcd "$PERL_PREFIX" |
327 | rcd "$PERL_PREFIX" |
315 | |
328 | |
316 | # create a "make install" replacement for CPAN |
329 | # create a "make install" replacement for CPAN |
317 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
330 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
318 | "$MAKE" || exit |
331 | "$MAKE" || exit |
|
|
332 | |
|
|
333 | # patch CPAN::HandleConfig.pm |
|
|
334 | HCPM="$PERL_PREFIX"/lib/CPAN/HandleConfig.pm |
|
|
335 | case "\$(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 | ;; |
|
|
347 | esac |
319 | |
348 | |
320 | if find blib/arch/auto -type f | grep -q -v .exists; then |
349 | if find blib/arch/auto -type f | grep -q -v .exists; then |
321 | echo Probably an XS module, rebuilding perl |
350 | echo Probably an XS module, rebuilding perl |
322 | if "$MAKE" perl; then |
351 | if "$MAKE" perl; then |
323 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
352 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
… | |
… | |
335 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
364 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
336 | |
365 | |
337 | # trick CPAN into avoiding ~/.cpan completely |
366 | # trick CPAN into avoiding ~/.cpan completely |
338 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
367 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
339 | |
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 | |
340 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
373 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
341 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
374 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
342 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
375 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
343 | CPAN::Shell->o (conf => q<init>); |
376 | CPAN::Shell->o (conf => q<init>); |
344 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
377 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
345 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
378 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
… | |
… | |
347 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
380 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
348 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
381 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
349 | 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"); |
350 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
383 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
351 | 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"); |
352 | CPAN::Shell->o (conf => q<commit>); |
386 | CPAN::Shell->o (conf => q<commit>); |
353 | ' || fatal "error while initialising CPAN" |
387 | ' || fatal "error while initialising CPAN" |
354 | |
388 | |
355 | touch "$PERL_PREFIX/staticstamp.install" |
389 | touch "$PERL_PREFIX/staticstamp.install" |
356 | fi |
390 | fi |
… | |
… | |
376 | installing modules from CPAN |
410 | installing modules from CPAN |
377 | $@ |
411 | $@ |
378 | EOF |
412 | EOF |
379 | |
413 | |
380 | for mod in "$@"; do |
414 | for mod in "$@"; do |
381 | "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ |
415 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \ |
382 | || fatal "$mod: unable to install from CPAN" |
416 | || fatal "$mod: unable to install from CPAN" |
383 | done |
417 | done |
384 | rm -rf "$STATICPERL/build" |
418 | rm -rf "$STATICPERL/build" |
385 | } |
419 | } |
386 | |
420 | |