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.46 by root, Sun Jun 26 17:27:18 2011 UTC vs.
Revision 1.75 by root, Tue Aug 1 03:48:59 2023 UTC

8EMAIL="read the documentation <rtfm@example.org>" 8EMAIL="read the documentation <rtfm@example.org>"
9DLCACHE= 9DLCACHE=
10 10
11# perl build variables 11# perl build variables
12MAKE=make 12MAKE=make
13PERL_VERSION=5.12.3 # 5.8.9 is also a good choice 13PERL_VERSION=http://stableperl.schmorp.de/dist/latest.tar.gz # 5.12.5 and 5.8.9 are good choices for small builds
14PERL_CC=cc 14PERL_CC=cc
15PERL_CONFIGURE="" # additional Configure arguments 15PERL_CONFIGURE="" # additional Configure arguments
16PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG" 16PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG"
17PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" 17PERL_OPTIMIZE="-Os" # -Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math"
18 18
19ARCH="$(uname -m)" 19ARCH="$(uname -m)"
20 20
21case "$ARCH" in 21#case "$ARCH" in
22 i*86 | x86_64 | amd64 ) 22# i*86 | x86_64 | amd64 )
23 PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 23# PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64
24 case "$ARCH" in 24# case "$ARCH" in
25 i*86 ) 25# i*86 )
26 PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only 26# PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only
27 ;; 27# ;;
28 esac 28# esac
29 ;; 29# ;;
30esac 30#esac
31 31
32# -Wl,--gc-sections makes it impossible to check for undefined references 32# -Wl,--gc-sections makes it impossible to check for undefined references
33# for some reason so we need to patch away the "-no" after Configure and before make :/ 33# for some reason so we need to patch away the "-no" after Configure and before make :/
34# --allow-multiple-definition exists to work around uclibc's pthread static linking bug 34# --allow-multiple-definition exists to work around uclibc's pthread static linking bug
35#PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" 35#PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition"
38 38
39# some configuration options for modules 39# some configuration options for modules
40PERL_MM_USE_DEFAULT=1 40PERL_MM_USE_DEFAULT=1
41PERL_MM_OPT="MAN1PODS= MAN3PODS=" 41PERL_MM_OPT="MAN1PODS= MAN3PODS="
42#CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow 42#CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow
43EV_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' 43#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'
44export PERL_MM_USE_DEFAULT PERL_MM_OPT CORO_INTERFACE EV_EXTRA_DEFS 44export PERL_MM_USE_DEFAULT PERL_MM_OPT
45 45
46# which extra modules to install by default from CPAN that are 46# which extra modules to install by default from CPAN that are
47# required by mkbundle 47# required by mkbundle
48STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" 48STATICPERL_MODULES="ExtUtils::MakeMaker ExtUtils::CBuilder common::sense Pod::Strip PPI PPI::XS Pod::Usage"
49 49
50# which extra modules you might want to install 50# which extra modules you might want to install
51EXTRA_MODULES="" 51EXTRA_MODULES=""
52 52
53# overridable functions 53# overridable functions
54preconfigure() { : ; } 54preconfigure() { : ; }
55patchconfig() { : ; } 55patchconfig() { : ; }
56postconfigure() { : ; } 56postconfigure() { : ; }
57postbuild() { : ; } 57postbuild() { : ; }
58postcpanconfig() { : ; }
58postinstall() { : ; } 59postinstall() { : ; }
59 60
60# now source user config, if any 61# now source user config, if any
61if [ "$STATICPERLRC" ]; then 62if [ "$STATICPERLRC" ]; then
62 . "$STATICPERLRC" 63 . "$STATICPERLRC"
63else 64else
67fi 68fi
68 69
69############################################################################# 70#############################################################################
70# support 71# support
71 72
73# work around ExtUtils::CBuilder and others
74export CC="$PERL_CC"
75export CFLAGS="$PERL_CFLAGS"
76export LD="$PERL_CC"
77export LDFLAGS="$PERL_LDFLAGS"
78unset LIBS
79
72PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed 80PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed
73 81
74unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG 82unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG
75unset PERL_MB_OPT 83unset PERL_MB_OPT
76LC_ALL=C; export LC_ALL # just to be on the safe side 84LC_ALL=C; export LC_ALL # just to be on the safe side
79# life easier when working in e.g. "staticperl cpan / look" 87# life easier when working in e.g. "staticperl cpan / look"
80PATH="$PERL_PREFIX/perl/bin:$PATH" 88PATH="$PERL_PREFIX/perl/bin:$PATH"
81 89
82# set version in a way that Makefile.PL can extract 90# set version in a way that Makefile.PL can extract
83VERSION=VERSION; eval \ 91VERSION=VERSION; eval \
84$VERSION="1.31" 92$VERSION="1.46"
85
86BZ2=bz2
87BZIP2=bzip2
88 93
89fatal() { 94fatal() {
90 printf -- "\nFATAL: %s\n\n" "$*" >&2 95 printf -- "\nFATAL: %s\n\n" "$*" >&2
91 exit 1 96 exit 1
92} 97}
132 137
133############################################################################# 138#############################################################################
134# download/configure/compile/install perl 139# download/configure/compile/install perl
135 140
136clean() { 141clean() {
137 rm -rf "$STATICPERL/src/perl-$PERL_VERSION" 142 rm -rf "$STATICPERL/src"
138} 143}
139 144
140realclean() { 145realclean() {
141 rm -f "$PERL_PREFIX/staticstamp.postinstall" 146 rm -f "$PERL_PREFIX/staticstamp.postinstall"
142 rm -f "$PERL_PREFIX/staticstamp.install" 147 rm -f "$PERL_PREFIX/staticstamp.install"
143 rm -f "$STATICPERL/src/perl-"*"/staticstamp.configure" 148 rm -f "$STATICPERL/src/perl/staticstamp.configure"
144} 149}
145 150
146fetch() { 151fetch() {
152(
147 rcd "$STATICPERL" 153 rcd "$STATICPERL"
148 154
149 mkdir -p src 155 mkdir -p src
150 rcd src 156 rcd src
151 157
152 if ! [ -d "perl-$PERL_VERSION" ]; then 158 if ! [ -d "perl" ]; then
159 rm -rf unpack
160 mkdir -p unpack
161
162 case "$PERL_VERSION" in
163 *:* )
164 # url
165 PERLURL="$PERL_VERSION"
166 PERLTAR="$(basename "$PERL_VERSION")"
167 ;;
168 /* )
169 # directory
170 verbose "copying $PERL_VERSION"
171 cp -Rp "$PERL_VERSION/." unpack/.
172 chmod -R u+w unpack
173 mv unpack perl
174 return
175 ;;
176 * )
177 PERLURL="$CPAN/src/5.0/perl-$PERL_VERSION.tar.bz2"
153 PERLTAR=perl-$PERL_VERSION.tar.$BZ2 178 PERLTAR=perl-$PERL_VERSION.tar.bz2
179 ;;
180 esac
154 181
155 if ! [ -e $PERLTAR ]; then 182 if ! [ -e "$PERLTAR" ]; then
156 URL="$CPAN/src/5.0/$PERLTAR"
157
158 verblock <<EOF 183 verblock <<EOF
159downloading perl 184downloading perl
185
186trying to download from $PERLURL
187
188you can configure a download cache directory via DLCACHE
189in your .staticperlrc to avoid repeated downloads.
190
160to manually download perl yourself, place 191to manually download perl yourself, place a suitable tarball in
161perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL 192$DLCACHE/$PERLTAR
162trying $URL
163 193
164either curl or wget is required for automatic download. 194either curl or wget is required for automatic download.
165curl is tried first, then wget. 195curl is tried first, then wget.
166
167you can configure a download cache directory via DLCACHE
168in your .staticperlrc to avoid repeated downloads.
169EOF 196EOF
170 197
171 rm -f $PERLTAR~ # just to be on the safe side 198 rm -f $PERLTAR~ # just to be on the safe side
172 { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~; } \ 199 { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~ >/dev/null 2>&1; } \
173 || wget -O $PERLTAR~ "$URL" \ 200 || wget -O $PERLTAR~ "$PERLURL" \
174 || curl -f >$PERLTAR~ "$URL" \ 201 || curl -f >$PERLTAR~ "$PERLURL" \
175 || fatal "$URL: unable to download" 202 || fatal "$URL: unable to download"
176 rm -f $PERLTAR 203 rm -f $PERLTAR
177 mv $PERLTAR~ $PERLTAR 204 mv $PERLTAR~ $PERLTAR
178 if [ "$DLCACHE" ]; then 205 if [ "$DLCACHE" ]; then
179 mkdir -p "$DLCACHE" 206 mkdir -p "$DLCACHE"
180 cp $PERLTAR "$DLCACHE"/$PERLTAR~ && \ 207 cp $PERLTAR "$DLCACHE"/$PERLTAR~$$~ && \
181 mv "$DLCACHE"/$PERLTAR~ "$DLCACHE"/$PERLTAR 208 mv "$DLCACHE"/$PERLTAR~$$~ "$DLCACHE"/$PERLTAR
182 fi 209 fi
183 fi 210 fi
184 211
185 verblock <<EOF 212 verblock <<EOF
186unpacking perl 213unpacking perl
187EOF 214EOF
188 215
189 mkdir -p unpack 216 case "$PERLTAR" in
190 rm -rf unpack/perl-$PERL_VERSION 217 *.xz ) UNCOMPRESS="xz -d" ;;
218 *.lzma ) UNCOMPRESS="lzma -d" ;;
219 *.bz2 ) UNCOMPRESS="bzip2 -d" ;;
220 *.gz ) UNCOMPRESS="gzip -d" ;;
221 *.tar ) UNCOMPRESS="cat" ;;
222 * )
223 fatal "don't know hot to uncompress $PERLTAR,\nonly tar, tar.gz, tar.bz2, tar.lzma and tar.xz are supported."
224 exit 1
225 ;;
226 esac
227
191 $BZIP2 -d <$PERLTAR | ( cd unpack && tar xf - ) \ 228 <"$PERLTAR" $UNCOMPRESS -d | ( cd unpack && tar xf - ) \
192 || fatal "$PERLTAR: error during unpacking" 229 || fatal "$PERLTAR: error during unpacking"
193 chmod -R u+w unpack/perl-$PERL_VERSION 230
194 mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION 231 if [ -d unpack/*/ ]; then
232 chmod -R u+w unpack/*/
233 mv unpack/*/ perl
195 rmdir -p unpack 234 rmdir -p unpack
235 else
236 fatal "unpacking $PERLTAR did not result in a single directory, don't know how to handle this"
237 fi
238
239 rm "$PERLTAR"
196 fi 240 fi
241) || exit
197} 242}
198 243
199# similar to GNU-sed -i or perl -pi 244# similar to GNU-sed -i or perl -pi
200sedreplace() { 245sedreplace() {
201 sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" 246 sed -e "$1" <"$2" > "$2~" || fatal "error while running sed"
228EOF 273EOF
229 exit 1 274 exit 1
230} 275}
231 276
232configure() { 277configure() {
278(
233 fetch 279 fetch
234 280
235 rcd "$STATICPERL/src/perl-$PERL_VERSION" 281 rcd "$STATICPERL/src/perl"
236 282
237 [ -e staticstamp.configure ] && return 283 [ -e staticstamp.configure ] && return
238 284
239 verblock <<EOF 285 verblock <<EOF
240configuring $STATICPERL/src/perl-$PERL_VERSION 286configuring $STATICPERL/src/perl
241EOF 287EOF
242 288
243 rm -f "$PERL_PREFIX/staticstamp.install" 289 rm -f "$PERL_PREFIX/staticstamp.install"
244 290
245 "$MAKE" distclean >/dev/null 2>&1 291 "$MAKE" distclean >/dev/null 2>&1
287 -Demail="$EMAIL" \ 333 -Demail="$EMAIL" \
288 -Dcf_email="$EMAIL" \ 334 -Dcf_email="$EMAIL" \
289 -Dcf_by="$EMAIL" \ 335 -Dcf_by="$EMAIL" \
290 $PERL_CONFIGURE \ 336 $PERL_CONFIGURE \
291 -Duseperlio \ 337 -Duseperlio \
338 -Uversiononly \
292 -dE || configure_failure 339 -dE || configure_failure
293 340
294 sedreplace ' 341 sedreplace '
295 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g 342 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g
296 s/ *-fno-stack-protector */ /g 343 s/ *-fno-stack-protector */ /g
300 347
301 sh Configure -S || fatal "Configure -S failed" 348 sh Configure -S || fatal "Configure -S failed"
302 349
303 postconfigure || fatal "postconfigure hook failed" 350 postconfigure || fatal "postconfigure hook failed"
304 351
305 touch staticstamp.configure 352 : > staticstamp.configure
353) || exit
306} 354}
307 355
308write_shellscript() { 356write_shellscript() {
309 { 357 {
310 echo "#!/bin/sh" 358 echo "#!/bin/sh"
315 } >"$PERL_PREFIX/bin/$1" 363 } >"$PERL_PREFIX/bin/$1"
316 chmod 755 "$PERL_PREFIX/bin/$1" 364 chmod 755 "$PERL_PREFIX/bin/$1"
317} 365}
318 366
319build() { 367build() {
368(
320 configure 369 configure
321 370
322 rcd "$STATICPERL/src/perl-$PERL_VERSION" 371 rcd "$STATICPERL/src/perl"
323 372
324 verblock <<EOF 373 verblock <<EOF
325building $STATICPERL/src/perl-$PERL_VERSION 374building $STATICPERL/src/perl
326EOF 375EOF
327 376
328 rm -f "$PERL_PREFIX/staticstamp.install" 377 rm -f "$PERL_PREFIX/staticstamp.install"
329 378
330 "$MAKE" || fatal "make: error while building perl" 379 "$MAKE" || fatal "make: error while building perl"
331 380
332 postbuild || fatal "postbuild hook failed" 381 postbuild || fatal "postbuild hook failed"
382) || exit
383}
384
385_postinstall() {
386 if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then
387 NOCHECK_INSTALL=+
388 instcpan $STATICPERL_MODULES
389 [ "$EXTRA_MODULES" ] && instcpan $EXTRA_MODULES
390
391 postinstall || fatal "postinstall hook failed"
392
393 : > "$PERL_PREFIX/staticstamp.postinstall"
394 fi
333} 395}
334 396
335install() { 397install() {
398(
336 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then 399 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
337 build 400 build
338 401
339 verblock <<EOF 402 verblock <<EOF
340installing $STATICPERL/src/perl-$PERL_VERSION 403installing $STATICPERL/src/perl
341to $PERL_PREFIX 404to $PERL_PREFIX
342EOF 405EOF
343 406
344 ln -sf "perl/bin/" "$STATICPERL/bin" 407 ln -sf "perl/bin/" "$STATICPERL/bin"
345 ln -sf "perl/lib/" "$STATICPERL/lib" 408 ln -sf "perl/lib/" "$STATICPERL/lib"
347 mkdir "$STATICPERL/patched" 410 mkdir "$STATICPERL/patched"
348 411
349 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten 412 ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten
350 rm -rf "$PERL_PREFIX" # by this rm -rf 413 rm -rf "$PERL_PREFIX" # by this rm -rf
351 414
415 rcd "$STATICPERL/src/perl"
416
352 "$MAKE" install || fatal "make install: error while installing" 417 "$MAKE" install || fatal "make install: error while installing"
353 418
354 rcd "$PERL_PREFIX" 419 rcd "$PERL_PREFIX"
355 420
356 # create a "make install" replacement for CPAN 421 # create a "make install" replacement for CPAN
357 write_shellscript SP-make-install-make <<'EOF' 422 write_shellscript SP-make-make <<'end_of_make'
423#CAT make-make.sh
424end_of_make
425
426 # create a "make install" replacement for CPAN
427 write_shellscript SP-make-install-make <<'end_of_make_install_make'
358#CAT make-install-make.sh 428#CAT make-install-make.sh
359EOF 429end_of_make_install_make
360 430
361 # create a "patch modules" helper 431 # create a "patch modules" helper
362 write_shellscript SP-patch-postinstall <<'EOF' 432 write_shellscript SP-patch-postinstall <<'end_of_patch_postinstall'
363#CAT patch-postinstall.sh 433#CAT patch-postinstall.sh
364EOF 434end_of_patch_postinstall
365 435
436 # immediately use it
366 "$PERL_PREFIX/bin/SP-patch-postinstall" 437 "$PERL_PREFIX/bin/SP-patch-postinstall"
367 438
368 # help to trick CPAN into avoiding ~/.cpan completely 439 # help to trick CPAN into avoiding ~/.cpan completely
369 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" 440 echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm"
370 441
371 # we call cpan with -MCPAN::MyConfig in this script, which 442 # we call cpan with -MCPAN::MyConfig in this script, which
372 # is strictly unnecssary as we have to patch CPAN anyway, 443 # is strictly unnecessary as we have to patch CPAN anyway,
373 # so consider it "for good measure". 444 # so consider it "for good measure".
374 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' 445 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
375 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); 446 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
447 CPAN::Shell->o (conf => pushy_https => "0");
376 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 448 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
377 CPAN::Shell->o (conf => q<init>); 449 CPAN::Shell->o (conf => q<init>);
378 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); 450 CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
379 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); 451 CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build");
380 CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); 452 CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs");
381 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); 453 CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile");
382 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); 454 CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources");
455 CPAN::Shell->o (conf => q<makepl_arg>, "MAP_TARGET=perl");
456 CPAN::Shell->o (conf => q<make>, "'"$PERL_PREFIX"'/bin/SP-make-make");
383 CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/SP-make-install-make"); 457 CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/SP-make-install-make");
384 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); 458 CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>);
385 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); 459 CPAN::Shell->o (conf => q<build_requires_install_policy>, q<yes>);
460 CPAN::Shell->o (conf => q<recommends_policy>, q<0>);
461 CPAN::Shell->o (conf => q<suggests_policy>, q<0>);
386 CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); 462 CPAN::Shell->o (conf => q<prefer_installer>, q<EUMM>);
387 CPAN::Shell->o (conf => q<commit>); 463 CPAN::Shell->o (conf => q<commit>);
388 ' || fatal "error while initialising CPAN" 464 ' || fatal "error while initialising CPAN"
389 465
466 postcpanconfig
467
390 touch "$PERL_PREFIX/staticstamp.install" 468 : > "$PERL_PREFIX/staticstamp.install"
391 fi 469 fi
392 470
471 _postinstall
472) || exit
473}
474
475import() {
476(
477 IMPORT="$1"
478
479 rcd "$STATICPERL"
480
393 if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then 481 if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
394 NOCHECK_INSTALL=+ 482 verblock <<EOF
395 instcpan $STATICPERL_MODULES 483import perl from $IMPORT to $STATICPERL
396 [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES 484EOF
397 485
398 postinstall || fatal "postinstall hook failed" 486 rm -rf bin cpan lib patched perl src
487 mkdir -m 755 perl perl/bin
488 ln -s perl/bin/ bin
489 ln -s "$IMPORT" perl/bin/
399 490
491 echo "$IMPORT" > "$PERL_PREFIX/.import"
492
400 touch "$PERL_PREFIX/staticstamp.postinstall" 493 : > "$PERL_PREFIX/staticstamp.install"
401 fi 494 fi
495
496 _postinstall
497) || exit
402} 498}
403 499
404############################################################################# 500#############################################################################
405# install a module from CPAN 501# install a module from CPAN
406 502
407instcpan() { 503instcpan() {
408 [ $NOCHECK_INSTALL ] || install 504 [ $NOCHECK_INSTALL ] || install
409 505
410 verblock <<EOF 506 verblock <<EOF
411installing modules from CPAN 507installing modules from CPAN
412$@ 508$*
413EOF 509EOF
414 510
415 for mod in "$@"; do 511 MYCONFIG=
416 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \ 512 [ -e "$PERL_PREFIX/.import" ] || MYCONFIG=-MCPAN::MyConfig
417 || fatal "$mod: unable to install from CPAN" 513
418 done 514 "$PERL_PREFIX"/bin/perl $MYCONFIG -MCPAN -e 'notest (install => $_) for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log"
515
516 if grep -q " -- NOT OK\$" "$STATICPERL/instcpan.log"; then
517 fatal "failure while installing modules from CPAN ($*)"
518 fi
419 rm -rf "$STATICPERL/build" 519 rm -f "$STATICPERL/instcpan.log"
420} 520}
421 521
422############################################################################# 522#############################################################################
423# install a module from unpacked sources 523# install a module from unpacked sources
424 524
425instsrc() { 525instsrc() {
426 [ $NOCHECK_INSTALL ] || install 526 [ $NOCHECK_INSTALL ] || install
427 527
428 verblock <<EOF 528 verblock <<EOF
429installing modules from source 529installing modules from source
430$@ 530$*
431EOF 531EOF
432 532
433 for mod in "$@"; do 533 for mod in "$@"; do
434 echo 534 echo
435 echo $mod 535 echo $mod
473catmkbundle() { 573catmkbundle() {
474 { 574 {
475 read dummy 575 read dummy
476 echo "#!$PERL_PREFIX/bin/perl" 576 echo "#!$PERL_PREFIX/bin/perl"
477 cat 577 cat
478 } <<'MKBUNDLE' 578 } <<'end_of_mkbundle'
479#CAT mkbundle 579#CAT mkbundle
480MKBUNDLE 580end_of_mkbundle
481} 581}
482 582
483bundle() { 583bundle() {
484 MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}" 584 MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}"
485 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" 585 catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create"
497 command="${1#--}"; shift 597 command="${1#--}"; shift
498 case "$command" in 598 case "$command" in
499 version ) 599 version )
500 echo "staticperl version $VERSION" 600 echo "staticperl version $VERSION"
501 ;; 601 ;;
502 fetch | configure | build | install | clean | realclean | distclean) 602 fetch | configure | build | install | clean | realclean | distclean )
503 ( "$command" ) || exit 603 ( "$command" ) || exit
604 ;;
605 import )
606 ( import "$1" ) || exit
607 shift
504 ;; 608 ;;
505 instsrc ) 609 instsrc )
506 ( instsrc "$@" ) || exit 610 ( instsrc "$@" ) || exit
507 exit 611 exit
508 ;; 612 ;;
515 exec "$PERL_PREFIX/bin/perl" "$@" 619 exec "$PERL_PREFIX/bin/perl" "$@"
516 exit 620 exit
517 ;; 621 ;;
518 cpan ) 622 cpan )
519 ( install ) || exit 623 ( install ) || exit
624 PERL="$PERL_PREFIX/bin/perl"
625 export PERL
520 exec "$PERL_PREFIX/bin/cpan" "$@" 626 exec "$PERL_PREFIX/bin/cpan" "$@"
521 exit 627 exit
522 ;; 628 ;;
523 mkbundle ) 629 mkbundle )
524 ( install ) || exit 630 ( install ) || exit

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines