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