… | |
… | |
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 |
… | |
… | |
60 | ############################################################################# |
61 | ############################################################################# |
61 | # support |
62 | # support |
62 | |
63 | |
63 | # set version in a way that Makefile.PL can extract |
64 | # set version in a way that Makefile.PL can extract |
64 | VERSION=VERSION; eval \ |
65 | VERSION=VERSION; eval \ |
65 | $VERSION=0.1 |
66 | $VERSION=0.9 |
66 | |
67 | |
67 | BZ2=bz2 |
68 | BZ2=bz2 |
68 | BZIP2=bzip2 |
69 | BZIP2=bzip2 |
69 | |
70 | |
70 | fatal() { |
71 | fatal() { |
… | |
… | |
113 | |
114 | |
114 | ############################################################################# |
115 | ############################################################################# |
115 | # download/configure/compile/install perl |
116 | # download/configure/compile/install perl |
116 | |
117 | |
117 | clean() { |
118 | clean() { |
118 | cd "$STATICPERL/src/perl-$PERL_VERSION" 2>/dev/null || return |
119 | rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
119 | |
|
|
120 | rm -f staticstamp.configure |
|
|
121 | make distclean >/dev/null 2>&1 |
|
|
122 | } |
120 | } |
123 | |
121 | |
124 | fetch() { |
122 | fetch() { |
125 | rcd "$STATICPERL" |
123 | rcd "$STATICPERL" |
126 | |
124 | |
… | |
… | |
149 | verblock <<EOF |
147 | verblock <<EOF |
150 | unpacking perl |
148 | unpacking perl |
151 | EOF |
149 | EOF |
152 | |
150 | |
153 | mkdir -p unpack |
151 | mkdir -p unpack |
154 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xpC unpack \ |
152 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xC unpack \ |
155 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
153 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
|
|
154 | chmod -R u+w unpack/perl-$PERL_VERSION |
156 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
155 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
157 | rmdir -p unpack |
156 | rmdir -p unpack |
158 | fi |
157 | fi |
159 | } |
158 | } |
160 | |
159 | |
… | |
… | |
173 | |
172 | |
174 | verblock <<EOF |
173 | verblock <<EOF |
175 | configuring $STATICPERL/src/perl-$PERL_VERSION |
174 | configuring $STATICPERL/src/perl-$PERL_VERSION |
176 | EOF |
175 | EOF |
177 | |
176 | |
178 | clean |
|
|
179 | |
|
|
180 | rm -f "$PERL_PREFIX/staticstamp.install" |
177 | rm -f "$PERL_PREFIX/staticstamp.install" |
|
|
178 | |
|
|
179 | make distclean >/dev/null 2>&1 |
181 | |
180 | |
182 | # I hate them |
181 | # I hate them |
183 | grep -q -- -fstack-protector Configure && \ |
182 | grep -q -- -fstack-protector Configure && \ |
184 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
183 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
|
|
184 | |
|
|
185 | preconfigure |
185 | |
186 | |
186 | # trace configure \ |
187 | # trace configure \ |
187 | sh Configure -Duselargefiles \ |
188 | sh Configure -Duselargefiles \ |
188 | -Uuse64bitint \ |
189 | -Uuse64bitint \ |
189 | -Dusemymalloc=n \ |
190 | -Dusemymalloc=n \ |
… | |
… | |
245 | |
246 | |
246 | postbuild || fatal "postbuild hook failed" |
247 | postbuild || fatal "postbuild hook failed" |
247 | } |
248 | } |
248 | |
249 | |
249 | install() { |
250 | install() { |
250 | [ -e "$PERL_PREFIX/staticstamp.install" ] && return |
251 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
251 | |
|
|
252 | build |
252 | build |
253 | |
253 | |
254 | verblock <<EOF |
254 | verblock <<EOF |
255 | installing $STATICPERL/src/perl-$PERL_VERSION |
255 | installing $STATICPERL/src/perl-$PERL_VERSION |
256 | to $PERL_PREFIX |
256 | to $PERL_PREFIX |
257 | EOF |
257 | EOF |
258 | |
258 | |
259 | rm -rf "$PERL_PREFIX" |
259 | rm -rf "$PERL_PREFIX" |
260 | |
260 | |
261 | make install || fatal "make install: error while installing" |
261 | make install || fatal "make install: error while installing" |
262 | |
262 | |
263 | rcd "$PERL_PREFIX" |
263 | rcd "$PERL_PREFIX" |
264 | |
264 | |
265 | # create a "make install" replacement for CPAN |
265 | # create a "make install" replacement for CPAN |
266 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
266 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
267 | make install UNINST=1 |
267 | make || exit |
|
|
268 | |
268 | if find blib/arch/auto -type f | grep -q -v .exists; then |
269 | if find blib/arch/auto -type f | grep -q -v .exists; then |
269 | echo Probably an XS module, rebuilding perl |
270 | echo Probably an XS module, rebuilding perl |
270 | make perl |
271 | if make perl; then |
271 | rm -f "$PERL_PREFIX"/bin/perl |
272 | mv perl "$PERL_PREFIX"/bin/perl |
272 | make -f Makefile.aperl inst_perl |
|
|
273 | make -f Makefile.aperl map_clean |
273 | make -f Makefile.aperl map_clean |
|
|
274 | else |
|
|
275 | make -f Makefile.aperl map_clean |
|
|
276 | exit 1 |
|
|
277 | fi |
274 | fi |
278 | fi |
|
|
279 | |
|
|
280 | make install UNINST=1 |
275 | EOF |
281 | EOF |
276 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
282 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
277 | |
283 | |
278 | # trick CPAN into avoiding ~/.cpan completely |
284 | # trick CPAN into avoiding ~/.cpan completely |
279 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
285 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
280 | |
286 | |
281 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
287 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
282 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
288 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
283 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
289 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
284 | CPAN::Shell->o (conf => q<init>); |
290 | CPAN::Shell->o (conf => q<init>); |
285 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
291 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
286 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
292 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
287 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
293 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
288 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
294 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
289 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
295 | 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"); |
296 | 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>); |
297 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
292 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
298 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
293 | CPAN::Shell->o (conf => q<commit>); |
299 | CPAN::Shell->o (conf => q<commit>); |
294 | ' || fatal "error while initialising CPAN" |
300 | ' || fatal "error while initialising CPAN" |
295 | |
301 | |
|
|
302 | touch "$PERL_PREFIX/staticstamp.install" |
|
|
303 | fi |
|
|
304 | |
|
|
305 | if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
296 | NOCHECK_INSTALL=+ |
306 | NOCHECK_INSTALL=+ |
297 | instcpan $STATICPERL_MODULES |
307 | instcpan $STATICPERL_MODULES |
298 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
308 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
299 | |
309 | |
300 | postinstall || fatal "postinstall hook failed" |
310 | postinstall || fatal "postinstall hook failed" |
301 | |
311 | |
302 | touch "$PERL_PREFIX/staticstamp.install" |
312 | touch "$PERL_PREFIX/staticstamp.postinstall" |
|
|
313 | fi |
303 | } |
314 | } |
304 | |
315 | |
305 | ############################################################################# |
316 | ############################################################################# |
306 | # install a module from CPAN |
317 | # install a module from CPAN |
307 | |
318 | |
… | |
… | |
419 | mkperl ) |
430 | mkperl ) |
420 | ( install ) |
431 | ( install ) |
421 | bundle --perl "$@" |
432 | bundle --perl "$@" |
422 | exit |
433 | exit |
423 | ;; |
434 | ;; |
|
|
435 | mkapp ) |
|
|
436 | ( install ) |
|
|
437 | bundle --app "$@" |
|
|
438 | exit |
|
|
439 | ;; |
424 | help ) |
440 | help ) |
425 | podusage 2 |
441 | podusage 2 |
426 | ;; |
442 | ;; |
427 | * ) |
443 | * ) |
428 | exec 1>&2 |
444 | exec 1>&2 |