ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/staticperl.sh
(Generate patch)

Comparing App-Staticperl/staticperl.sh (file contents):
Revision 1.12 by root, Fri Dec 10 02:35:54 2010 UTC vs.
Revision 1.40 by root, Sun May 1 07:56:26 2011 UTC

2 2
3############################################################################# 3#############################################################################
4# configuration to fill in 4# configuration to fill in
5 5
6STATICPERL=~/.staticperl 6STATICPERL=~/.staticperl
7CPAN=http://mirror.netcologne.de/cpan/ # which mirror to use 7CPAN=http://mirror.netcologne.de/cpan # which mirror to use
8EMAIL="read the documentation <rtfm@example.org>" 8EMAIL="read the documentation <rtfm@example.org>"
9 9
10MKBUNDLE="$STATICPERL/mkbundle"
11
12# perl build variables 10# perl build variables
13PERL_PREFIX="$STATICPERL/perl" # where the perl gets installed 11MAKE=make
14PERL_VERSION=5.12.2 # 5.8.9 is also a good choice 12PERL_VERSION=5.12.3 # 5.8.9 is also a good choice
13PERL_CC=cc
15PERL_CONFIGURE="" # additional Configure arguments 14PERL_CONFIGURE="" # additional Configure arguments
16PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" 15PERL_CCFLAGS="-g -DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=16376 -DNO_PERL_MALLOC_ENV -D_GNU_SOURCE -DNDEBUG"
17PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" 16PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math"
18 17
19ARCH="$(uname -m)" 18ARCH="$(uname -m)"
20 19
21case "$ARCH" in 20case "$ARCH" in
29 ;; 28 ;;
30esac 29esac
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
35PERL_LDFLAGS="-Wl,--no-gc-sections -z muldefs" 34#PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition"
35PERL_LDFLAGS=
36PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself 36PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself
37 37
38# some configuration options for modules 38# some configuration options for modules
39export PERL_MM_USE_DEFAULT=1 39PERL_MM_USE_DEFAULT=1
40PERL_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
41export 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' 42EV_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'
43export 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
45STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" 47STATICPERL_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
48EXTRA_MODULES="" 50EXTRA_MODULES=""
49 51
50# overridable functions 52# overridable functions
51preconfigure() { : ; } 53preconfigure() { : ; }
54patchconfig() { : ; }
52postconfigure() { : ; } 55postconfigure() { : ; }
53postbuild() { : ; } 56postbuild() { : ; }
54postinstall() { : ; } 57postinstall() { : ; }
55 58
56# now source user config, if any 59# now source user config, if any
60if [ "$STATICPERLRC" ]; then
61 . "$STATICPERLRC"
62else
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"
66fi
60 67
61############################################################################# 68#############################################################################
62# support 69# support
63 70
71PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed
72
64unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG 73unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG
74unset PERL_MB_OPT
65export LC_ALL=C # just to be on the safe side 75LC_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"
79PATH="$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
68VERSION=VERSION; eval \ 82VERSION=VERSION; eval \
69$VERSION=0.9 83$VERSION="1.21"
70 84
71BZ2=bz2 85BZ2=bz2
72BZIP2=bzip2 86BZIP2=bzip2
73 87
74fatal() { 88fatal() {
107############################################################################# 121#############################################################################
108# clean 122# clean
109 123
110distclean() { 124distclean() {
111 verblock <<EOF 125 verblock <<EOF
112deleting everything installed by this script 126 deleting everything installed by this script (rm -rf $STATICPERL)
113EOF 127EOF
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
121clean() { 135clean() {
122 rm -rf "$STATICPERL/src/perl-$PERL_VERSION" 136 rm -rf "$STATICPERL/src/perl-$PERL_VERSION"
137}
138
139realclean() {
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
125fetch() { 145fetch() {
126 rcd "$STATICPERL" 146 rcd "$STATICPERL"
127 147
139perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL 159perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL
140trying $URL 160trying $URL
141EOF 161EOF
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
151unpacking perl 172unpacking perl
152EOF 173EOF
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 xC 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
164sedreplace() { 186sedreplace() {
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
192configure_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
208PERL_CC="$PERL_CC"
209PERL_CCFLAGS="$PERL_CCFLAGS"
210PERL_OPTIMIZE="$PERL_OPTIMIZE"
211PERL_LDFLAGS="$PERL_LDFLAGS"
212PERL_LIBS="$PERL_LIBS"
213
214EOF
215 exit 1
167} 216}
168 217
169configure() { 218configure() {
170 fetch 219 fetch
171 220
177configuring $STATICPERL/src/perl-$PERL_VERSION 226configuring $STATICPERL/src/perl-$PERL_VERSION
178EOF 227EOF
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
294write_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
237build() { 305build() {
238 configure 306 configure
239 307
243building $STATICPERL/src/perl-$PERL_VERSION 311building $STATICPERL/src/perl-$PERL_VERSION
244EOF 312EOF
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
253install() { 321install() {
257 verblock <<EOF 325 verblock <<EOF
258installing $STATICPERL/src/perl-$PERL_VERSION 326installing $STATICPERL/src/perl-$PERL_VERSION
259to $PERL_PREFIX 327to $PERL_PREFIX
260EOF 328EOF
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'
270make || exit 344#CAT make-install-make.sh
271
272if 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
281fi
282
283make install UNINST=1
284EOF 345EOF
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
350EOF
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
326installing modules from CPAN 397installing modules from CPAN
327$@ 398$@
328EOF 399EOF
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
367podusage() { 438podusage() {
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
382usage() { 455usage() {
383 podusage 0 456 podusage 0
384} 457}
392#CAT mkbundle 465#CAT mkbundle
393MKBUNDLE 466MKBUNDLE
394} 467}
395 468
396bundle() { 469bundle() {
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
414EOF
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines