1 |
root |
1.1 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
############################################################################# |
4 |
|
|
# configuration to fill in |
5 |
|
|
|
6 |
|
|
STATICPERL=~/.staticperl |
7 |
root |
1.14 |
CPAN=http://mirror.netcologne.de/cpan # which mirror to use |
8 |
root |
1.1 |
EMAIL="read the documentation <rtfm@example.org>" |
9 |
|
|
|
10 |
|
|
# perl build variables |
11 |
root |
1.21 |
MAKE=make |
12 |
root |
1.6 |
PERL_VERSION=5.12.2 # 5.8.9 is also a good choice |
13 |
root |
1.19 |
PERL_CC=cc |
14 |
root |
1.4 |
PERL_CONFIGURE="" # additional Configure arguments |
15 |
root |
1.23 |
PERL_CCFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG" |
16 |
root |
1.1 |
PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" |
17 |
|
|
|
18 |
|
|
ARCH="$(uname -m)" |
19 |
|
|
|
20 |
|
|
case "$ARCH" in |
21 |
|
|
i*86 | x86_64 | amd64 ) |
22 |
root |
1.22 |
PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 |
23 |
root |
1.1 |
case "$ARCH" in |
24 |
|
|
i*86 ) |
25 |
|
|
PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only |
26 |
|
|
;; |
27 |
|
|
esac |
28 |
|
|
;; |
29 |
|
|
esac |
30 |
|
|
|
31 |
|
|
# -Wl,--gc-sections makes it impossible to check for undefined references |
32 |
|
|
# for some reason so we need to patch away the "-no" after Configure and before make :/ |
33 |
root |
1.16 |
# --allow-multiple-definition exists to work around uclibc's pthread static linking bug |
34 |
|
|
PERL_LDFLAGS="-Wl,--no-gc-sections -Wl,--allow-multiple-definition" |
35 |
root |
1.1 |
PERL_LIBS="-lm -lcrypt" # perl loves to add lotsa crap itself |
36 |
|
|
|
37 |
|
|
# some configuration options for modules |
38 |
|
|
export PERL_MM_USE_DEFAULT=1 |
39 |
|
|
#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' |
41 |
|
|
|
42 |
|
|
# which extra modules to install by default from CPAN that are |
43 |
|
|
# required by mkbundle |
44 |
root |
1.2 |
STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
45 |
|
|
|
46 |
|
|
# which extra modules you might want to install |
47 |
|
|
EXTRA_MODULES="" |
48 |
root |
1.1 |
|
49 |
|
|
# overridable functions |
50 |
root |
1.7 |
preconfigure() { : ; } |
51 |
root |
1.1 |
postconfigure() { : ; } |
52 |
|
|
postbuild() { : ; } |
53 |
|
|
postinstall() { : ; } |
54 |
|
|
|
55 |
|
|
# now source user config, if any |
56 |
root |
1.14 |
if [ "$STATICPERLRC" ]; then |
57 |
|
|
. "$STATICPERLRC" |
58 |
|
|
else |
59 |
|
|
[ -r /etc/staticperlrc ] && . /etc/staticperlrc |
60 |
|
|
[ -r ~/.staticperlrc ] && . ~/.staticperlrc |
61 |
|
|
[ -r "$STATICPERL/rc" ] && . "$STATICPERL/rc" |
62 |
|
|
fi |
63 |
root |
1.1 |
|
64 |
|
|
############################################################################# |
65 |
|
|
# support |
66 |
|
|
|
67 |
root |
1.14 |
MKBUNDLE="${MKBUNDLE:=$STATICPERL/mkbundle}" |
68 |
|
|
PERL_PREFIX="${PERL_PREFIX:=$STATICPERL/perl}" # where the perl gets installed |
69 |
|
|
|
70 |
root |
1.12 |
unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG |
71 |
|
|
export LC_ALL=C # just to be on the safe side |
72 |
|
|
|
73 |
root |
1.1 |
# set version in a way that Makefile.PL can extract |
74 |
|
|
VERSION=VERSION; eval \ |
75 |
root |
1.22 |
$VERSION=0.912 |
76 |
root |
1.1 |
|
77 |
|
|
BZ2=bz2 |
78 |
|
|
BZIP2=bzip2 |
79 |
|
|
|
80 |
|
|
fatal() { |
81 |
|
|
printf -- "\nFATAL: %s\n\n" "$*" >&2 |
82 |
|
|
exit 1 |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
verbose() { |
86 |
|
|
printf -- "%s\n" "$*" |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
verblock() { |
90 |
|
|
verbose |
91 |
|
|
verbose "***" |
92 |
|
|
while read line; do |
93 |
|
|
verbose "*** $line" |
94 |
|
|
done |
95 |
|
|
verbose "***" |
96 |
|
|
verbose |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
rcd() { |
100 |
|
|
cd "$1" || fatal "$1: cannot enter" |
101 |
|
|
} |
102 |
|
|
|
103 |
|
|
trace() { |
104 |
|
|
prefix="$1"; shift |
105 |
|
|
# "$@" 2>&1 | while read line; do |
106 |
|
|
# echo "$prefix: $line" |
107 |
|
|
# done |
108 |
|
|
"$@" |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
trap wait 0 |
112 |
|
|
|
113 |
|
|
############################################################################# |
114 |
|
|
# clean |
115 |
|
|
|
116 |
|
|
distclean() { |
117 |
|
|
verblock <<EOF |
118 |
root |
1.14 |
deleting everything installed by this script (rm -rf $STATICPERL) |
119 |
root |
1.1 |
EOF |
120 |
|
|
|
121 |
|
|
rm -rf "$STATICPERL" |
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
############################################################################# |
125 |
|
|
# download/configure/compile/install perl |
126 |
|
|
|
127 |
|
|
clean() { |
128 |
root |
1.7 |
rm -rf "$STATICPERL/src/perl-$PERL_VERSION" |
129 |
root |
1.1 |
} |
130 |
|
|
|
131 |
root |
1.23 |
realclean() { |
132 |
|
|
rm -f "$PERL_PREFIX/staticstamp.postinstall" |
133 |
|
|
rm -f "$PERL_PREFIX/staticstamp.install" |
134 |
|
|
rm -f "$STATICPERL/src/perl-"*"/staticstamp.configure" |
135 |
|
|
} |
136 |
|
|
|
137 |
root |
1.1 |
fetch() { |
138 |
|
|
rcd "$STATICPERL" |
139 |
|
|
|
140 |
|
|
mkdir -p src |
141 |
|
|
rcd src |
142 |
|
|
|
143 |
root |
1.6 |
if ! [ -d "perl-$PERL_VERSION" ]; then |
144 |
|
|
if ! [ -e "perl-$PERL_VERSION.tar.$BZ2" ]; then |
145 |
root |
1.1 |
|
146 |
root |
1.6 |
URL="$CPAN/src/5.0/perl-$PERL_VERSION.tar.$BZ2" |
147 |
root |
1.1 |
|
148 |
|
|
verblock <<EOF |
149 |
|
|
downloading perl |
150 |
|
|
to manually download perl yourself, place |
151 |
root |
1.6 |
perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
152 |
root |
1.1 |
trying $URL |
153 |
|
|
EOF |
154 |
|
|
|
155 |
root |
1.6 |
rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
156 |
|
|
wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
157 |
|
|
|| curl >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
158 |
root |
1.5 |
|| fatal "$URL: unable to download" |
159 |
root |
1.20 |
rm -f perl-$PERL_VERSION.tar.$BZ2 |
160 |
root |
1.6 |
mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
161 |
root |
1.1 |
fi |
162 |
|
|
|
163 |
|
|
verblock <<EOF |
164 |
|
|
unpacking perl |
165 |
|
|
EOF |
166 |
|
|
|
167 |
|
|
mkdir -p unpack |
168 |
root |
1.20 |
rm -rf unpack/perl-$PERL_VERSION |
169 |
root |
1.13 |
$BZIP2 -d <perl-$PERL_VERSION.tar.bz2 | tar xfC - unpack \ |
170 |
root |
1.6 |
|| fatal "perl-$PERL_VERSION.tar.bz2: error during unpacking" |
171 |
root |
1.8 |
chmod -R u+w unpack/perl-$PERL_VERSION |
172 |
root |
1.6 |
mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
173 |
root |
1.1 |
rmdir -p unpack |
174 |
|
|
fi |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
# similar to GNU-sed -i or perl -pi |
178 |
|
|
sedreplace() { |
179 |
|
|
sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" |
180 |
root |
1.20 |
rm -f "$2" |
181 |
root |
1.1 |
mv "$2~" "$2" |
182 |
|
|
} |
183 |
|
|
|
184 |
root |
1.22 |
configure_failure() { |
185 |
|
|
cat <<EOF |
186 |
|
|
|
187 |
|
|
|
188 |
|
|
*** |
189 |
|
|
*** Configure failed - see above for the exact error message(s). |
190 |
|
|
*** |
191 |
|
|
*** Most commonly, this is because the default PERL_CCFLAGS or PERL_OPTIMIZE |
192 |
|
|
*** flags are not supported by your compiler. Less often, this is because |
193 |
|
|
*** PERL_LIBS either contains a library not available on your system (such as |
194 |
|
|
*** -lcrypt), or because it lacks a required library (e.g. -lsocket or -lnsl). |
195 |
|
|
*** |
196 |
|
|
*** You can provide your own flags by creating a ~/.staticperlrc file with |
197 |
|
|
*** variable assignments. For example (these are the actual values used): |
198 |
|
|
*** |
199 |
|
|
|
200 |
|
|
PERL_CC="$PERL_CC" |
201 |
|
|
PERL_CCFLAGS="$PERL_CCFLAGS" |
202 |
|
|
PERL_OPTIMIZE="$PERL_OPTIMIZE" |
203 |
|
|
PERL_LDFLAGS="$PERL_LDFLAGS" |
204 |
|
|
PERL_LIBS="$PERL_LIBS" |
205 |
|
|
|
206 |
|
|
EOF |
207 |
|
|
exit 1 |
208 |
|
|
} |
209 |
|
|
|
210 |
root |
1.1 |
configure() { |
211 |
|
|
fetch |
212 |
|
|
|
213 |
root |
1.6 |
rcd "$STATICPERL/src/perl-$PERL_VERSION" |
214 |
root |
1.1 |
|
215 |
|
|
[ -e staticstamp.configure ] && return |
216 |
|
|
|
217 |
|
|
verblock <<EOF |
218 |
root |
1.6 |
configuring $STATICPERL/src/perl-$PERL_VERSION |
219 |
root |
1.1 |
EOF |
220 |
|
|
|
221 |
root |
1.8 |
rm -f "$PERL_PREFIX/staticstamp.install" |
222 |
root |
1.1 |
|
223 |
root |
1.21 |
"$MAKE" distclean >/dev/null 2>&1 |
224 |
root |
1.1 |
|
225 |
root |
1.23 |
sedreplace '/^#define SITELIB/d' config_h.SH |
226 |
|
|
|
227 |
|
|
# I hate them for this |
228 |
root |
1.1 |
grep -q -- -fstack-protector Configure && \ |
229 |
|
|
sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure |
230 |
|
|
|
231 |
root |
1.7 |
preconfigure |
232 |
|
|
|
233 |
root |
1.1 |
# trace configure \ |
234 |
|
|
sh Configure -Duselargefiles \ |
235 |
|
|
-Uuse64bitint \ |
236 |
|
|
-Dusemymalloc=n \ |
237 |
|
|
-Uusedl \ |
238 |
|
|
-Uusethreads \ |
239 |
|
|
-Uuseithreads \ |
240 |
|
|
-Uusemultiplicity \ |
241 |
|
|
-Uusesfio \ |
242 |
|
|
-Uuseshrplib \ |
243 |
root |
1.22 |
-A ccflags=" $PERL_CCFLAGS" \ |
244 |
root |
1.19 |
-Dcc="$PERL_CC" \ |
245 |
root |
1.1 |
-Doptimize="$PERL_OPTIMIZE" \ |
246 |
|
|
-Dldflags="$PERL_LDFLAGS" \ |
247 |
|
|
-Dlibs="$PERL_LIBS" \ |
248 |
root |
1.6 |
-Dprefix="$PERL_PREFIX" \ |
249 |
|
|
-Dbin="$PERL_PREFIX/bin" \ |
250 |
|
|
-Dprivlib="$PERL_PREFIX/lib" \ |
251 |
|
|
-Darchlib="$PERL_PREFIX/lib" \ |
252 |
root |
1.1 |
-Uusevendorprefix \ |
253 |
root |
1.6 |
-Dsitelib="$PERL_PREFIX/lib" \ |
254 |
|
|
-Dsitearch="$PERL_PREFIX/lib" \ |
255 |
root |
1.1 |
-Uman1dir \ |
256 |
|
|
-Uman3dir \ |
257 |
|
|
-Usiteman1dir \ |
258 |
|
|
-Usiteman3dir \ |
259 |
|
|
-Dpager=/usr/bin/less \ |
260 |
|
|
-Demail="$EMAIL" \ |
261 |
|
|
-Dcf_email="$EMAIL" \ |
262 |
|
|
-Dcf_by="$EMAIL" \ |
263 |
root |
1.4 |
$PERL_CONFIGURE \ |
264 |
root |
1.19 |
-Duseperlio \ |
265 |
root |
1.22 |
-dE || configure_failure |
266 |
root |
1.1 |
|
267 |
|
|
sedreplace ' |
268 |
|
|
s/-Wl,--no-gc-sections/-Wl,--gc-sections/g |
269 |
|
|
s/ *-fno-stack-protector */ /g |
270 |
|
|
' config.sh |
271 |
|
|
|
272 |
|
|
sh Configure -S || fatal "Configure -S failed" |
273 |
|
|
|
274 |
|
|
postconfigure || fatal "postconfigure hook failed" |
275 |
|
|
|
276 |
|
|
touch staticstamp.configure |
277 |
|
|
} |
278 |
|
|
|
279 |
|
|
build() { |
280 |
|
|
configure |
281 |
|
|
|
282 |
root |
1.6 |
rcd "$STATICPERL/src/perl-$PERL_VERSION" |
283 |
root |
1.1 |
|
284 |
|
|
verblock <<EOF |
285 |
root |
1.6 |
building $STATICPERL/src/perl-$PERL_VERSION |
286 |
root |
1.1 |
EOF |
287 |
|
|
|
288 |
root |
1.6 |
rm -f "$PERL_PREFIX/staticstamp.install" |
289 |
root |
1.1 |
|
290 |
root |
1.21 |
"$MAKE" || fatal "make: error while building perl" |
291 |
root |
1.1 |
|
292 |
|
|
postbuild || fatal "postbuild hook failed" |
293 |
|
|
} |
294 |
|
|
|
295 |
|
|
install() { |
296 |
root |
1.9 |
if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then |
297 |
|
|
build |
298 |
root |
1.1 |
|
299 |
root |
1.9 |
verblock <<EOF |
300 |
root |
1.6 |
installing $STATICPERL/src/perl-$PERL_VERSION |
301 |
|
|
to $PERL_PREFIX |
302 |
root |
1.1 |
EOF |
303 |
|
|
|
304 |
root |
1.14 |
ln -sf "perl/bin/" "$STATICPERL/bin" |
305 |
|
|
ln -sf "perl/lib/" "$STATICPERL/lib" |
306 |
|
|
|
307 |
|
|
ln -sf "$PERL_PREFIX" "$STATICPERL/perl" # might get overwritten |
308 |
|
|
rm -rf "$PERL_PREFIX" # by this rm -rf |
309 |
|
|
|
310 |
root |
1.21 |
"$MAKE" install || fatal "make install: error while installing" |
311 |
root |
1.1 |
|
312 |
root |
1.9 |
rcd "$PERL_PREFIX" |
313 |
root |
1.2 |
|
314 |
root |
1.9 |
# create a "make install" replacement for CPAN |
315 |
|
|
cat >"$PERL_PREFIX"/bin/cpan-make-install <<EOF |
316 |
root |
1.21 |
"$MAKE" || exit |
317 |
root |
1.10 |
|
318 |
root |
1.1 |
if find blib/arch/auto -type f | grep -q -v .exists; then |
319 |
|
|
echo Probably an XS module, rebuilding perl |
320 |
root |
1.21 |
if "$MAKE" perl; then |
321 |
root |
1.20 |
mv perl "$PERL_PREFIX"/bin/perl~ \ |
322 |
|
|
&& rm -f "$PERL_PREFIX"/bin/perl \ |
323 |
|
|
&& mv "$PERL_PREFIX"/bin/perl~ "$PERL_PREFIX"/bin/perl |
324 |
root |
1.21 |
"$MAKE" -f Makefile.aperl map_clean |
325 |
root |
1.10 |
else |
326 |
root |
1.21 |
"$MAKE" -f Makefile.aperl map_clean |
327 |
root |
1.10 |
exit 1 |
328 |
|
|
fi |
329 |
root |
1.1 |
fi |
330 |
root |
1.10 |
|
331 |
root |
1.21 |
"$MAKE" install UNINST=1 |
332 |
root |
1.1 |
EOF |
333 |
root |
1.9 |
chmod 755 "$PERL_PREFIX"/bin/cpan-make-install |
334 |
|
|
|
335 |
|
|
# trick CPAN into avoiding ~/.cpan completely |
336 |
|
|
echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm" |
337 |
root |
1.1 |
|
338 |
root |
1.9 |
"$PERL_PREFIX"/bin/perl -MCPAN -e ' |
339 |
|
|
CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'"); |
340 |
|
|
CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
341 |
|
|
CPAN::Shell->o (conf => q<init>); |
342 |
|
|
CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan"); |
343 |
|
|
CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build"); |
344 |
|
|
CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs"); |
345 |
|
|
CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile"); |
346 |
|
|
CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources"); |
347 |
|
|
CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/cpan-make-install"); |
348 |
|
|
CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>); |
349 |
|
|
CPAN::Shell->o (conf => q<build_requires_install_policy>, q<no>); |
350 |
|
|
CPAN::Shell->o (conf => q<commit>); |
351 |
|
|
' || fatal "error while initialising CPAN" |
352 |
root |
1.2 |
|
353 |
root |
1.9 |
touch "$PERL_PREFIX/staticstamp.install" |
354 |
|
|
fi |
355 |
|
|
|
356 |
root |
1.10 |
if ! [ -e "$PERL_PREFIX/staticstamp.postinstall" ]; then |
357 |
root |
1.9 |
NOCHECK_INSTALL=+ |
358 |
|
|
instcpan $STATICPERL_MODULES |
359 |
|
|
[ $EXTRA_MODULES ] && instcpan $EXTRA_MODULES |
360 |
root |
1.1 |
|
361 |
root |
1.9 |
postinstall || fatal "postinstall hook failed" |
362 |
root |
1.1 |
|
363 |
root |
1.9 |
touch "$PERL_PREFIX/staticstamp.postinstall" |
364 |
|
|
fi |
365 |
root |
1.1 |
} |
366 |
|
|
|
367 |
|
|
############################################################################# |
368 |
|
|
# install a module from CPAN |
369 |
|
|
|
370 |
|
|
instcpan() { |
371 |
|
|
[ $NOCHECK_INSTALL ] || install |
372 |
|
|
|
373 |
|
|
verblock <<EOF |
374 |
|
|
installing modules from CPAN |
375 |
|
|
$@ |
376 |
|
|
EOF |
377 |
|
|
|
378 |
|
|
for mod in "$@"; do |
379 |
root |
1.6 |
"$PERL_PREFIX"/bin/perl -MCPAN -e 'notest install => "'"$mod"'"' \ |
380 |
root |
1.1 |
|| fatal "$mod: unable to install from CPAN" |
381 |
|
|
done |
382 |
|
|
rm -rf "$STATICPERL/build" |
383 |
|
|
} |
384 |
|
|
|
385 |
|
|
############################################################################# |
386 |
|
|
# install a module from unpacked sources |
387 |
|
|
|
388 |
|
|
instsrc() { |
389 |
|
|
[ $NOCHECK_INSTALL ] || install |
390 |
|
|
|
391 |
|
|
verblock <<EOF |
392 |
|
|
installing modules from source |
393 |
|
|
$@ |
394 |
|
|
EOF |
395 |
|
|
|
396 |
|
|
for mod in "$@"; do |
397 |
|
|
echo |
398 |
|
|
echo $mod |
399 |
|
|
( |
400 |
|
|
rcd $mod |
401 |
root |
1.21 |
"$MAKE" -f Makefile.aperl map_clean >/dev/null 2>&1 |
402 |
|
|
"$MAKE" distclean >/dev/null 2>&1 |
403 |
root |
1.6 |
"$PERL_PREFIX"/bin/perl Makefile.PL || fatal "$mod: error running Makefile.PL" |
404 |
root |
1.21 |
"$MAKE" || fatal "$mod: error building module" |
405 |
root |
1.6 |
"$PERL_PREFIX"/bin/cpan-make-install || fatal "$mod: error installing module" |
406 |
root |
1.21 |
"$MAKE" distclean >/dev/null 2>&1 |
407 |
root |
1.1 |
exit 0 |
408 |
|
|
) || exit $? |
409 |
|
|
done |
410 |
|
|
} |
411 |
|
|
|
412 |
|
|
############################################################################# |
413 |
|
|
# main |
414 |
|
|
|
415 |
|
|
podusage() { |
416 |
|
|
echo |
417 |
root |
1.17 |
|
418 |
root |
1.6 |
if [ -e "$PERL_PREFIX/bin/perl" ]; then |
419 |
|
|
"$PERL_PREFIX/bin/perl" -MPod::Usage -e \ |
420 |
root |
1.1 |
'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
421 |
|
|
2>/dev/null && exit |
422 |
|
|
fi |
423 |
root |
1.17 |
|
424 |
root |
1.1 |
# try whatever perl we can find |
425 |
|
|
perl -MPod::Usage -e \ |
426 |
|
|
'pod2usage -input => *STDIN, -output => *STDOUT, -verbose => '$1', -exitval => 0, -noperldoc => 1' <"$0" \ |
427 |
|
|
2>/dev/null && exit |
428 |
|
|
|
429 |
root |
1.17 |
fatal "displaying documentation requires a working perl - try '$0 install' to build one in a safe location" |
430 |
root |
1.1 |
} |
431 |
|
|
|
432 |
|
|
usage() { |
433 |
|
|
podusage 0 |
434 |
|
|
} |
435 |
|
|
|
436 |
|
|
catmkbundle() { |
437 |
|
|
{ |
438 |
|
|
read dummy |
439 |
root |
1.6 |
echo "#!$PERL_PREFIX/bin/perl" |
440 |
root |
1.1 |
cat |
441 |
|
|
} <<'MKBUNDLE' |
442 |
|
|
#CAT mkbundle |
443 |
|
|
MKBUNDLE |
444 |
|
|
} |
445 |
|
|
|
446 |
|
|
bundle() { |
447 |
|
|
catmkbundle >"$MKBUNDLE~" || fatal "$MKBUNDLE~: cannot create" |
448 |
|
|
chmod 755 "$MKBUNDLE~" && mv "$MKBUNDLE~" "$MKBUNDLE" |
449 |
root |
1.12 |
CACHE="$STATICPERL/cache" |
450 |
|
|
mkdir -p "$CACHE" |
451 |
|
|
"$PERL_PREFIX/bin/perl" -- "$MKBUNDLE" --cache "$CACHE" "$@" |
452 |
root |
1.1 |
} |
453 |
|
|
|
454 |
|
|
if [ $# -gt 0 ]; then |
455 |
|
|
while [ $# -gt 0 ]; do |
456 |
|
|
mkdir -p "$STATICPERL" || fatal "$STATICPERL: cannot create" |
457 |
root |
1.6 |
mkdir -p "$PERL_PREFIX" || fatal "$PERL_PREFIX: cannot create" |
458 |
root |
1.1 |
|
459 |
|
|
command="${1#--}"; shift |
460 |
|
|
case "$command" in |
461 |
root |
1.14 |
version ) |
462 |
|
|
echo "staticperl version $VERSION" |
463 |
|
|
;; |
464 |
root |
1.23 |
fetch | configure | build | install | clean | realclean | distclean) |
465 |
root |
1.22 |
( "$command" ) || exit |
466 |
root |
1.1 |
;; |
467 |
|
|
instsrc ) |
468 |
root |
1.22 |
( instsrc "$@" ) || exit |
469 |
root |
1.1 |
exit |
470 |
|
|
;; |
471 |
|
|
instcpan ) |
472 |
root |
1.22 |
( instcpan "$@" ) || exit |
473 |
root |
1.1 |
exit |
474 |
|
|
;; |
475 |
|
|
cpan ) |
476 |
root |
1.22 |
( install ) || exit |
477 |
root |
1.6 |
"$PERL_PREFIX/bin/cpan" "$@" |
478 |
root |
1.1 |
exit |
479 |
|
|
;; |
480 |
|
|
mkbundle ) |
481 |
root |
1.22 |
( install ) || exit |
482 |
root |
1.1 |
bundle "$@" |
483 |
|
|
exit |
484 |
|
|
;; |
485 |
|
|
mkperl ) |
486 |
root |
1.22 |
( install ) || exit |
487 |
root |
1.1 |
bundle --perl "$@" |
488 |
|
|
exit |
489 |
|
|
;; |
490 |
root |
1.11 |
mkapp ) |
491 |
root |
1.22 |
( install ) || exit |
492 |
root |
1.11 |
bundle --app "$@" |
493 |
|
|
exit |
494 |
|
|
;; |
495 |
root |
1.1 |
help ) |
496 |
|
|
podusage 2 |
497 |
|
|
;; |
498 |
|
|
* ) |
499 |
|
|
exec 1>&2 |
500 |
|
|
echo |
501 |
|
|
echo "Unknown command: $command" |
502 |
|
|
podusage 0 |
503 |
|
|
;; |
504 |
|
|
esac |
505 |
|
|
done |
506 |
|
|
else |
507 |
|
|
usage |
508 |
|
|
fi |
509 |
|
|
|
510 |
|
|
exit 0 |
511 |
|
|
|
512 |
|
|
#CAT staticperl.pod |
513 |
|
|
|