… | |
… | |
5 | |
5 | |
6 | STATICPERL=~/.staticperl |
6 | STATICPERL=~/.staticperl |
7 | CPAN=http://mirror.netcologne.de/cpan # which mirror to use |
7 | CPAN=http://mirror.netcologne.de/cpan # which mirror to use |
8 | EMAIL="read the documentation <rtfm@example.org>" |
8 | EMAIL="read the documentation <rtfm@example.org>" |
9 | |
9 | |
10 | |
|
|
11 | # perl build variables |
10 | # perl build variables |
|
|
11 | MAKE=make |
12 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
12 | PERL_VERSION=5.12.3 # 5.8.9 is also a good choice |
|
|
13 | PERL_CC=cc |
13 | PERL_CONFIGURE="" # additional Configure arguments |
14 | PERL_CONFIGURE="" # additional Configure arguments |
14 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
15 | PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG" |
15 | 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" |
16 | |
17 | |
17 | ARCH="$(uname -m)" |
18 | ARCH="$(uname -m)" |
18 | |
19 | |
19 | case "$ARCH" in |
20 | case "$ARCH" in |
… | |
… | |
27 | ;; |
28 | ;; |
28 | esac |
29 | esac |
29 | |
30 | |
30 | # -Wl,--gc-sections makes it impossible to check for undefined references |
31 | # -Wl,--gc-sections makes it impossible to check for undefined references |
31 | # for some reason so we need to patch away the "-no" after Configure and before make :/ |
32 | # for some reason so we need to patch away the "-no" after Configure and before make :/ |
32 | # -z muldefs is to work around uclibc's pthread static linking bug |
33 | # --allow-multiple-definition exists to work around uclibc's pthread static linking bug |
33 | PERL_LDFLAGS="-Wl,--no-gc-sections -z muldefs" |
34 | #PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
|
|
35 | PERL_LDFLAGS= |
34 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
35 | |
37 | |
36 | # some configuration options for modules |
38 | # some configuration options for modules |
37 | export PERL_MM_USE_DEFAULT=1 |
39 | PERL_MM_USE_DEFAULT=1 |
38 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
40 | #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
39 | export 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' |
41 | 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' |
|
|
42 | export PERL_MM_USE_DEFAULT CORO_INTERFACE EV_EXTRA_DEFS |
40 | |
43 | |
41 | # which extra modules to install by default from CPAN that are |
44 | # which extra modules to install by default from CPAN that are |
42 | # required by mkbundle |
45 | # required by mkbundle |
43 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
46 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
44 | |
47 | |
45 | # which extra modules you might want to install |
48 | # which extra modules you might want to install |
46 | EXTRA_MODULES="" |
49 | EXTRA_MODULES="" |
47 | |
50 | |
48 | # overridable functions |
51 | # overridable functions |
49 | preconfigure() { : ; } |
52 | preconfigure() { : ; } |
|
|
53 | patchconfig() { : ; } |
50 | postconfigure() { : ; } |
54 | postconfigure() { : ; } |
51 | postbuild() { : ; } |
55 | postbuild() { : ; } |
52 | postinstall() { : ; } |
56 | postinstall() { : ; } |
53 | |
57 | |
54 | # now source user config, if any |
58 | # now source user config, if any |
… | |
… | |
65 | |
69 | |
66 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
70 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
67 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
71 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
68 | |
72 | |
69 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
73 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
70 | export LC_ALL=C # just to be on the safe side |
74 | LC_ALL=C; export LC_ALL # just to be on the safe side |
71 | |
75 | |
72 | # set version in a way that Makefile.PL can extract |
76 | # set version in a way that Makefile.PL can extract |
73 | VERSION=VERSION; eval \ |
77 | VERSION=VERSION; eval \ |
74 | $VERSION=0.9 |
78 | $VERSION="1.21" |
75 | |
79 | |
76 | BZ2=bz2 |
80 | BZ2=bz2 |
77 | BZIP2=bzip2 |
81 | BZIP2=bzip2 |
78 | |
82 | |
79 | fatal() { |
83 | fatal() { |
… | |
… | |
125 | |
129 | |
126 | clean() { |
130 | clean() { |
127 | rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
131 | rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
128 | } |
132 | } |
129 | |
133 | |
|
|
134 | realclean() { |
|
|
135 | rm -f "$PERL_PREFIX/staticstamp.postinstall" |
|
|
136 | rm -f "$PERL_PREFIX/staticstamp.install" |
|
|
137 | rm -f "$STATICPERL/src/perl-"*"/staticstamp.configure" |
|
|
138 | } |
|
|
139 | |
130 | fetch() { |
140 | fetch() { |
131 | rcd "$STATICPERL" |
141 | rcd "$STATICPERL" |
132 | |
142 | |
133 | mkdir -p src |
143 | mkdir -p src |
134 | rcd src |
144 | rcd src |
… | |
… | |
144 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
154 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
145 | trying $URL |
155 | trying $URL |
146 | EOF |
156 | EOF |
147 | |
157 | |
148 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
158 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
|
|
159 | curl -f >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
149 | wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
160 | || wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
150 | || curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
|
|
151 | || fatal "$URL: unable to download" |
161 | || fatal "$URL: unable to download" |
|
|
162 | rm -f perl-$PERL_VERSION.tar.$BZ2 |
152 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
163 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
153 | fi |
164 | fi |
154 | |
165 | |
155 | verblock <<EOF |
166 | verblock <<EOF |
156 | unpacking perl |
167 | unpacking perl |
157 | EOF |
168 | EOF |
158 | |
169 | |
159 | mkdir -p unpack |
170 | mkdir -p unpack |
|
|
171 | rm -rf unpack/perl-$PERL_VERSION |
160 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \ |
172 | $BZIP2 -d <perl-$PERL_VERSION.tar.$BZ2 | ( cd unpack && tar xf - ) \ |
161 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
173 | || fatal "perl-$PERL_VERSION.tar.$BZ2: error during unpacking" |
162 | chmod -R u+w unpack/perl-$PERL_VERSION |
174 | chmod -R u+w unpack/perl-$PERL_VERSION |
163 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
175 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
164 | rmdir -p unpack |
176 | rmdir -p unpack |
165 | fi |
177 | fi |
166 | } |
178 | } |
167 | |
179 | |
168 | # similar to GNU-sed -i or perl -pi |
180 | # similar to GNU-sed -i or perl -pi |
169 | sedreplace() { |
181 | sedreplace() { |
170 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
182 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
|
|
183 | rm -f "$2" |
171 | mv "$2~" "$2" |
184 | mv "$2~" "$2" |
|
|
185 | } |
|
|
186 | |
|
|
187 | configure_failure() { |
|
|
188 | cat <<EOF |
|
|
189 | |
|
|
190 | |
|
|
191 | *** |
|
|
192 | *** Configure failed - see above for the exact error message(s). |
|
|
193 | *** |
|
|
194 | *** Most commonly, this is because the default PERL_CCFLAGS or PERL_OPTIMIZE |
|
|
195 | *** flags are not supported by your compiler. Less often, this is because |
|
|
196 | *** PERL_LIBS either contains a library not available on your system (such as |
|
|
197 | *** -lcrypt), or because it lacks a required library (e.g. -lsocket or -lnsl). |
|
|
198 | *** |
|
|
199 | *** You can provide your own flags by creating a ~/.staticperlrc file with |
|
|
200 | *** variable assignments. For example (these are the actual values used): |
|
|
201 | *** |
|
|
202 | |
|
|
203 | PERL_CC="$PERL_CC" |
|
|
204 | PERL_CCFLAGS="$PERL_CCFLAGS" |
|
|
205 | PERL_OPTIMIZE="$PERL_OPTIMIZE" |
|
|
206 | PERL_LDFLAGS="$PERL_LDFLAGS" |
|
|
207 | PERL_LIBS="$PERL_LIBS" |
|
|
208 | |
|
|
209 | EOF |
|
|
210 | exit 1 |
172 | } |
211 | } |
173 | |
212 | |
174 | configure() { |
213 | configure() { |
175 | fetch |
214 | fetch |
176 | |
215 | |
… | |
… | |
182 | configuring $STATICPERL/src/perl-$PERL_VERSION |
221 | configuring $STATICPERL/src/perl-$PERL_VERSION |
183 | EOF |
222 | EOF |
184 | |
223 | |
185 | rm -f "$PERL_PREFIX/staticstamp.install" |
224 | rm -f "$PERL_PREFIX/staticstamp.install" |
186 | |
225 | |
187 | make distclean >/dev/null 2>&1 |
226 | "$MAKE" distclean >/dev/null 2>&1 |
188 | |
227 | |
|
|
228 | sedreplace '/^#define SITELIB/d' config_h.SH |
|
|
229 | |
189 | # I hate them |
230 | # I hate them for this |
190 | grep -q -- -fstack-protector Configure && \ |
231 | grep -q -- -fstack-protector Configure && \ |
191 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
232 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
192 | |
233 | |
193 | preconfigure |
234 | # what did that bloke think |
|
|
235 | grep -q -- usedl=.define hints/darwin.sh && \ |
|
|
236 | sedreplace '/^usedl=.define.;$/d' hints/darwin.sh |
|
|
237 | |
|
|
238 | preconfigure || fatal "preconfigure hook failed" |
194 | |
239 | |
195 | # trace configure \ |
240 | # trace configure \ |
196 | sh Configure -Duselargefiles \ |
241 | sh Configure -Duselargefiles \ |
197 | -Uuse64bitint \ |
242 | -Uuse64bitint \ |
198 | -Dusemymalloc=n \ |
243 | -Dusemymalloc=n \ |
199 | -Uusedl \ |
244 | -Uusedl \ |
200 | -Uusethreads \ |
245 | -Uusethreads \ |
201 | -Uuseithreads \ |
246 | -Uuseithreads \ |
202 | -Uusemultiplicity \ |
247 | -Uusemultiplicity \ |
203 | -Duseperlio \ |
|
|
204 | -Uusesfio \ |
248 | -Uusesfio \ |
205 | -Uuseshrplib \ |
249 | -Uuseshrplib \ |
|
|
250 | -Uinstallusrbinperl \ |
206 | -Dcppflags="$PERL_CPPFLAGS" \ |
251 | -A ccflags=" $PERL_CCFLAGS" \ |
207 | -Dccflags="-g2 -fno-strict-aliasing" \ |
252 | -Dcc="$PERL_CC" \ |
208 | -Doptimize="$PERL_OPTIMIZE" \ |
253 | -Doptimize="$PERL_OPTIMIZE" \ |
209 | -Dldflags="$PERL_LDFLAGS" \ |
254 | -Dldflags="$PERL_LDFLAGS" \ |
210 | -Dlibs="$PERL_LIBS" \ |
255 | -Dlibs="$PERL_LIBS" \ |
211 | -Dprefix="$PERL_PREFIX" \ |
256 | -Dprefix="$PERL_PREFIX" \ |
212 | -Dbin="$PERL_PREFIX/bin" \ |
257 | -Dbin="$PERL_PREFIX/bin" \ |
213 | -Dprivlib="$PERL_PREFIX/lib" \ |
258 | -Dprivlib="$PERL_PREFIX/lib" \ |
214 | -Darchlib="$PERL_PREFIX/lib" \ |
259 | -Darchlib="$PERL_PREFIX/lib" \ |
215 | -Uusevendorprefix \ |
260 | -Uusevendorprefix \ |
216 | -Dsitelib="$PERL_PREFIX/lib" \ |
261 | -Dsitelib="$PERL_PREFIX/lib" \ |
217 | -Dsitearch="$PERL_PREFIX/lib" \ |
262 | -Dsitearch="$PERL_PREFIX/lib" \ |
218 | -Usitelibexp \ |
|
|
219 | -Uman1dir \ |
263 | -Uman1dir \ |
220 | -Uman3dir \ |
264 | -Uman3dir \ |
221 | -Usiteman1dir \ |
265 | -Usiteman1dir \ |
222 | -Usiteman3dir \ |
266 | -Usiteman3dir \ |
223 | -Dpager=/usr/bin/less \ |
267 | -Dpager=/usr/bin/less \ |
224 | -Demail="$EMAIL" \ |
268 | -Demail="$EMAIL" \ |
225 | -Dcf_email="$EMAIL" \ |
269 | -Dcf_email="$EMAIL" \ |
226 | -Dcf_by="$EMAIL" \ |
270 | -Dcf_by="$EMAIL" \ |
227 | $PERL_CONFIGURE \ |
271 | $PERL_CONFIGURE \ |
|
|
272 | -Duseperlio \ |
228 | -dE || fatal "Configure failed" |
273 | -dE || configure_failure |
229 | |
274 | |
230 | sedreplace ' |
275 | sedreplace ' |
231 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
276 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
232 | s/ *-fno-stack-protector */ /g |
277 | s/ *-fno-stack-protector */ /g |
233 | ' config.sh |
278 | ' config.sh |
234 | |
279 | |
|
|
280 | patchconfig || fatal "patchconfig hook failed" |
|
|
281 | |
235 | sh Configure -S || fatal "Configure -S failed" |
282 | sh Configure -S || fatal "Configure -S failed" |
236 | |
283 | |
237 | postconfigure || fatal "postconfigure hook failed" |
284 | postconfigure || fatal "postconfigure hook failed" |
238 | |
285 | |
239 | touch staticstamp.configure |
286 | touch staticstamp.configure |
… | |
… | |
248 | building $STATICPERL/src/perl-$PERL_VERSION |
295 | building $STATICPERL/src/perl-$PERL_VERSION |
249 | EOF |
296 | EOF |
250 | |
297 | |
251 | rm -f "$PERL_PREFIX/staticstamp.install" |
298 | rm -f "$PERL_PREFIX/staticstamp.install" |
252 | |
299 | |
253 | make || fatal "make: error while building perl" |
300 | "$MAKE" || fatal "make: error while building perl" |
254 | |
301 | |
255 | postbuild || fatal "postbuild hook failed" |
302 | postbuild || fatal "postbuild hook failed" |
256 | } |
303 | } |
257 | |
304 | |
258 | install() { |
305 | install() { |
… | |
… | |
268 | ln -sf "perl/lib/" "$STATICPERL/lib" |
315 | ln -sf "perl/lib/" "$STATICPERL/lib" |
269 | |
316 | |
270 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
317 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
271 | rm -rf "$PERL_PREFIX" # by this rm -rf |
318 | rm -rf "$PERL_PREFIX" # by this rm -rf |
272 | |
319 | |
273 | make install || fatal "make install: error while installing" |
320 | "$MAKE" install || fatal "make install: error while installing" |
274 | |
321 | |
275 | rcd "$PERL_PREFIX" |
322 | rcd "$PERL_PREFIX" |
276 | |
323 | |
277 | # create a "make install" replacement for CPAN |
324 | # create a "make install" replacement for CPAN |
278 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
325 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
279 | make || exit |
326 | "$MAKE" || exit |
|
|
327 | |
|
|
328 | # patch CPAN::HandleConfig.pm |
|
|
329 | HCPM="$PERL_PREFIX"/lib/CPAN/HandleConfig.pm |
|
|
330 | case "\$(head -n1 "\$HCPM")" in |
|
|
331 | *CPAN::MyConfig* ) |
|
|
332 | ;; |
|
|
333 | * ) |
|
|
334 | echo "patching \$HCPM for a safer tomorrow" |
|
|
335 | { |
|
|
336 | echo "use CPAN::MyConfig;" |
|
|
337 | cat "\$HCPM" |
|
|
338 | } >"\$HCPM~" |
|
|
339 | rm -f "\$HCPM" |
|
|
340 | mv "\$HCPM~" "\$HCPM" |
|
|
341 | ;; |
|
|
342 | esac |
280 | |
343 | |
281 | if find blib/arch/auto -type f | grep -q -v .exists; then |
344 | if find blib/arch/auto -type f | grep -q -v .exists; then |
282 | echo Probably an XS module, rebuilding perl |
345 | echo Probably an XS module, rebuilding perl |
283 | if make perl; then |
346 | if "$MAKE" perl; then |
284 | mv perl "$PERL_PREFIX"/bin/perl |
347 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
|
|
348 | && rm -f "$PERL_PREFIX"/bin/perl \ |
|
|
349 | && mv "$PERL_PREFIX"/bin/perl~ "$PERL_PREFIX"/bin/perl |
285 | make -f Makefile.aperl map_clean |
350 | "$MAKE" -f Makefile.aperl map_clean |
286 | else |
351 | else |
287 | make -f Makefile.aperl map_clean |
352 | "$MAKE" -f Makefile.aperl map_clean |
288 | exit 1 |
353 | exit 1 |
289 | fi |
354 | fi |
290 | fi |
355 | fi |
291 | |
356 | |
292 | make install UNINST=1 |
357 | "$MAKE" install UNINST=1 |
293 | EOF |
358 | EOF |
294 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
359 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
295 | |
360 | |
296 | # trick CPAN into avoiding ~/.cpan completely |
361 | # trick CPAN into avoiding ~/.cpan completely |
297 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
362 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
298 | |
363 | |
|
|
364 | # we call cpan with -MCPAN::MyConfig in this script, but |
|
|
365 | # every make install will patch CPAN::HandleConfig.pm to |
|
|
366 | # protect the user. |
|
|
367 | |
299 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
368 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e ' |
300 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
369 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
301 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
370 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
302 | CPAN::Shell->o (conf => q<init>); |
371 | CPAN::Shell->o (conf => q<init>); |
303 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
372 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
304 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
373 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
… | |
… | |
306 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
375 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
307 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
376 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
308 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
377 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
309 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
378 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
310 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
379 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
|
|
380 | CPAN::Shell->o (conf => q<prefer_installer>, "EUMM"); |
311 | CPAN::Shell->o (conf => q<commit>); |
381 | CPAN::Shell->o (conf => q<commit>); |
312 | ' || fatal "error while initialising CPAN" |
382 | ' || fatal "error while initialising CPAN" |
313 | |
383 | |
314 | touch "$PERL_PREFIX/staticstamp.install" |
384 | touch "$PERL_PREFIX/staticstamp.install" |
315 | fi |
385 | fi |
… | |
… | |
335 | installing modules from CPAN |
405 | installing modules from CPAN |
336 | $@ |
406 | $@ |
337 | EOF |
407 | EOF |
338 | |
408 | |
339 | for mod in "$@"; do |
409 | for mod in "$@"; do |
340 | "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ |
410 | "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e 'notest install => "'"$mod"'"' \ |
341 | || fatal "$mod: unable to install from CPAN" |
411 | || fatal "$mod: unable to install from CPAN" |
342 | done |
412 | done |
343 | rm -rf "$STATICPERL/build" |
413 | rm -rf "$STATICPERL/build" |
344 | } |
414 | } |
345 | |
415 | |
… | |
… | |
357 | for mod in "$@"; do |
427 | for mod in "$@"; do |
358 | echo |
428 | echo |
359 | echo $mod |
429 | echo $mod |
360 | ( |
430 | ( |
361 | rcd $mod |
431 | rcd $mod |
362 | make -f Makefile.aperl map_clean >/dev/null 2>&1 |
432 | "$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1 |
363 | make distclean >/dev/null 2>&1 |
433 | "$MAKE" distclean >/dev/null 2>&1 |
364 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
434 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
365 | make || fatal "$mod: error building module" |
435 | "$MAKE" || fatal "$mod: error building module" |
366 | "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
436 | "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
367 | make distclean >/dev/null 2>&1 |
437 | "$MAKE" distclean >/dev/null 2>&1 |
368 | exit 0 |
438 | exit 0 |
369 | ) || exit $? |
439 | ) || exit $? |
370 | done |
440 | done |
371 | } |
441 | } |
372 | |
442 | |
373 | ############################################################################# |
443 | ############################################################################# |
374 | # main |
444 | # main |
375 | |
445 | |
376 | podusage() { |
446 | podusage() { |
377 | echo |
447 | echo |
|
|
448 | |
378 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
449 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
379 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
450 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
380 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
451 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
381 | 2>/dev/null && exit |
452 | 2>/dev/null && exit |
382 | fi |
453 | fi |
|
|
454 | |
383 | # try whatever perl we can find |
455 | # try whatever perl we can find |
384 | perl -MPod::Usage -e \ |
456 | perl -MPod::Usage -e \ |
385 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
457 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
386 | 2>/dev/null && exit |
458 | 2>/dev/null && exit |
387 | |
459 | |
388 | fatal "displaying documentation requires a working perl - try '$0 install' first" |
460 | fatal "displaying documentation requires a working perl - try '$0 install' to build one in a safe location" |
389 | } |
461 | } |
390 | |
462 | |
391 | usage() { |
463 | usage() { |
392 | podusage 0 |
464 | podusage 0 |
393 | } |
465 | } |
… | |
… | |
418 | command="${1#--}"; shift |
490 | command="${1#--}"; shift |
419 | case "$command" in |
491 | case "$command" in |
420 | version ) |
492 | version ) |
421 | echo "staticperl version $VERSION" |
493 | echo "staticperl version $VERSION" |
422 | ;; |
494 | ;; |
423 | fetch | configure | build | install | clean | distclean) |
495 | fetch | configure | build | install | clean | realclean | distclean) |
424 | ( "$command" ) |
496 | ( "$command" ) || exit |
425 | ;; |
497 | ;; |
426 | instsrc ) |
498 | instsrc ) |
427 | ( instsrc "$@" ) |
499 | ( instsrc "$@" ) || exit |
428 | exit |
500 | exit |
429 | ;; |
501 | ;; |
430 | instcpan ) |
502 | instcpan ) |
431 | ( instcpan "$@" ) |
503 | ( instcpan "$@" ) || exit |
432 | exit |
504 | exit |
433 | ;; |
505 | ;; |
434 | cpan ) |
506 | cpan ) |
435 | ( install ) |
507 | ( install ) || exit |
436 | "$PERL_PREFIX/bin/cpan" "$@" |
508 | "$PERL_PREFIX/bin/cpan" "$@" |
437 | exit |
509 | exit |
438 | ;; |
510 | ;; |
439 | mkbundle ) |
511 | mkbundle ) |
440 | ( install ) |
512 | ( install ) || exit |
441 | bundle "$@" |
513 | bundle "$@" |
442 | exit |
514 | exit |
443 | ;; |
515 | ;; |
444 | mkperl ) |
516 | mkperl ) |
445 | ( install ) |
517 | ( install ) || exit |
446 | bundle --perl "$@" |
518 | bundle --perl "$@" |
447 | exit |
519 | exit |
448 | ;; |
520 | ;; |
449 | mkapp ) |
521 | mkapp ) |
450 | ( install ) |
522 | ( install ) || exit |
451 | bundle --app "$@" |
523 | bundle --app "$@" |
452 | exit |
524 | exit |
453 | ;; |
525 | ;; |
454 | help ) |
526 | help ) |
455 | podusage 2 |
527 | podusage 2 |