… | |
… | |
2 | |
2 | |
3 | ############################################################################# |
3 | ############################################################################# |
4 | # configuration to fill in |
4 | # configuration to fill in |
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 | MKBUNDLE="$STATICPERL/mkbundle" |
|
|
11 | |
|
|
12 | # perl build variables |
10 | # perl build variables |
13 | PERL_PREFIX="$STATICPERL/perl" # where the perl gets installed |
11 | MAKE=make |
14 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
12 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
|
|
13 | PERL_CC=cc |
15 | PERL_CONFIGURE="" # additional Configure arguments |
14 | PERL_CONFIGURE="" # additional Configure arguments |
16 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
15 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
17 | 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" |
18 | |
17 | |
19 | ARCH="$(uname -m)" |
18 | ARCH="$(uname -m)" |
20 | |
19 | |
21 | case "$ARCH" in |
20 | case "$ARCH" in |
22 | i*86 | x86_64 | amd64 ) |
21 | i*86 | x86_64 | amd64 ) |
23 | PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
22 | #PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
|
|
23 | PERL_OPTIMIZE="$PERL_OPTIMIZE" # 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 | ;; |
30 | esac |
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 | # -z muldefs is 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 -z muldefs" |
35 | PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
36 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 | PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
37 | |
37 | |
38 | # some configuration options for modules |
38 | # some configuration options for modules |
39 | export PERL_MM_USE_DEFAULT=1 |
39 | export PERL_MM_USE_DEFAULT=1 |
40 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
40 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
… | |
… | |
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 |
|
|
57 | if [ "$STATICPERLRC" ]; then |
|
|
58 | . "$STATICPERLRC" |
|
|
59 | else |
56 | [ -r /etc/staticperlrc ] && . /etc/staticperlrc |
60 | [ -r /etc/staticperlrc ] && . /etc/staticperlrc |
57 | [ -r ~/.staticperlrc ] && . ~/.staticperlrc |
61 | [ -r ~/.staticperlrc ] && . ~/.staticperlrc |
58 | [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
62 | [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
|
|
63 | fi |
59 | |
64 | |
60 | ############################################################################# |
65 | ############################################################################# |
61 | # support |
66 | # support |
|
|
67 | |
|
|
68 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
|
|
69 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
|
|
70 | |
|
|
71 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
|
|
72 | export LC_ALL=C # just to be on the safe side |
62 | |
73 | |
63 | # set version in a way that Makefile.PL can extract |
74 | # set version in a way that Makefile.PL can extract |
64 | VERSION=VERSION; eval \ |
75 | VERSION=VERSION; eval \ |
65 | $VERSION=0.1 |
76 | $VERSION=0.911 |
66 | |
77 | |
67 | BZ2=bz2 |
78 | BZ2=bz2 |
68 | BZIP2=bzip2 |
79 | BZIP2=bzip2 |
69 | |
80 | |
70 | fatal() { |
81 | fatal() { |
… | |
… | |
103 | ############################################################################# |
114 | ############################################################################# |
104 | # clean |
115 | # clean |
105 | |
116 | |
106 | distclean() { |
117 | distclean() { |
107 | verblock <<EOF |
118 | verblock <<EOF |
108 | deleting everything installed by this script |
119 | deleting everything installed by this script (rm -rf $STATICPERL) |
109 | EOF |
120 | EOF |
110 | |
121 | |
111 | rm -rf "$STATICPERL" |
122 | rm -rf "$STATICPERL" |
112 | } |
123 | } |
113 | |
124 | |
114 | ############################################################################# |
125 | ############################################################################# |
115 | # download/configure/compile/install perl |
126 | # download/configure/compile/install perl |
116 | |
127 | |
117 | clean() { |
128 | clean() { |
118 | cd "$STATICPERL/src/perl-$PERL_VERSION" 2>/dev/null || return |
129 | rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
119 | |
|
|
120 | rm -f staticstamp.configure |
|
|
121 | make distclean >/dev/null 2>&1 |
|
|
122 | } |
130 | } |
123 | |
131 | |
124 | fetch() { |
132 | fetch() { |
125 | rcd "$STATICPERL" |
133 | rcd "$STATICPERL" |
126 | |
134 | |
… | |
… | |
141 | |
149 | |
142 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
150 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
143 | wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
151 | wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
144 | || curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
152 | || curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
145 | || fatal "$URL: unable to download" |
153 | || fatal "$URL: unable to download" |
|
|
154 | rm -f perl-$PERL_VERSION.tar.$BZ2 |
146 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
155 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
147 | fi |
156 | fi |
148 | |
157 | |
149 | verblock <<EOF |
158 | verblock <<EOF |
150 | unpacking perl |
159 | unpacking perl |
151 | EOF |
160 | EOF |
152 | |
161 | |
153 | mkdir -p unpack |
162 | mkdir -p unpack |
|
|
163 | rm -rf unpack/perl-$PERL_VERSION |
154 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xpC unpack \ |
164 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \ |
155 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
165 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
|
|
166 | chmod -R u+w unpack/perl-$PERL_VERSION |
156 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
167 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
157 | rmdir -p unpack |
168 | rmdir -p unpack |
158 | fi |
169 | fi |
159 | } |
170 | } |
160 | |
171 | |
161 | # similar to GNU-sed -i or perl -pi |
172 | # similar to GNU-sed -i or perl -pi |
162 | sedreplace() { |
173 | sedreplace() { |
163 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
174 | sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
|
|
175 | rm -f "$2" |
164 | mv "$2~" "$2" |
176 | mv "$2~" "$2" |
165 | } |
177 | } |
166 | |
178 | |
167 | configure() { |
179 | configure() { |
168 | fetch |
180 | fetch |
… | |
… | |
173 | |
185 | |
174 | verblock <<EOF |
186 | verblock <<EOF |
175 | configuring $STATICPERL/src/perl-$PERL_VERSION |
187 | configuring $STATICPERL/src/perl-$PERL_VERSION |
176 | EOF |
188 | EOF |
177 | |
189 | |
178 | clean |
|
|
179 | |
|
|
180 | rm -f "$PERL_PREFIX/staticstamp.install" |
190 | rm -f "$PERL_PREFIX/staticstamp.install" |
|
|
191 | |
|
|
192 | "$MAKE" distclean >/dev/null 2>&1 |
181 | |
193 | |
182 | # I hate them |
194 | # I hate them |
183 | grep -q -- -fstack-protector Configure && \ |
195 | grep -q -- -fstack-protector Configure && \ |
184 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
196 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
|
|
197 | |
|
|
198 | preconfigure |
185 | |
199 | |
186 | # trace configure \ |
200 | # trace configure \ |
187 | sh Configure -Duselargefiles \ |
201 | sh Configure -Duselargefiles \ |
188 | -Uuse64bitint \ |
202 | -Uuse64bitint \ |
189 | -Dusemymalloc=n \ |
203 | -Dusemymalloc=n \ |
190 | -Uusedl \ |
204 | -Uusedl \ |
191 | -Uusethreads \ |
205 | -Uusethreads \ |
192 | -Uuseithreads \ |
206 | -Uuseithreads \ |
193 | -Uusemultiplicity \ |
207 | -Uusemultiplicity \ |
194 | -Duseperlio \ |
|
|
195 | -Uusesfio \ |
208 | -Uusesfio \ |
196 | -Uuseshrplib \ |
209 | -Uuseshrplib \ |
|
|
210 | -Dcc="$PERL_CC" \ |
197 | -Dcppflags="$PERL_CPPFLAGS" \ |
211 | -Dcppflags="$PERL_CPPFLAGS" \ |
198 | -Dccflags="-g2 -fno-strict-aliasing" \ |
212 | -Dccflags="-g2 -fno-strict-aliasing" \ |
199 | -Doptimize="$PERL_OPTIMIZE" \ |
213 | -Doptimize="$PERL_OPTIMIZE" \ |
200 | -Dldflags="$PERL_LDFLAGS" \ |
214 | -Dldflags="$PERL_LDFLAGS" \ |
201 | -Dlibs="$PERL_LIBS" \ |
215 | -Dlibs="$PERL_LIBS" \ |
… | |
… | |
214 | -Dpager=/usr/bin/less \ |
228 | -Dpager=/usr/bin/less \ |
215 | -Demail="$EMAIL" \ |
229 | -Demail="$EMAIL" \ |
216 | -Dcf_email="$EMAIL" \ |
230 | -Dcf_email="$EMAIL" \ |
217 | -Dcf_by="$EMAIL" \ |
231 | -Dcf_by="$EMAIL" \ |
218 | $PERL_CONFIGURE \ |
232 | $PERL_CONFIGURE \ |
|
|
233 | -Duseperlio \ |
219 | -dE || fatal "Configure failed" |
234 | -dE || fatal "Configure failed" |
220 | |
235 | |
221 | sedreplace ' |
236 | sedreplace ' |
222 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
237 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
223 | s/ *-fno-stack-protector */ /g |
238 | s/ *-fno-stack-protector */ /g |
… | |
… | |
239 | building $STATICPERL/src/perl-$PERL_VERSION |
254 | building $STATICPERL/src/perl-$PERL_VERSION |
240 | EOF |
255 | EOF |
241 | |
256 | |
242 | rm -f "$PERL_PREFIX/staticstamp.install" |
257 | rm -f "$PERL_PREFIX/staticstamp.install" |
243 | |
258 | |
244 | make || fatal "make: error while building perl" |
259 | "$MAKE" || fatal "make: error while building perl" |
245 | |
260 | |
246 | postbuild || fatal "postbuild hook failed" |
261 | postbuild || fatal "postbuild hook failed" |
247 | } |
262 | } |
248 | |
263 | |
249 | install() { |
264 | install() { |
250 | [ -e "$PERL_PREFIX/staticstamp.install" ] && return |
265 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
251 | |
|
|
252 | build |
266 | build |
253 | |
267 | |
254 | verblock <<EOF |
268 | verblock <<EOF |
255 | installing $STATICPERL/src/perl-$PERL_VERSION |
269 | installing $STATICPERL/src/perl-$PERL_VERSION |
256 | to $PERL_PREFIX |
270 | to $PERL_PREFIX |
257 | EOF |
271 | EOF |
258 | |
272 | |
259 | rm -rf "$PERL_PREFIX" |
273 | ln -sf "perl/bin/" "$STATICPERL/bin" |
260 | |
274 | ln -sf "perl/lib/" "$STATICPERL/lib" |
|
|
275 | |
|
|
276 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
|
|
277 | rm -rf "$PERL_PREFIX" # by this rm -rf |
|
|
278 | |
261 | make install || fatal "make install: error while installing" |
279 | "$MAKE" install || fatal "make install: error while installing" |
262 | |
280 | |
263 | rcd "$PERL_PREFIX" |
281 | rcd "$PERL_PREFIX" |
264 | |
282 | |
265 | # create a "make install" replacement for CPAN |
283 | # create a "make install" replacement for CPAN |
266 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
284 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
267 | make install UNINST=1 |
285 | "$MAKE" || exit |
|
|
286 | |
268 | if find blib/arch/auto -type f | grep -q -v .exists; then |
287 | if find blib/arch/auto -type f | grep -q -v .exists; then |
269 | echo Probably an XS module, rebuilding perl |
288 | echo Probably an XS module, rebuilding perl |
270 | make perl |
289 | if "$MAKE" perl; then |
|
|
290 | mv perl "$PERL_PREFIX"/bin/perl~ \ |
271 | rm -f "$PERL_PREFIX"/bin/perl |
291 | && rm -f "$PERL_PREFIX"/bin/perl \ |
272 | make -f Makefile.aperl inst_perl |
292 | && mv "$PERL_PREFIX"/bin/perl~ "$PERL_PREFIX"/bin/perl |
273 | make -f Makefile.aperl map_clean |
293 | "$MAKE" -f Makefile.aperl map_clean |
|
|
294 | else |
|
|
295 | "$MAKE" -f Makefile.aperl map_clean |
|
|
296 | exit 1 |
|
|
297 | fi |
274 | fi |
298 | fi |
|
|
299 | |
|
|
300 | "$MAKE" install UNINST=1 |
275 | EOF |
301 | EOF |
276 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
302 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
277 | |
303 | |
278 | # trick CPAN into avoiding ~/.cpan completely |
304 | # trick CPAN into avoiding ~/.cpan completely |
279 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
305 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
280 | |
306 | |
281 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
307 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
282 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
308 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
283 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
309 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
284 | CPAN::Shell->o (conf => q<init>); |
310 | CPAN::Shell->o (conf => q<init>); |
285 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
311 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
286 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
312 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
287 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
313 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
288 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
314 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
289 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
315 | 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"); |
316 | 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>); |
317 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
292 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
318 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
293 | CPAN::Shell->o (conf => q<commit>); |
319 | CPAN::Shell->o (conf => q<commit>); |
294 | ' || fatal "error while initialising CPAN" |
320 | ' || fatal "error while initialising CPAN" |
295 | |
321 | |
|
|
322 | touch "$PERL_PREFIX/staticstamp.install" |
|
|
323 | fi |
|
|
324 | |
|
|
325 | if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
296 | NOCHECK_INSTALL=+ |
326 | NOCHECK_INSTALL=+ |
297 | instcpan $STATICPERL_MODULES |
327 | instcpan $STATICPERL_MODULES |
298 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
328 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
299 | |
329 | |
300 | postinstall || fatal "postinstall hook failed" |
330 | postinstall || fatal "postinstall hook failed" |
301 | |
331 | |
302 | touch "$PERL_PREFIX/staticstamp.install" |
332 | touch "$PERL_PREFIX/staticstamp.postinstall" |
|
|
333 | fi |
303 | } |
334 | } |
304 | |
335 | |
305 | ############################################################################# |
336 | ############################################################################# |
306 | # install a module from CPAN |
337 | # install a module from CPAN |
307 | |
338 | |
… | |
… | |
334 | for mod in "$@"; do |
365 | for mod in "$@"; do |
335 | echo |
366 | echo |
336 | echo $mod |
367 | echo $mod |
337 | ( |
368 | ( |
338 | rcd $mod |
369 | rcd $mod |
339 | make -f Makefile.aperl map_clean >/dev/null 2>&1 |
370 | "$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1 |
340 | make distclean >/dev/null 2>&1 |
371 | "$MAKE" distclean >/dev/null 2>&1 |
341 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
372 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
342 | make || fatal "$mod: error building module" |
373 | "$MAKE" || fatal "$mod: error building module" |
343 | "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
374 | "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
344 | make distclean >/dev/null 2>&1 |
375 | "$MAKE" distclean >/dev/null 2>&1 |
345 | exit 0 |
376 | exit 0 |
346 | ) || exit $? |
377 | ) || exit $? |
347 | done |
378 | done |
348 | } |
379 | } |
349 | |
380 | |
350 | ############################################################################# |
381 | ############################################################################# |
351 | # main |
382 | # main |
352 | |
383 | |
353 | podusage() { |
384 | podusage() { |
354 | echo |
385 | echo |
|
|
386 | |
355 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
387 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
356 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
388 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
357 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
389 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
358 | 2>/dev/null && exit |
390 | 2>/dev/null && exit |
359 | fi |
391 | fi |
|
|
392 | |
360 | # try whatever perl we can find |
393 | # try whatever perl we can find |
361 | perl -MPod::Usage -e \ |
394 | perl -MPod::Usage -e \ |
362 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
395 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
363 | 2>/dev/null && exit |
396 | 2>/dev/null && exit |
364 | |
397 | |
365 | fatal "displaying documentation requires a working perl - try '$0 install' first" |
398 | fatal "displaying documentation requires a working perl - try '$0 install' to build one in a safe location" |
366 | } |
399 | } |
367 | |
400 | |
368 | usage() { |
401 | usage() { |
369 | podusage 0 |
402 | podusage 0 |
370 | } |
403 | } |
… | |
… | |
380 | } |
413 | } |
381 | |
414 | |
382 | bundle() { |
415 | bundle() { |
383 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
416 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
384 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
417 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
|
|
418 | CACHE="$STATICPERL/cache" |
|
|
419 | mkdir -p "$CACHE" |
385 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" "$@" |
420 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" |
386 | } |
421 | } |
387 | |
422 | |
388 | if [ $# -gt 0 ]; then |
423 | if [ $# -gt 0 ]; then |
389 | while [ $# -gt 0 ]; do |
424 | while [ $# -gt 0 ]; do |
390 | mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
425 | mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
391 | mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create" |
426 | mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create" |
392 | |
427 | |
393 | command="${1#--}"; shift |
428 | command="${1#--}"; shift |
394 | case "$command" in |
429 | case "$command" in |
|
|
430 | version ) |
|
|
431 | echo "staticperl version $VERSION" |
|
|
432 | ;; |
395 | fetch | configure | build | install | clean | distclean) |
433 | fetch | configure | build | install | clean | distclean) |
396 | verblock <<EOF |
|
|
397 | $command |
|
|
398 | EOF |
|
|
399 | ( "$command" ) |
434 | ( "$command" ) |
400 | ;; |
435 | ;; |
401 | instsrc ) |
436 | instsrc ) |
402 | ( instsrc "$@" ) |
437 | ( instsrc "$@" ) |
403 | exit |
438 | exit |
… | |
… | |
417 | exit |
452 | exit |
418 | ;; |
453 | ;; |
419 | mkperl ) |
454 | mkperl ) |
420 | ( install ) |
455 | ( install ) |
421 | bundle --perl "$@" |
456 | bundle --perl "$@" |
|
|
457 | exit |
|
|
458 | ;; |
|
|
459 | mkapp ) |
|
|
460 | ( install ) |
|
|
461 | bundle --app "$@" |
422 | exit |
462 | exit |
423 | ;; |
463 | ;; |
424 | help ) |
464 | help ) |
425 | podusage 2 |
465 | podusage 2 |
426 | ;; |
466 | ;; |