… | |
… | |
46 | |
46 | |
47 | # which extra modules you might want to install |
47 | # which extra modules you might want to install |
48 | EXTRA_MODULES="" |
48 | EXTRA_MODULES="" |
49 | |
49 | |
50 | # overridable functions |
50 | # overridable functions |
|
|
51 | preconfigure() { : ; } |
51 | postconfigure() { : ; } |
52 | postconfigure() { : ; } |
52 | postbuild() { : ; } |
53 | postbuild() { : ; } |
53 | postinstall() { : ; } |
54 | postinstall() { : ; } |
54 | |
55 | |
55 | # now source user config, if any |
56 | # now source user config, if any |
… | |
… | |
58 | [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
59 | [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
59 | |
60 | |
60 | ############################################################################# |
61 | ############################################################################# |
61 | # support |
62 | # support |
62 | |
63 | |
|
|
64 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
|
|
65 | export LC_ALL=C # just to be on the safe side |
|
|
66 | |
63 | # set version in a way that Makefile.PL can extract |
67 | # set version in a way that Makefile.PL can extract |
64 | VERSION=VERSION; eval \ |
68 | VERSION=VERSION; eval \ |
65 | $VERSION=0.1 |
69 | $VERSION=0.9 |
66 | |
70 | |
67 | BZ2=bz2 |
71 | BZ2=bz2 |
68 | BZIP2=bzip2 |
72 | BZIP2=bzip2 |
69 | |
73 | |
70 | fatal() { |
74 | fatal() { |
… | |
… | |
113 | |
117 | |
114 | ############################################################################# |
118 | ############################################################################# |
115 | # download/configure/compile/install perl |
119 | # download/configure/compile/install perl |
116 | |
120 | |
117 | clean() { |
121 | clean() { |
118 | cd "$STATICPERL/src/perl-$PERL_VERSION" 2>/dev/null || return |
122 | rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
119 | |
|
|
120 | rm -f staticstamp.configure |
|
|
121 | make distclean >/dev/null 2>&1 |
|
|
122 | } |
123 | } |
123 | |
124 | |
124 | fetch() { |
125 | fetch() { |
125 | rcd "$STATICPERL" |
126 | rcd "$STATICPERL" |
126 | |
127 | |
… | |
… | |
149 | verblock <<EOF |
150 | verblock <<EOF |
150 | unpacking perl |
151 | unpacking perl |
151 | EOF |
152 | EOF |
152 | |
153 | |
153 | mkdir -p unpack |
154 | mkdir -p unpack |
154 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xpC unpack \ |
155 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \ |
155 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
156 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
|
|
157 | chmod -R u+w unpack/perl-$PERL_VERSION |
156 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
158 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
157 | rmdir -p unpack |
159 | rmdir -p unpack |
158 | fi |
160 | fi |
159 | } |
161 | } |
160 | |
162 | |
… | |
… | |
173 | |
175 | |
174 | verblock <<EOF |
176 | verblock <<EOF |
175 | configuring $STATICPERL/src/perl-$PERL_VERSION |
177 | configuring $STATICPERL/src/perl-$PERL_VERSION |
176 | EOF |
178 | EOF |
177 | |
179 | |
178 | clean |
|
|
179 | |
|
|
180 | rm -f "$PERL_PREFIX/staticstamp.install" |
180 | rm -f "$PERL_PREFIX/staticstamp.install" |
|
|
181 | |
|
|
182 | make distclean >/dev/null 2>&1 |
181 | |
183 | |
182 | # I hate them |
184 | # I hate them |
183 | grep -q -- -fstack-protector Configure && \ |
185 | grep -q -- -fstack-protector Configure && \ |
184 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
186 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
|
|
187 | |
|
|
188 | preconfigure |
185 | |
189 | |
186 | # trace configure \ |
190 | # trace configure \ |
187 | sh Configure -Duselargefiles \ |
191 | sh Configure -Duselargefiles \ |
188 | -Uuse64bitint \ |
192 | -Uuse64bitint \ |
189 | -Dusemymalloc=n \ |
193 | -Dusemymalloc=n \ |
… | |
… | |
245 | |
249 | |
246 | postbuild || fatal "postbuild hook failed" |
250 | postbuild || fatal "postbuild hook failed" |
247 | } |
251 | } |
248 | |
252 | |
249 | install() { |
253 | install() { |
250 | [ -e "$PERL_PREFIX/staticstamp.install" ] && return |
254 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
251 | |
|
|
252 | build |
255 | build |
253 | |
256 | |
254 | verblock <<EOF |
257 | verblock <<EOF |
255 | installing $STATICPERL/src/perl-$PERL_VERSION |
258 | installing $STATICPERL/src/perl-$PERL_VERSION |
256 | to $PERL_PREFIX |
259 | to $PERL_PREFIX |
257 | EOF |
260 | EOF |
258 | |
261 | |
259 | rm -rf "$PERL_PREFIX" |
262 | rm -rf "$PERL_PREFIX" |
260 | |
263 | |
261 | make install || fatal "make install: error while installing" |
264 | make install || fatal "make install: error while installing" |
262 | |
265 | |
263 | rcd "$PERL_PREFIX" |
266 | rcd "$PERL_PREFIX" |
264 | |
267 | |
265 | # create a "make install" replacement for CPAN |
268 | # create a "make install" replacement for CPAN |
266 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
269 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
267 | make install UNINST=1 |
270 | make || exit |
|
|
271 | |
268 | if find blib/arch/auto -type f | grep -q -v .exists; then |
272 | if find blib/arch/auto -type f | grep -q -v .exists; then |
269 | echo Probably an XS module, rebuilding perl |
273 | echo Probably an XS module, rebuilding perl |
270 | make perl |
274 | if make perl; then |
271 | rm -f "$PERL_PREFIX"/bin/perl |
275 | mv perl "$PERL_PREFIX"/bin/perl |
272 | make -f Makefile.aperl inst_perl |
|
|
273 | make -f Makefile.aperl map_clean |
276 | make -f Makefile.aperl map_clean |
|
|
277 | else |
|
|
278 | make -f Makefile.aperl map_clean |
|
|
279 | exit 1 |
|
|
280 | fi |
274 | fi |
281 | fi |
|
|
282 | |
|
|
283 | make install UNINST=1 |
275 | EOF |
284 | EOF |
276 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
285 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
277 | |
286 | |
278 | # trick CPAN into avoiding ~/.cpan completely |
287 | # trick CPAN into avoiding ~/.cpan completely |
279 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
288 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
280 | |
289 | |
281 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
290 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
282 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
291 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
283 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
292 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
284 | CPAN::Shell->o (conf => q<init>); |
293 | CPAN::Shell->o (conf => q<init>); |
285 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
294 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
286 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
295 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
287 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
296 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
288 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
297 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
289 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
298 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
290 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
299 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
291 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
300 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
292 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
301 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
293 | CPAN::Shell->o (conf => q<commit>); |
302 | CPAN::Shell->o (conf => q<commit>); |
294 | ' || fatal "error while initialising CPAN" |
303 | ' || fatal "error while initialising CPAN" |
295 | |
304 | |
|
|
305 | touch "$PERL_PREFIX/staticstamp.install" |
|
|
306 | fi |
|
|
307 | |
|
|
308 | if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
296 | NOCHECK_INSTALL=+ |
309 | NOCHECK_INSTALL=+ |
297 | instcpan $STATICPERL_MODULES |
310 | instcpan $STATICPERL_MODULES |
298 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
311 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
299 | |
312 | |
300 | postinstall || fatal "postinstall hook failed" |
313 | postinstall || fatal "postinstall hook failed" |
301 | |
314 | |
302 | touch "$PERL_PREFIX/staticstamp.install" |
315 | touch "$PERL_PREFIX/staticstamp.postinstall" |
|
|
316 | fi |
303 | } |
317 | } |
304 | |
318 | |
305 | ############################################################################# |
319 | ############################################################################# |
306 | # install a module from CPAN |
320 | # install a module from CPAN |
307 | |
321 | |
… | |
… | |
380 | } |
394 | } |
381 | |
395 | |
382 | bundle() { |
396 | bundle() { |
383 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
397 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
384 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
398 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
|
|
399 | CACHE="$STATICPERL/cache" |
|
|
400 | mkdir -p "$CACHE" |
385 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" "$@" |
401 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" |
386 | } |
402 | } |
387 | |
403 | |
388 | if [ $# -gt 0 ]; then |
404 | if [ $# -gt 0 ]; then |
389 | while [ $# -gt 0 ]; do |
405 | while [ $# -gt 0 ]; do |
390 | mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
406 | mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
… | |
… | |
419 | mkperl ) |
435 | mkperl ) |
420 | ( install ) |
436 | ( install ) |
421 | bundle --perl "$@" |
437 | bundle --perl "$@" |
422 | exit |
438 | exit |
423 | ;; |
439 | ;; |
|
|
440 | mkapp ) |
|
|
441 | ( install ) |
|
|
442 | bundle --app "$@" |
|
|
443 | exit |
|
|
444 | ;; |
424 | help ) |
445 | help ) |
425 | podusage 2 |
446 | podusage 2 |
426 | ;; |
447 | ;; |
427 | * ) |
448 | * ) |
428 | exec 1>&2 |
449 | exec 1>&2 |