… | |
… | |
5 | |
5 | |
6 | STATICPERL=~/.staticperl |
6 | STATICPERL=~/.staticperl |
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 | |
|
|
11 | # perl build variables |
10 | # perl build variables |
12 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
11 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
|
|
12 | PERL_CC=cc |
13 | PERL_CONFIGURE="" # additional Configure arguments |
13 | PERL_CONFIGURE="" # additional Configure arguments |
14 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
14 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
15 | PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
15 | PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
16 | |
16 | |
17 | ARCH="$(uname -m)" |
17 | ARCH="$(uname -m)" |
18 | |
18 | |
19 | case "$ARCH" in |
19 | case "$ARCH" in |
20 | i*86 | x86_64 | amd64 ) |
20 | i*86 | x86_64 | amd64 ) |
21 | PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
21 | #PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
|
|
22 | PERL_OPTIMIZE="$PERL_OPTIMIZE" # x86/amd64 |
22 | case "$ARCH" in |
23 | case "$ARCH" in |
23 | i*86 ) |
24 | i*86 ) |
24 | PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only |
25 | PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only |
25 | ;; |
26 | ;; |
26 | esac |
27 | esac |
27 | ;; |
28 | ;; |
28 | esac |
29 | esac |
29 | |
30 | |
30 | # -Wl,--gc-sections makes it impossible to check for undefined references |
31 | # -Wl,--gc-sections makes it impossible to check for undefined references |
31 | # 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 :/ |
32 | # -z muldefs is to work around uclibc's pthread static linking bug |
33 | # --allow-multiple-definition exists to work around uclibc's pthread static linking bug |
33 | PERL_LDFLAGS="-Wl,--no-gc-sections -z muldefs" |
34 | PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
34 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
35 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
35 | |
36 | |
36 | # some configuration options for modules |
37 | # some configuration options for modules |
37 | export PERL_MM_USE_DEFAULT=1 |
38 | export PERL_MM_USE_DEFAULT=1 |
38 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
39 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
… | |
… | |
69 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
70 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
70 | export LC_ALL=C # just to be on the safe side |
71 | export LC_ALL=C # just to be on the safe side |
71 | |
72 | |
72 | # set version in a way that Makefile.PL can extract |
73 | # set version in a way that Makefile.PL can extract |
73 | VERSION=VERSION; eval \ |
74 | VERSION=VERSION; eval \ |
74 | $VERSION=0.9 |
75 | $VERSION=0.911 |
75 | |
76 | |
76 | BZ2=bz2 |
77 | BZ2=bz2 |
77 | BZIP2=bzip2 |
78 | BZIP2=bzip2 |
78 | |
79 | |
79 | fatal() { |
80 | fatal() { |
… | |
… | |
198 | -Dusemymalloc=n \ |
199 | -Dusemymalloc=n \ |
199 | -Uusedl \ |
200 | -Uusedl \ |
200 | -Uusethreads \ |
201 | -Uusethreads \ |
201 | -Uuseithreads \ |
202 | -Uuseithreads \ |
202 | -Uusemultiplicity \ |
203 | -Uusemultiplicity \ |
203 | -Duseperlio \ |
|
|
204 | -Uusesfio \ |
204 | -Uusesfio \ |
205 | -Uuseshrplib \ |
205 | -Uuseshrplib \ |
|
|
206 | -Dcc="$PERL_CC" \ |
206 | -Dcppflags="$PERL_CPPFLAGS" \ |
207 | -Dcppflags="$PERL_CPPFLAGS" \ |
207 | -Dccflags="-g2 -fno-strict-aliasing" \ |
208 | -Dccflags="-g2 -fno-strict-aliasing" \ |
208 | -Doptimize="$PERL_OPTIMIZE" \ |
209 | -Doptimize="$PERL_OPTIMIZE" \ |
209 | -Dldflags="$PERL_LDFLAGS" \ |
210 | -Dldflags="$PERL_LDFLAGS" \ |
210 | -Dlibs="$PERL_LIBS" \ |
211 | -Dlibs="$PERL_LIBS" \ |
… | |
… | |
223 | -Dpager=/usr/bin/less \ |
224 | -Dpager=/usr/bin/less \ |
224 | -Demail="$EMAIL" \ |
225 | -Demail="$EMAIL" \ |
225 | -Dcf_email="$EMAIL" \ |
226 | -Dcf_email="$EMAIL" \ |
226 | -Dcf_by="$EMAIL" \ |
227 | -Dcf_by="$EMAIL" \ |
227 | $PERL_CONFIGURE \ |
228 | $PERL_CONFIGURE \ |
|
|
229 | -Duseperlio \ |
228 | -dE || fatal "Configure failed" |
230 | -dE || fatal "Configure failed" |
229 | |
231 | |
230 | sedreplace ' |
232 | sedreplace ' |
231 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
233 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
232 | s/ *-fno-stack-protector */ /g |
234 | s/ *-fno-stack-protector */ /g |
… | |
… | |
373 | ############################################################################# |
375 | ############################################################################# |
374 | # main |
376 | # main |
375 | |
377 | |
376 | podusage() { |
378 | podusage() { |
377 | echo |
379 | echo |
|
|
380 | |
378 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
381 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
379 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
382 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
380 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
383 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
381 | 2>/dev/null && exit |
384 | 2>/dev/null && exit |
382 | fi |
385 | fi |
|
|
386 | |
383 | # try whatever perl we can find |
387 | # try whatever perl we can find |
384 | perl -MPod::Usage -e \ |
388 | perl -MPod::Usage -e \ |
385 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
389 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
386 | 2>/dev/null && exit |
390 | 2>/dev/null && exit |
387 | |
391 | |
388 | fatal "displaying documentation requires a working perl - try '$0 install' first" |
392 | fatal "displaying documentation requires a working perl - try '$0 install' to build one in a safe location" |
389 | } |
393 | } |
390 | |
394 | |
391 | usage() { |
395 | usage() { |
392 | podusage 0 |
396 | podusage 0 |
393 | } |
397 | } |