1 | #!/bin/sh |
1 | #!/bin/sh |
2 | |
2 | |
3 | ############################################################################# |
3 | ############################################################################# |
4 | # configuration to fill in |
4 | # configuration to fill in |
5 | |
5 | |
6 | PERLVER=5.12.2 # 5.8.9 is also a good choice |
|
|
7 | STATICPERL=~/.staticperl |
6 | STATICPERL=~/.staticperl |
8 | CPAN=http://mirror.netcologne.de/cpan/ # which mirror to use |
7 | CPAN=http://mirror.netcologne.de/cpan # which mirror to use |
9 | EMAIL="read the documentation <rtfm@example.org>" |
8 | EMAIL="read the documentation <rtfm@example.org>" |
10 | |
9 | |
11 | MKBUNDLE="$STATICPERL/mkbundle" |
|
|
12 | |
10 | |
13 | # perl build variables |
11 | # perl build variables |
14 | PREFIX="$STATICPERL/perl" # where the perl gets installed |
12 | PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
|
|
13 | PERL_CONFIGURE="" # additional Configure arguments |
15 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
14 | PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" |
16 | PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
15 | PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
17 | |
16 | |
18 | ARCH="$(uname -m)" |
17 | ARCH="$(uname -m)" |
19 | |
18 | |
… | |
… | |
39 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
38 | #export CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
40 | 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' |
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 | |
40 | |
42 | # which extra modules to install by default from CPAN that are |
41 | # which extra modules to install by default from CPAN that are |
43 | # required by mkbundle |
42 | # required by mkbundle |
44 | EXTRA_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
43 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
|
|
44 | |
|
|
45 | # which extra modules you might want to install |
|
|
46 | EXTRA_MODULES="" |
45 | |
47 | |
46 | # overridable functions |
48 | # overridable functions |
|
|
49 | preconfigure() { : ; } |
47 | postconfigure() { : ; } |
50 | postconfigure() { : ; } |
48 | postbuild() { : ; } |
51 | postbuild() { : ; } |
49 | postinstall() { : ; } |
52 | postinstall() { : ; } |
50 | |
53 | |
51 | # now source user config, if any |
54 | # now source user config, if any |
|
|
55 | if [ "$STATICPERLRC" ]; then |
|
|
56 | . "$STATICPERLRC" |
|
|
57 | else |
52 | [ -r /etc/staticperlrc ] && . /etc/staticperlrc |
58 | [ -r /etc/staticperlrc ] && . /etc/staticperlrc |
53 | [ -r ~/.staticperlrc ] && . ~/.staticperlrc |
59 | [ -r ~/.staticperlrc ] && . ~/.staticperlrc |
54 | [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
60 | [ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
|
|
61 | fi |
55 | |
62 | |
56 | ############################################################################# |
63 | ############################################################################# |
57 | # support |
64 | # support |
|
|
65 | |
|
|
66 | MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
|
|
67 | PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
|
|
68 | |
|
|
69 | unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
|
|
70 | export LC_ALL=C # just to be on the safe side |
58 | |
71 | |
59 | # set version in a way that Makefile.PL can extract |
72 | # set version in a way that Makefile.PL can extract |
60 | VERSION=VERSION; eval \ |
73 | VERSION=VERSION; eval \ |
61 | $VERSION=0.1 |
74 | $VERSION=0.9 |
62 | |
75 | |
63 | BZ2=bz2 |
76 | BZ2=bz2 |
64 | BZIP2=bzip2 |
77 | BZIP2=bzip2 |
65 | |
78 | |
66 | fatal() { |
79 | fatal() { |
… | |
… | |
99 | ############################################################################# |
112 | ############################################################################# |
100 | # clean |
113 | # clean |
101 | |
114 | |
102 | distclean() { |
115 | distclean() { |
103 | verblock <<EOF |
116 | verblock <<EOF |
104 | deleting everything installed by this script |
117 | deleting everything installed by this script (rm -rf $STATICPERL) |
105 | EOF |
118 | EOF |
106 | |
119 | |
107 | rm -rf "$STATICPERL" |
120 | rm -rf "$STATICPERL" |
108 | } |
121 | } |
109 | |
122 | |
110 | ############################################################################# |
123 | ############################################################################# |
111 | # download/configure/compile/install perl |
124 | # download/configure/compile/install perl |
112 | |
125 | |
113 | clean() { |
126 | clean() { |
114 | cd "$STATICPERL/src/perl-$PERLVER" 2>/dev/null || return |
127 | rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
115 | |
|
|
116 | rm -f staticstamp.configure |
|
|
117 | make distclean >/dev/null 2>&1 |
|
|
118 | } |
128 | } |
119 | |
129 | |
120 | fetch() { |
130 | fetch() { |
121 | rcd "$STATICPERL" |
131 | rcd "$STATICPERL" |
122 | |
132 | |
123 | mkdir -p src |
133 | mkdir -p src |
124 | rcd src |
134 | rcd src |
125 | |
135 | |
126 | if ! [ -d "perl-$PERLVER" ]; then |
136 | if ! [ -d "perl-$PERL_VERSION" ]; then |
127 | if ! [ -e "perl-$PERLVER.tar.$BZ2" ]; then |
137 | if ! [ -e "perl-$PERL_VERSION.tar.$BZ2" ]; then |
128 | |
138 | |
129 | URL="$CPAN/src/5.0/perl-$PERLVER.tar.$BZ2" |
139 | URL="$CPAN/src/5.0/perl-$PERL_VERSION.tar.$BZ2" |
130 | |
140 | |
131 | verblock <<EOF |
141 | verblock <<EOF |
132 | downloading perl |
142 | downloading perl |
133 | to manually download perl yourself, place |
143 | to manually download perl yourself, place |
134 | perl-$PERLVER.tar.$BZ2 in $STATICPERL |
144 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
135 | trying $URL |
145 | trying $URL |
136 | EOF |
146 | EOF |
137 | |
147 | |
138 | curl >perl-$PERLVER.tar.$BZ2~ "$URL" \ |
148 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
139 | || wget -O perl-$PERLVER.tar.$BZ2~ "$URL" \ |
149 | wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
|
|
150 | || curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
140 | || fatal "$URL: error during downloading" |
151 | || fatal "$URL: unable to download" |
141 | mv perl-$PERLVER.tar.$BZ2~ perl-$PERLVER.tar.$BZ2 |
152 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
142 | fi |
153 | fi |
143 | |
154 | |
144 | verblock <<EOF |
155 | verblock <<EOF |
145 | unpacking perl |
156 | unpacking perl |
146 | EOF |
157 | EOF |
147 | |
158 | |
148 | mkdir -p unpack |
159 | mkdir -p unpack |
149 | $BZIP2 -d <perl-$PERLVER.tar.bz2 | tar xpC unpack \ |
160 | $BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \ |
150 | || fatal "perl-$PERLVER.tar.bz2: error during unpacking" |
161 | || fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
|
|
162 | chmod -R u+w unpack/perl-$PERL_VERSION |
151 | mv unpack/perl-$PERLVER perl-$PERLVER |
163 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
152 | rmdir -p unpack |
164 | rmdir -p unpack |
153 | fi |
165 | fi |
154 | } |
166 | } |
155 | |
167 | |
156 | # similar to GNU-sed -i or perl -pi |
168 | # similar to GNU-sed -i or perl -pi |
… | |
… | |
160 | } |
172 | } |
161 | |
173 | |
162 | configure() { |
174 | configure() { |
163 | fetch |
175 | fetch |
164 | |
176 | |
165 | rcd "$STATICPERL/src/perl-$PERLVER" |
177 | rcd "$STATICPERL/src/perl-$PERL_VERSION" |
166 | |
178 | |
167 | [ -e staticstamp.configure ] && return |
179 | [ -e staticstamp.configure ] && return |
168 | |
180 | |
169 | verblock <<EOF |
181 | verblock <<EOF |
170 | configuring $STATICPERL/src/perl-$PERLVER |
182 | configuring $STATICPERL/src/perl-$PERL_VERSION |
171 | EOF |
183 | EOF |
172 | |
184 | |
173 | clean |
|
|
174 | |
|
|
175 | rm -f "$PREFIX/staticstamp.install" |
185 | rm -f "$PERL_PREFIX/staticstamp.install" |
|
|
186 | |
|
|
187 | make distclean >/dev/null 2>&1 |
176 | |
188 | |
177 | # I hate them |
189 | # I hate them |
178 | grep -q -- -fstack-protector Configure && \ |
190 | grep -q -- -fstack-protector Configure && \ |
179 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
191 | sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
|
|
192 | |
|
|
193 | preconfigure |
180 | |
194 | |
181 | # trace configure \ |
195 | # trace configure \ |
182 | sh Configure -Duselargefiles \ |
196 | sh Configure -Duselargefiles \ |
183 | -Uuse64bitint \ |
197 | -Uuse64bitint \ |
184 | -Dusemymalloc=n \ |
198 | -Dusemymalloc=n \ |
… | |
… | |
192 | -Dcppflags="$PERL_CPPFLAGS" \ |
206 | -Dcppflags="$PERL_CPPFLAGS" \ |
193 | -Dccflags="-g2 -fno-strict-aliasing" \ |
207 | -Dccflags="-g2 -fno-strict-aliasing" \ |
194 | -Doptimize="$PERL_OPTIMIZE" \ |
208 | -Doptimize="$PERL_OPTIMIZE" \ |
195 | -Dldflags="$PERL_LDFLAGS" \ |
209 | -Dldflags="$PERL_LDFLAGS" \ |
196 | -Dlibs="$PERL_LIBS" \ |
210 | -Dlibs="$PERL_LIBS" \ |
197 | -Dprefix="$PREFIX" \ |
211 | -Dprefix="$PERL_PREFIX" \ |
198 | -Dbin="$PREFIX/bin" \ |
212 | -Dbin="$PERL_PREFIX/bin" \ |
199 | -Dprivlib="$PREFIX/plib" \ |
213 | -Dprivlib="$PERL_PREFIX/lib" \ |
200 | -Darchlib="$PREFIX/plib" \ |
214 | -Darchlib="$PERL_PREFIX/lib" \ |
201 | -Uusevendorprefix \ |
215 | -Uusevendorprefix \ |
202 | -Dsitelib="$PREFIX/plib" \ |
216 | -Dsitelib="$PERL_PREFIX/lib" \ |
203 | -Dsitearch="$PREFIX/plib" \ |
217 | -Dsitearch="$PERL_PREFIX/lib" \ |
204 | -Usitelibexp \ |
218 | -Usitelibexp \ |
205 | -Uman1dir \ |
219 | -Uman1dir \ |
206 | -Uman3dir \ |
220 | -Uman3dir \ |
207 | -Usiteman1dir \ |
221 | -Usiteman1dir \ |
208 | -Usiteman3dir \ |
222 | -Usiteman3dir \ |
209 | -Dpager=/usr/bin/less \ |
223 | -Dpager=/usr/bin/less \ |
210 | -Demail="$EMAIL" \ |
224 | -Demail="$EMAIL" \ |
211 | -Dcf_email="$EMAIL" \ |
225 | -Dcf_email="$EMAIL" \ |
212 | -Dcf_by="$EMAIL" \ |
226 | -Dcf_by="$EMAIL" \ |
|
|
227 | $PERL_CONFIGURE \ |
213 | -dE || fatal "Configure failed" |
228 | -dE || fatal "Configure failed" |
214 | |
229 | |
215 | sedreplace ' |
230 | sedreplace ' |
216 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
231 | s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
217 | s/ *-fno-stack-protector */ /g |
232 | s/ *-fno-stack-protector */ /g |
… | |
… | |
225 | } |
240 | } |
226 | |
241 | |
227 | build() { |
242 | build() { |
228 | configure |
243 | configure |
229 | |
244 | |
230 | rcd "$STATICPERL/src/perl-$PERLVER" |
245 | rcd "$STATICPERL/src/perl-$PERL_VERSION" |
231 | |
246 | |
232 | verblock <<EOF |
247 | verblock <<EOF |
233 | building $STATICPERL/src/perl-$PERLVER |
248 | building $STATICPERL/src/perl-$PERL_VERSION |
234 | EOF |
249 | EOF |
235 | |
250 | |
236 | rm -f "$PREFIX/staticstamp.install" |
251 | rm -f "$PERL_PREFIX/staticstamp.install" |
237 | |
252 | |
238 | make || fatal "make: error while building perl" |
253 | make || fatal "make: error while building perl" |
239 | |
254 | |
240 | postbuild || fatal "postbuild hook failed" |
255 | postbuild || fatal "postbuild hook failed" |
241 | } |
256 | } |
242 | |
257 | |
243 | install() { |
258 | install() { |
244 | [ -e "$PREFIX/staticstamp.install" ] && return |
259 | if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
245 | |
|
|
246 | build |
260 | build |
247 | |
261 | |
248 | verblock <<EOF |
262 | verblock <<EOF |
249 | installing $STATICPERL/src/perl-$PERLVER |
263 | installing $STATICPERL/src/perl-$PERL_VERSION |
250 | to $PREFIX |
264 | to $PERL_PREFIX |
251 | EOF |
265 | EOF |
252 | |
266 | |
253 | rm -rf "$PREFIX" |
267 | ln -sf "perl/bin/" "$STATICPERL/bin" |
254 | |
268 | ln -sf "perl/lib/" "$STATICPERL/lib" |
|
|
269 | |
|
|
270 | ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
|
|
271 | rm -rf "$PERL_PREFIX" # by this rm -rf |
|
|
272 | |
255 | make install || fatal "make install: error while installing" |
273 | make install || fatal "make install: error while installing" |
256 | |
274 | |
|
|
275 | rcd "$PERL_PREFIX" |
|
|
276 | |
257 | # create a "make install" replacement for CPAN |
277 | # create a "make install" replacement for CPAN |
258 | cat >"$PREFIX"/bin/cpan-make-install <<EOF |
278 | cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
259 | make install UNINST=1 |
279 | make || exit |
|
|
280 | |
260 | if find blib/arch/auto -type f | grep -q -v .exists; then |
281 | if find blib/arch/auto -type f | grep -q -v .exists; then |
261 | echo Probably an XS module, rebuilding perl |
282 | echo Probably an XS module, rebuilding perl |
262 | make perl |
283 | if make perl; then |
263 | rm -f "$PREFIX"/bin/perl |
284 | mv perl "$PERL_PREFIX"/bin/perl |
264 | make -f Makefile.aperl inst_perl |
|
|
265 | make -f Makefile.aperl map_clean |
285 | make -f Makefile.aperl map_clean |
|
|
286 | else |
|
|
287 | make -f Makefile.aperl map_clean |
|
|
288 | exit 1 |
|
|
289 | fi |
266 | fi |
290 | fi |
|
|
291 | |
|
|
292 | make install UNINST=1 |
267 | EOF |
293 | EOF |
268 | chmod 755 "$PREFIX"/bin/cpan-make-install |
294 | chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
269 | |
295 | |
|
|
296 | # trick CPAN into avoiding ~/.cpan completely |
|
|
297 | echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
|
|
298 | |
270 | "$PREFIX"/bin/perl -MCPAN -e ' |
299 | "$PERL_PREFIX"/bin/perl -MCPAN -e ' |
271 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
300 | CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
272 | CPAN::Shell->o (conf => q<init>); |
|
|
273 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
301 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
|
|
302 | CPAN::Shell->o (conf => q<init>); |
|
|
303 | CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
274 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
304 | CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
275 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
305 | CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
276 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
306 | CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
277 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
307 | CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
278 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PREFIX"'/bin/cpan-make-install"); |
308 | CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
279 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
309 | CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
280 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
310 | CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
281 | CPAN::Shell->o (conf => q<commit>); |
311 | CPAN::Shell->o (conf => q<commit>); |
282 | ' || fatal "error while initialising CPAN" |
312 | ' || fatal "error while initialising CPAN" |
283 | |
313 | |
|
|
314 | touch "$PERL_PREFIX/staticstamp.install" |
|
|
315 | fi |
|
|
316 | |
|
|
317 | if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
284 | NOCHECK_INSTALL=+ |
318 | NOCHECK_INSTALL=+ |
285 | instcpan $EXTRA_MODULES |
319 | instcpan $STATICPERL_MODULES |
|
|
320 | [ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
286 | |
321 | |
287 | postinstall || fatal "postinstall hook failed" |
322 | postinstall || fatal "postinstall hook failed" |
288 | |
323 | |
289 | touch "$PREFIX/staticstamp.install" |
324 | touch "$PERL_PREFIX/staticstamp.postinstall" |
|
|
325 | fi |
290 | } |
326 | } |
291 | |
327 | |
292 | ############################################################################# |
328 | ############################################################################# |
293 | # install a module from CPAN |
329 | # install a module from CPAN |
294 | |
330 | |
… | |
… | |
299 | installing modules from CPAN |
335 | installing modules from CPAN |
300 | $@ |
336 | $@ |
301 | EOF |
337 | EOF |
302 | |
338 | |
303 | for mod in "$@"; do |
339 | for mod in "$@"; do |
304 | "$PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ |
340 | "$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ |
305 | || fatal "$mod: unable to install from CPAN" |
341 | || fatal "$mod: unable to install from CPAN" |
306 | done |
342 | done |
307 | rm -rf "$STATICPERL/build" |
343 | rm -rf "$STATICPERL/build" |
308 | } |
344 | } |
309 | |
345 | |
… | |
… | |
323 | echo $mod |
359 | echo $mod |
324 | ( |
360 | ( |
325 | rcd $mod |
361 | rcd $mod |
326 | make -f Makefile.aperl map_clean >/dev/null 2>&1 |
362 | make -f Makefile.aperl map_clean >/dev/null 2>&1 |
327 | make distclean >/dev/null 2>&1 |
363 | make distclean >/dev/null 2>&1 |
328 | "$PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
364 | "$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
329 | make || fatal "$mod: error building module" |
365 | make || fatal "$mod: error building module" |
330 | "$PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
366 | "$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
331 | make distclean >/dev/null 2>&1 |
367 | make distclean >/dev/null 2>&1 |
332 | exit 0 |
368 | exit 0 |
333 | ) || exit $? |
369 | ) || exit $? |
334 | done |
370 | done |
335 | } |
371 | } |
336 | |
372 | |
337 | ############################################################################# |
373 | ############################################################################# |
338 | # do schmorpy stuff |
|
|
339 | |
|
|
340 | MODSRCDIR=~/src |
|
|
341 | |
|
|
342 | instmodsrc() { |
|
|
343 | for mod in "$@"; do |
|
|
344 | instmod_src "$MODSRCDIR/$mod" |
|
|
345 | done |
|
|
346 | } |
|
|
347 | |
|
|
348 | install_schmorp() { |
|
|
349 | install |
|
|
350 | |
|
|
351 | instcpan Data::Dump Term::ReadLine::Perl Term::ANSIColor Term::ReadKey |
|
|
352 | instcpan Digest::SHA Digest::MD6 Digest::SHA256 Digest::MD4 Digest::HMAC_MD5 Digest::HMAC_MD6 Digest::FNV |
|
|
353 | #instcpan Net::SSLeay # requires static -ldl |
|
|
354 | |
|
|
355 | instmodsrc common-sense Crypt-Twofish2 Array-Heap Convert-Scalar Compress-LZF JSON-XS |
|
|
356 | instmodsrc EV Guard Async-Interrupt IO-AIO |
|
|
357 | instmodsrc AnyEvent AnyEvent-AIO Coro AnyEvent-HTTP |
|
|
358 | instmodsrc Linux-Inotify2 EV-Loop-Async |
|
|
359 | |
|
|
360 | instcpan AnyEvent::HTTPD |
|
|
361 | } |
|
|
362 | |
|
|
363 | ############################################################################# |
|
|
364 | # main |
374 | # main |
365 | |
375 | |
366 | podusage() { |
376 | podusage() { |
367 | echo |
377 | echo |
368 | if [ -e "$PREFIX/bin/perl" ]; then |
378 | if [ -e "$PERL_PREFIX/bin/perl" ]; then |
369 | "$PREFIX/bin/perl" -MPod::Usage -e \ |
379 | "$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
370 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
380 | 'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
371 | 2>/dev/null && exit |
381 | 2>/dev/null && exit |
372 | fi |
382 | fi |
373 | # try whatever perl we can find |
383 | # try whatever perl we can find |
374 | perl -MPod::Usage -e \ |
384 | perl -MPod::Usage -e \ |
… | |
… | |
383 | } |
393 | } |
384 | |
394 | |
385 | catmkbundle() { |
395 | catmkbundle() { |
386 | { |
396 | { |
387 | read dummy |
397 | read dummy |
388 | echo "#!$PREFIX/bin/perl" |
398 | echo "#!$PERL_PREFIX/bin/perl" |
389 | cat |
399 | cat |
390 | } <<'MKBUNDLE' |
400 | } <<'MKBUNDLE' |
391 | #CAT mkbundle |
401 | #CAT mkbundle |
392 | MKBUNDLE |
402 | MKBUNDLE |
393 | } |
403 | } |
394 | |
404 | |
395 | bundle() { |
405 | bundle() { |
396 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
406 | catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
397 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
407 | chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
|
|
408 | CACHE="$STATICPERL/cache" |
|
|
409 | mkdir -p "$CACHE" |
398 | "$PREFIX/bin/perl" -- "$MKBUNDLE" "$@" |
410 | "$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" |
399 | } |
411 | } |
400 | |
412 | |
401 | if [ $# -gt 0 ]; then |
413 | if [ $# -gt 0 ]; then |
402 | while [ $# -gt 0 ]; do |
414 | while [ $# -gt 0 ]; do |
403 | mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
415 | mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
404 | mkdir -p "$PREFIX" || fatal "$PREFIX: cannot create" |
416 | mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create" |
405 | |
417 | |
406 | command="${1#--}"; shift |
418 | command="${1#--}"; shift |
407 | case "$command" in |
419 | case "$command" in |
|
|
420 | version ) |
|
|
421 | echo "staticperl version $VERSION" |
|
|
422 | ;; |
408 | fetch | configure | build | install | clean | distclean) |
423 | fetch | configure | build | install | clean | distclean) |
409 | verblock <<EOF |
|
|
410 | $command |
|
|
411 | EOF |
|
|
412 | "$command" |
424 | ( "$command" ) |
413 | ;; |
425 | ;; |
414 | instsrc ) |
426 | instsrc ) |
415 | instsrc "$@" |
427 | ( instsrc "$@" ) |
416 | exit |
428 | exit |
417 | ;; |
429 | ;; |
418 | instcpan ) |
430 | instcpan ) |
419 | instcpan "$@" |
431 | ( instcpan "$@" ) |
420 | exit |
|
|
421 | ;; |
432 | exit |
422 | instschmorp ) |
|
|
423 | install_schmorp |
|
|
424 | ;; |
433 | ;; |
425 | cpan ) |
434 | cpan ) |
426 | install |
435 | ( install ) |
427 | "$PREFIX/bin/cpan" "$@" |
436 | "$PERL_PREFIX/bin/cpan" "$@" |
428 | exit |
437 | exit |
429 | ;; |
438 | ;; |
430 | mkbundle ) |
439 | mkbundle ) |
431 | install |
440 | ( install ) |
432 | bundle "$@" |
441 | bundle "$@" |
433 | exit |
442 | exit |
434 | ;; |
443 | ;; |
435 | mkperl ) |
444 | mkperl ) |
436 | install |
445 | ( install ) |
437 | bundle --perl "$@" |
446 | bundle --perl "$@" |
|
|
447 | exit |
|
|
448 | ;; |
|
|
449 | mkapp ) |
|
|
450 | ( install ) |
|
|
451 | bundle --app "$@" |
438 | exit |
452 | exit |
439 | ;; |
453 | ;; |
440 | help ) |
454 | help ) |
441 | podusage 2 |
455 | podusage 2 |
442 | ;; |
456 | ;; |