… | |
… | |
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.2 # 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_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
15 | PERL_CCFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
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 |
21 | i*86 | x86_64 | amd64 ) |
21 | i*86 | x86_64 | amd64 ) |
22 | #PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
22 | PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
23 | PERL_OPTIMIZE="$PERL_OPTIMIZE" # x86/amd64 |
|
|
24 | case "$ARCH" in |
23 | case "$ARCH" in |
25 | i*86 ) |
24 | i*86 ) |
26 | 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 |
27 | ;; |
26 | ;; |
28 | esac |
27 | esac |
… | |
… | |
71 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
70 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
72 | export LC_ALL=C # just to be on the safe side |
71 | export LC_ALL=C # just to be on the safe side |
73 | |
72 | |
74 | # set version in a way that Makefile.PL can extract |
73 | # set version in a way that Makefile.PL can extract |
75 | VERSION=VERSION; eval \ |
74 | VERSION=VERSION; eval \ |
76 | $VERSION=0.911 |
75 | $VERSION=0.912 |
77 | |
76 | |
78 | BZ2=bz2 |
77 | BZ2=bz2 |
79 | BZIP2=bzip2 |
78 | BZIP2=bzip2 |
80 | |
79 | |
81 | fatal() { |
80 | fatal() { |
… | |
… | |
172 | # similar to GNU-sed -i or perl -pi |
171 | # similar to GNU-sed -i or perl -pi |
173 | sedreplace() { |
172 | sedreplace() { |
174 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
173 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
175 | rm -f "$2" |
174 | rm -f "$2" |
176 | mv "$2~" "$2" |
175 | mv "$2~" "$2" |
|
|
176 | } |
|
|
177 | |
|
|
178 | configure_failure() { |
|
|
179 | cat <<EOF |
|
|
180 | |
|
|
181 | |
|
|
182 | *** |
|
|
183 | *** Configure failed - see above for the exact error message(s). |
|
|
184 | *** |
|
|
185 | *** Most commonly, this is because the default PERL_CCFLAGS or PERL_OPTIMIZE |
|
|
186 | *** flags are not supported by your compiler. Less often, this is because |
|
|
187 | *** PERL_LIBS either contains a library not available on your system (such as |
|
|
188 | *** -lcrypt), or because it lacks a required library (e.g. -lsocket or -lnsl). |
|
|
189 | *** |
|
|
190 | *** You can provide your own flags by creating a ~/.staticperlrc file with |
|
|
191 | *** variable assignments. For example (these are the actual values used): |
|
|
192 | *** |
|
|
193 | |
|
|
194 | PERL_CC="$PERL_CC" |
|
|
195 | PERL_CCFLAGS="$PERL_CCFLAGS" |
|
|
196 | PERL_OPTIMIZE="$PERL_OPTIMIZE" |
|
|
197 | PERL_LDFLAGS="$PERL_LDFLAGS" |
|
|
198 | PERL_LIBS="$PERL_LIBS" |
|
|
199 | |
|
|
200 | EOF |
|
|
201 | exit 1 |
177 | } |
202 | } |
178 | |
203 | |
179 | configure() { |
204 | configure() { |
180 | fetch |
205 | fetch |
181 | |
206 | |
… | |
… | |
205 | -Uusethreads \ |
230 | -Uusethreads \ |
206 | -Uuseithreads \ |
231 | -Uuseithreads \ |
207 | -Uusemultiplicity \ |
232 | -Uusemultiplicity \ |
208 | -Uusesfio \ |
233 | -Uusesfio \ |
209 | -Uuseshrplib \ |
234 | -Uuseshrplib \ |
|
|
235 | -A ccflags=" $PERL_CCFLAGS" \ |
210 | -Dcc="$PERL_CC" \ |
236 | -Dcc="$PERL_CC" \ |
211 | -Dcppflags="$PERL_CPPFLAGS" \ |
|
|
212 | -Dccflags="-g2 -fno-strict-aliasing" \ |
|
|
213 | -Doptimize="$PERL_OPTIMIZE" \ |
237 | -Doptimize="$PERL_OPTIMIZE" \ |
214 | -Dldflags="$PERL_LDFLAGS" \ |
238 | -Dldflags="$PERL_LDFLAGS" \ |
215 | -Dlibs="$PERL_LIBS" \ |
239 | -Dlibs="$PERL_LIBS" \ |
216 | -Dprefix="$PERL_PREFIX" \ |
240 | -Dprefix="$PERL_PREFIX" \ |
217 | -Dbin="$PERL_PREFIX/bin" \ |
241 | -Dbin="$PERL_PREFIX/bin" \ |
… | |
… | |
229 | -Demail="$EMAIL" \ |
253 | -Demail="$EMAIL" \ |
230 | -Dcf_email="$EMAIL" \ |
254 | -Dcf_email="$EMAIL" \ |
231 | -Dcf_by="$EMAIL" \ |
255 | -Dcf_by="$EMAIL" \ |
232 | $PERL_CONFIGURE \ |
256 | $PERL_CONFIGURE \ |
233 | -Duseperlio \ |
257 | -Duseperlio \ |
234 | -dE || fatal "Configure failed" |
258 | -dE || configure_failure |
235 | |
259 | |
236 | sedreplace ' |
260 | sedreplace ' |
237 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
261 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
238 | s/ *-fno-stack-protector */ /g |
262 | s/ *-fno-stack-protector */ /g |
239 | ' config.sh |
263 | ' config.sh |
… | |
… | |
429 | case "$command" in |
453 | case "$command" in |
430 | version ) |
454 | version ) |
431 | echo "staticperl version $VERSION" |
455 | echo "staticperl version $VERSION" |
432 | ;; |
456 | ;; |
433 | fetch | configure | build | install | clean | distclean) |
457 | fetch | configure | build | install | clean | distclean) |
434 | ( "$command" ) |
458 | ( "$command" ) || exit |
435 | ;; |
459 | ;; |
436 | instsrc ) |
460 | instsrc ) |
437 | ( instsrc "$@" ) |
461 | ( instsrc "$@" ) || exit |
438 | exit |
462 | exit |
439 | ;; |
463 | ;; |
440 | instcpan ) |
464 | instcpan ) |
441 | ( instcpan "$@" ) |
465 | ( instcpan "$@" ) || exit |
442 | exit |
466 | exit |
443 | ;; |
467 | ;; |
444 | cpan ) |
468 | cpan ) |
445 | ( install ) |
469 | ( install ) || exit |
446 | "$PERL_PREFIX/bin/cpan" "$@" |
470 | "$PERL_PREFIX/bin/cpan" "$@" |
447 | exit |
471 | exit |
448 | ;; |
472 | ;; |
449 | mkbundle ) |
473 | mkbundle ) |
450 | ( install ) |
474 | ( install ) || exit |
451 | bundle "$@" |
475 | bundle "$@" |
452 | exit |
476 | exit |
453 | ;; |
477 | ;; |
454 | mkperl ) |
478 | mkperl ) |
455 | ( install ) |
479 | ( install ) || exit |
456 | bundle --perl "$@" |
480 | bundle --perl "$@" |
457 | exit |
481 | exit |
458 | ;; |
482 | ;; |
459 | mkapp ) |
483 | mkapp ) |
460 | ( install ) |
484 | ( install ) || exit |
461 | bundle --app "$@" |
485 | bundle --app "$@" |
462 | exit |
486 | exit |
463 | ;; |
487 | ;; |
464 | help ) |
488 | help ) |
465 | podusage 2 |
489 | podusage 2 |