… | |
… | |
8 | EMAIL="read the documentation <rtfm@example.org>" |
8 | EMAIL="read the documentation <rtfm@example.org>" |
9 | DLCACHE= |
9 | DLCACHE= |
10 | |
10 | |
11 | # perl build variables |
11 | # perl build variables |
12 | MAKE=make |
12 | MAKE=make |
13 | PERL_VERSION=5.12.4 # 5.8.9 is also a good choice |
13 | PERL_VERSION=http://stableperl.schmorp.de/dist/latest.tar.gz # 5.12.5 and 5.8.9 are good choices for small builds |
14 | PERL_CC=cc |
14 | PERL_CC=cc |
15 | PERL_CONFIGURE="" # additional Configure arguments |
15 | PERL_CONFIGURE="" # additional Configure arguments |
16 | PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG" |
16 | PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG" |
17 | PERL_OPTIMIZE="-Os" # -Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
17 | PERL_OPTIMIZE="-Os" # -Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
18 | |
18 | |
… | |
… | |
49 | |
49 | |
50 | # which extra modules you might want to install |
50 | # which extra modules you might want to install |
51 | EXTRA_MODULES="" |
51 | EXTRA_MODULES="" |
52 | |
52 | |
53 | # overridable functions |
53 | # overridable functions |
54 | preconfigure() { : ; } |
54 | preconfigure() { : ; } |
55 | patchconfig() { : ; } |
55 | patchconfig() { : ; } |
56 | postconfigure() { : ; } |
56 | postconfigure() { : ; } |
57 | postbuild() { : ; } |
57 | postbuild() { : ; } |
|
|
58 | postcpanconfig() { : ; } |
58 | postinstall() { : ; } |
59 | postinstall() { : ; } |
59 | |
60 | |
60 | # now source user config, if any |
61 | # now source user config, if any |
61 | if [ "$STATICPERLRC" ]; then |
62 | if [ "$STATICPERLRC" ]; then |
62 | . "$STATICPERLRC" |
63 | . "$STATICPERLRC" |
63 | else |
64 | else |
… | |
… | |
69 | ############################################################################# |
70 | ############################################################################# |
70 | # support |
71 | # support |
71 | |
72 | |
72 | # work around ExtUtils::CBuilder and others |
73 | # work around ExtUtils::CBuilder and others |
73 | export CC="$PERL_CC" |
74 | export CC="$PERL_CC" |
74 | export CFLAGS="$PERL_CFLASGS" |
75 | export CFLAGS="$PERL_CFLAGS" |
75 | export LD="$PERL_CC" |
76 | export LD="$PERL_CC" |
76 | export LDFLAGS="$PERL_LDFLAGS" |
77 | export LDFLAGS="$PERL_LDFLAGS" |
77 | unset LIBS |
78 | unset LIBS |
78 | |
79 | |
79 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
80 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
… | |
… | |
86 | # life easier when working in e.g. "staticperl cpan / look" |
87 | # life easier when working in e.g. "staticperl cpan / look" |
87 | PATH="$PERL_PREFIX/perl/bin:$PATH" |
88 | PATH="$PERL_PREFIX/perl/bin:$PATH" |
88 | |
89 | |
89 | # set version in a way that Makefile.PL can extract |
90 | # set version in a way that Makefile.PL can extract |
90 | VERSION=VERSION; eval \ |
91 | VERSION=VERSION; eval \ |
91 | $VERSION="1.44" |
92 | $VERSION="1.46" |
92 | |
|
|
93 | BZ2=bz2 |
|
|
94 | BZIP2=bzip2 |
|
|
95 | |
93 | |
96 | fatal() { |
94 | fatal() { |
97 | printf -- "\nFATAL: %s\n\n" "$*" >&2 |
95 | printf -- "\nFATAL: %s\n\n" "$*" >&2 |
98 | exit 1 |
96 | exit 1 |
99 | } |
97 | } |
… | |
… | |
145 | } |
143 | } |
146 | |
144 | |
147 | realclean() { |
145 | realclean() { |
148 | rm -f "$PERL_PREFIX/staticstamp.postinstall" |
146 | rm -f "$PERL_PREFIX/staticstamp.postinstall" |
149 | rm -f "$PERL_PREFIX/staticstamp.install" |
147 | rm -f "$PERL_PREFIX/staticstamp.install" |
150 | rm -f "$STATICPERL/src/perl-"*"/staticstamp.configure" |
148 | rm -f "$STATICPERL/src/perl/staticstamp.configure" |
151 | } |
149 | } |
152 | |
150 | |
153 | fetch() { |
151 | fetch() { |
|
|
152 | ( |
154 | rcd "$STATICPERL" |
153 | rcd "$STATICPERL" |
155 | |
154 | |
156 | mkdir -p src |
155 | mkdir -p src |
157 | rcd src |
156 | rcd src |
158 | |
157 | |
159 | 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" |
160 | PERLTAR=perl-$PERL_VERSION.tar.$BZ2 |
178 | PERLTAR=perl-$PERL_VERSION.tar.bz2 |
|
|
179 | ;; |
|
|
180 | esac |
161 | |
181 | |
162 | if ! [ -e $PERLTAR ]; then |
182 | if ! [ -e "$PERLTAR" ]; then |
163 | URL="$CPAN/src/5.0/$PERLTAR" |
|
|
164 | |
|
|
165 | verblock <<EOF |
183 | verblock <<EOF |
166 | downloading perl |
184 | downloading perl |
|
|
185 | |
|
|
186 | trying to download from $PERLURL |
|
|
187 | |
|
|
188 | you can configure a download cache directory via DLCACHE |
|
|
189 | in your .staticperlrc to avoid repeated downloads. |
|
|
190 | |
167 | to manually download perl yourself, place |
191 | to manually download perl yourself, place a suitable tarball in |
168 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
192 | $DLCACHE/$PERLTAR |
169 | trying $URL |
|
|
170 | |
193 | |
171 | either curl or wget is required for automatic download. |
194 | either curl or wget is required for automatic download. |
172 | curl is tried first, then wget. |
195 | curl is tried first, then wget. |
173 | |
|
|
174 | you can configure a download cache directory via DLCACHE |
|
|
175 | in your .staticperlrc to avoid repeated downloads. |
|
|
176 | EOF |
196 | EOF |
177 | |
197 | |
178 | rm -f $PERLTAR~ # just to be on the safe side |
198 | rm -f $PERLTAR~ # just to be on the safe side |
179 | { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~ >/dev/null 2>&1; } \ |
199 | { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~ >/dev/null 2>&1; } \ |
180 | || wget -O $PERLTAR~ "$URL" \ |
200 | || wget -O $PERLTAR~ "$PERLURL" \ |
181 | || curl -f >$PERLTAR~ "$URL" \ |
201 | || curl -f >$PERLTAR~ "$PERLURL" \ |
182 | || fatal "$URL: unable to download" |
202 | || fatal "$URL: unable to download" |
183 | rm -f $PERLTAR |
203 | rm -f $PERLTAR |
184 | mv $PERLTAR~ $PERLTAR |
204 | mv $PERLTAR~ $PERLTAR |
185 | if [ "$DLCACHE" ]; then |
205 | if [ "$DLCACHE" ]; then |
186 | mkdir -p "$DLCACHE" |
206 | mkdir -p "$DLCACHE" |
… | |
… | |
191 | |
211 | |
192 | verblock <<EOF |
212 | verblock <<EOF |
193 | unpacking perl |
213 | unpacking perl |
194 | EOF |
214 | EOF |
195 | |
215 | |
196 | mkdir -p unpack |
216 | case "$PERLTAR" in |
197 | 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 | |
198 | $BZIP2 -d <$PERLTAR | ( cd unpack && tar xf - ) \ |
228 | <"$PERLTAR" $UNCOMPRESS -d | ( cd unpack && tar xf - ) \ |
199 | || fatal "$PERLTAR: error during unpacking" |
229 | || fatal "$PERLTAR: error during unpacking" |
200 | chmod -R u+w unpack/perl-$PERL_VERSION |
230 | |
201 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
231 | if [ -d unpack/*/ ]; then |
|
|
232 | chmod -R u+w unpack/*/ |
|
|
233 | mv unpack/*/ perl |
202 | 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" |
203 | fi |
240 | fi |
|
|
241 | ) || exit |
204 | } |
242 | } |
205 | |
243 | |
206 | # similar to GNU-sed -i or perl -pi |
244 | # similar to GNU-sed -i or perl -pi |
207 | sedreplace() { |
245 | sedreplace() { |
208 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
246 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
… | |
… | |
235 | EOF |
273 | EOF |
236 | exit 1 |
274 | exit 1 |
237 | } |
275 | } |
238 | |
276 | |
239 | configure() { |
277 | configure() { |
|
|
278 | ( |
240 | fetch |
279 | fetch |
241 | |
280 | |
242 | rcd "$STATICPERL/src/perl-$PERL_VERSION" |
281 | rcd "$STATICPERL/src/perl" |
243 | |
282 | |
244 | [ -e staticstamp.configure ] && return |
283 | [ -e staticstamp.configure ] && return |
245 | |
284 | |
246 | verblock <<EOF |
285 | verblock <<EOF |
247 | configuring $STATICPERL/src/perl-$PERL_VERSION |
286 | configuring $STATICPERL/src/perl |
248 | EOF |
287 | EOF |
249 | |
288 | |
250 | rm -f "$PERL_PREFIX/staticstamp.install" |
289 | rm -f "$PERL_PREFIX/staticstamp.install" |
251 | |
290 | |
252 | "$MAKE" distclean >/dev/null 2>&1 |
291 | "$MAKE" distclean >/dev/null 2>&1 |
… | |
… | |
294 | -Demail="$EMAIL" \ |
333 | -Demail="$EMAIL" \ |
295 | -Dcf_email="$EMAIL" \ |
334 | -Dcf_email="$EMAIL" \ |
296 | -Dcf_by="$EMAIL" \ |
335 | -Dcf_by="$EMAIL" \ |
297 | $PERL_CONFIGURE \ |
336 | $PERL_CONFIGURE \ |
298 | -Duseperlio \ |
337 | -Duseperlio \ |
|
|
338 | -Uversiononly \ |
299 | -dE || configure_failure |
339 | -dE || configure_failure |
300 | |
340 | |
301 | sedreplace ' |
341 | sedreplace ' |
302 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
342 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
303 | s/ *-fno-stack-protector */ /g |
343 | s/ *-fno-stack-protector */ /g |
… | |
… | |
308 | sh Configure -S || fatal "Configure -S failed" |
348 | sh Configure -S || fatal "Configure -S failed" |
309 | |
349 | |
310 | postconfigure || fatal "postconfigure hook failed" |
350 | postconfigure || fatal "postconfigure hook failed" |
311 | |
351 | |
312 | : > staticstamp.configure |
352 | : > staticstamp.configure |
|
|
353 | ) || exit |
313 | } |
354 | } |
314 | |
355 | |
315 | write_shellscript() { |
356 | write_shellscript() { |
316 | { |
357 | { |
317 | echo "#!/bin/sh" |
358 | echo "#!/bin/sh" |
… | |
… | |
322 | } >"$PERL_PREFIX/bin/$1" |
363 | } >"$PERL_PREFIX/bin/$1" |
323 | chmod 755 "$PERL_PREFIX/bin/$1" |
364 | chmod 755 "$PERL_PREFIX/bin/$1" |
324 | } |
365 | } |
325 | |
366 | |
326 | build() { |
367 | build() { |
|
|
368 | ( |
327 | configure |
369 | configure |
328 | |
370 | |
329 | rcd "$STATICPERL/src/perl-$PERL_VERSION" |
371 | rcd "$STATICPERL/src/perl" |
330 | |
372 | |
331 | verblock <<EOF |
373 | verblock <<EOF |
332 | building $STATICPERL/src/perl-$PERL_VERSION |
374 | building $STATICPERL/src/perl |
333 | EOF |
375 | EOF |
334 | |
376 | |
335 | rm -f "$PERL_PREFIX/staticstamp.install" |
377 | rm -f "$PERL_PREFIX/staticstamp.install" |
336 | |
378 | |
337 | "$MAKE" || fatal "make: error while building perl" |
379 | "$MAKE" || fatal "make: error while building perl" |
338 | |
380 | |
339 | postbuild || fatal "postbuild hook failed" |
381 | postbuild || fatal "postbuild hook failed" |
|
|
382 | ) || exit |
340 | } |
383 | } |
341 | |
384 | |
342 | _postinstall() { |
385 | _postinstall() { |
343 | if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
386 | if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
344 | NOCHECK_INSTALL=+ |
387 | NOCHECK_INSTALL=+ |
… | |
… | |
350 | : > "$PERL_PREFIX/staticstamp.postinstall" |
393 | : > "$PERL_PREFIX/staticstamp.postinstall" |
351 | fi |
394 | fi |
352 | } |
395 | } |
353 | |
396 | |
354 | install() { |
397 | install() { |
|
|
398 | ( |
355 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
399 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
356 | build |
400 | build |
357 | |
401 | |
358 | verblock <<EOF |
402 | verblock <<EOF |
359 | installing $STATICPERL/src/perl-$PERL_VERSION |
403 | installing $STATICPERL/src/perl |
360 | to $PERL_PREFIX |
404 | to $PERL_PREFIX |
361 | EOF |
405 | EOF |
362 | |
406 | |
363 | ln -sf "perl/bin/" "$STATICPERL/bin" |
407 | ln -sf "perl/bin/" "$STATICPERL/bin" |
364 | ln -sf "perl/lib/" "$STATICPERL/lib" |
408 | ln -sf "perl/lib/" "$STATICPERL/lib" |
… | |
… | |
366 | mkdir "$STATICPERL/patched" |
410 | mkdir "$STATICPERL/patched" |
367 | |
411 | |
368 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
412 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
369 | rm -rf "$PERL_PREFIX" # by this rm -rf |
413 | rm -rf "$PERL_PREFIX" # by this rm -rf |
370 | |
414 | |
|
|
415 | rcd "$STATICPERL/src/perl" |
|
|
416 | |
371 | "$MAKE" install || fatal "make install: error while installing" |
417 | "$MAKE" install || fatal "make install: error while installing" |
372 | |
418 | |
373 | rcd "$PERL_PREFIX" |
419 | rcd "$PERL_PREFIX" |
374 | |
420 | |
375 | # create a "make install" replacement for CPAN |
421 | # create a "make install" replacement for CPAN |
376 | write_shellscript SP-make-install-make <<'EOF' |
422 | write_shellscript SP-make-make <<'end_of_make' |
|
|
423 | #CAT make-make.sh |
|
|
424 | end_of_make |
|
|
425 | |
|
|
426 | # create a "make install" replacement for CPAN |
|
|
427 | write_shellscript SP-make-install-make <<'end_of_make_install_make' |
377 | #CAT make-install-make.sh |
428 | #CAT make-install-make.sh |
378 | EOF |
429 | end_of_make_install_make |
379 | |
430 | |
380 | # create a "patch modules" helper |
431 | # create a "patch modules" helper |
381 | write_shellscript SP-patch-postinstall <<'EOF' |
432 | write_shellscript SP-patch-postinstall <<'end_of_patch_postinstall' |
382 | #CAT patch-postinstall.sh |
433 | #CAT patch-postinstall.sh |
383 | EOF |
434 | end_of_patch_postinstall |
384 | |
435 | |
385 | # immediately use it |
436 | # immediately use it |
386 | "$PERL_PREFIX/bin/SP-patch-postinstall" |
437 | "$PERL_PREFIX/bin/SP-patch-postinstall" |
387 | |
438 | |
388 | # help to trick CPAN into avoiding ~/.cpan completely |
439 | # help to trick CPAN into avoiding ~/.cpan completely |
389 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
440 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
390 | |
441 | |
391 | # we call cpan with -MCPAN::MyConfig in this script, which |
442 | # we call cpan with -MCPAN::MyConfig in this script, which |
392 | # is strictly unnecssary as we have to patch CPAN anyway, |
443 | # is strictly unnecessary as we have to patch CPAN anyway, |
393 | # so consider it "for good measure". |
444 | # so consider it "for good measure". |
394 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
445 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
395 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
446 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
|
|
447 | CPAN::Shell->o (conf => pushy_https => "0"); |
396 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
448 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
397 | CPAN::Shell->o (conf => q<init>); |
449 | CPAN::Shell->o (conf => q<init>); |
398 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
450 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
399 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
451 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
400 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
452 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
401 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
453 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
402 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
454 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
403 | CPAN::Shell->o (conf => q<makepl_arg>, "MAP_TARGET=perl"); |
455 | CPAN::Shell->o (conf => q<makepl_arg>, "MAP_TARGET=perl"); |
|
|
456 | CPAN::Shell->o (conf => q<make>, "'"$PERL_PREFIX"'/bin/SP-make-make"); |
404 | 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"); |
405 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
458 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
406 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<yes>); |
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>); |
407 | CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); |
462 | CPAN::Shell->o (conf => q<prefer_installer>, q<EUMM>); |
408 | CPAN::Shell->o (conf => q<commit>); |
463 | CPAN::Shell->o (conf => q<commit>); |
409 | ' || fatal "error while initialising CPAN" |
464 | ' || fatal "error while initialising CPAN" |
410 | |
465 | |
|
|
466 | postcpanconfig |
|
|
467 | |
411 | : > "$PERL_PREFIX/staticstamp.install" |
468 | : > "$PERL_PREFIX/staticstamp.install" |
412 | fi |
469 | fi |
413 | |
470 | |
414 | _postinstall |
471 | _postinstall |
|
|
472 | ) || exit |
415 | } |
473 | } |
416 | |
474 | |
417 | import() { |
475 | import() { |
|
|
476 | ( |
418 | IMPORT="$1" |
477 | IMPORT="$1" |
419 | |
478 | |
420 | rcd "$STATICPERL" |
479 | rcd "$STATICPERL" |
421 | |
480 | |
422 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
481 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
… | |
… | |
433 | |
492 | |
434 | : > "$PERL_PREFIX/staticstamp.install" |
493 | : > "$PERL_PREFIX/staticstamp.install" |
435 | fi |
494 | fi |
436 | |
495 | |
437 | _postinstall |
496 | _postinstall |
|
|
497 | ) || exit |
438 | } |
498 | } |
439 | |
499 | |
440 | ############################################################################# |
500 | ############################################################################# |
441 | # install a module from CPAN |
501 | # install a module from CPAN |
442 | |
502 | |
443 | instcpan() { |
503 | instcpan() { |
444 | [ $NOCHECK_INSTALL ] || install |
504 | [ $NOCHECK_INSTALL ] || install |
445 | |
505 | |
446 | verblock <<EOF |
506 | verblock <<EOF |
447 | installing modules from CPAN |
507 | installing modules from CPAN |
448 | $@ |
508 | $* |
449 | EOF |
509 | EOF |
450 | |
510 | |
451 | MYCONFIG= |
511 | MYCONFIG= |
452 | [ -e "$PERL_PREFIX/.import" ] || MYCONFIG=-MCPAN::MyConfig |
512 | [ -e "$PERL_PREFIX/.import" ] || MYCONFIG=-MCPAN::MyConfig |
453 | |
513 | |
454 | "$PERL_PREFIX"/bin/perl $MYCONFIG -MCPAN -e 'notest (install => $_) for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log" |
514 | "$PERL_PREFIX"/bin/perl $MYCONFIG -MCPAN -e 'notest (install => $_) for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log" |
455 | |
515 | |
456 | if grep -q " -- NOT OK\$" "$STATICPERL/instcpan.log"; then |
516 | if grep -q " -- NOT OK\$" "$STATICPERL/instcpan.log"; then |
457 | fatal "failure while installing modules from CPAN ($@)" |
517 | fatal "failure while installing modules from CPAN ($*)" |
458 | fi |
518 | fi |
459 | rm -f "$STATICPERL/instcpan.log" |
519 | rm -f "$STATICPERL/instcpan.log" |
460 | } |
520 | } |
461 | |
521 | |
462 | ############################################################################# |
522 | ############################################################################# |
… | |
… | |
465 | instsrc() { |
525 | instsrc() { |
466 | [ $NOCHECK_INSTALL ] || install |
526 | [ $NOCHECK_INSTALL ] || install |
467 | |
527 | |
468 | verblock <<EOF |
528 | verblock <<EOF |
469 | installing modules from source |
529 | installing modules from source |
470 | $@ |
530 | $* |
471 | EOF |
531 | EOF |
472 | |
532 | |
473 | for mod in "$@"; do |
533 | for mod in "$@"; do |
474 | echo |
534 | echo |
475 | echo $mod |
535 | echo $mod |
… | |
… | |
513 | catmkbundle() { |
573 | catmkbundle() { |
514 | { |
574 | { |
515 | read dummy |
575 | read dummy |
516 | echo "#!$PERL_PREFIX/bin/perl" |
576 | echo "#!$PERL_PREFIX/bin/perl" |
517 | cat |
577 | cat |
518 | } <<'MKBUNDLE' |
578 | } <<'end_of_mkbundle' |
519 | #CAT mkbundle |
579 | #CAT mkbundle |
520 | MKBUNDLE |
580 | end_of_mkbundle |
521 | } |
581 | } |
522 | |
582 | |
523 | bundle() { |
583 | bundle() { |
524 | MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}" |
584 | MKBUNDLE="${MKBUNDLE:=$PERL_PREFIX/bin/SP-mkbundle}" |
525 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
585 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |