1 | #!/bin/sh |
1 | #!/bin/sh |
2 | |
2 | |
3 | ############################################################################# |
3 | ############################################################################# |
4 | # configuration to fill in |
4 | # configuration to fill in (or to replace in your .staticperlrc) |
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 | DLCACHE= |
9 | |
10 | |
10 | # perl build variables |
11 | # perl build variables |
11 | MAKE=make |
12 | MAKE=make |
12 | PERL_VERSION=5.12.3 # 5.8.9 is also a good choice |
13 | PERL_VERSION=5.12.3 # 5.8.9 is also a good choice |
13 | PERL_CC=cc |
14 | PERL_CC=cc |
… | |
… | |
37 | |
38 | |
38 | # some configuration options for modules |
39 | # some configuration options for modules |
39 | PERL_MM_USE_DEFAULT=1 |
40 | PERL_MM_USE_DEFAULT=1 |
40 | PERL_MM_OPT="MAN1PODS= MAN3PODS=" |
41 | PERL_MM_OPT="MAN1PODS= MAN3PODS=" |
41 | #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
42 | #CORO_INTERFACE=p # needed without nptl on x86, due to bugs in linuxthreads - very slow |
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 | #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 |
44 | export PERL_MM_USE_DEFAULT PERL_MM_OPT |
44 | |
45 | |
45 | # which extra modules to install by default from CPAN that are |
46 | # which extra modules to install by default from CPAN that are |
46 | # required by mkbundle |
47 | # required by mkbundle |
47 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
48 | STATICPERL_MODULES="common::sense Pod::Strip PPI::XS Pod::Usage" |
48 | |
49 | |
… | |
… | |
78 | # life easier when working in e.g. "staticperl cpan / look" |
79 | # life easier when working in e.g. "staticperl cpan / look" |
79 | PATH="$PERL_PREFIX/perl/bin:$PATH" |
80 | PATH="$PERL_PREFIX/perl/bin:$PATH" |
80 | |
81 | |
81 | # set version in a way that Makefile.PL can extract |
82 | # set version in a way that Makefile.PL can extract |
82 | VERSION=VERSION; eval \ |
83 | VERSION=VERSION; eval \ |
83 | $VERSION="1.21" |
84 | $VERSION="1.31" |
84 | |
85 | |
85 | BZ2=bz2 |
86 | BZ2=bz2 |
86 | BZIP2=bzip2 |
87 | BZIP2=bzip2 |
87 | |
88 | |
88 | fatal() { |
89 | fatal() { |
… | |
… | |
147 | |
148 | |
148 | mkdir -p src |
149 | mkdir -p src |
149 | rcd src |
150 | rcd src |
150 | |
151 | |
151 | if ! [ -d "perl-$PERL_VERSION" ]; then |
152 | if ! [ -d "perl-$PERL_VERSION" ]; then |
152 | if ! [ -e "perl-$PERL_VERSION.tar.$BZ2" ]; then |
153 | PERLTAR=perl-$PERL_VERSION.tar.$BZ2 |
153 | |
154 | |
|
|
155 | if ! [ -e $PERLTAR ]; then |
154 | URL="$CPAN/src/5.0/perl-$PERL_VERSION.tar.$BZ2" |
156 | URL="$CPAN/src/5.0/$PERLTAR" |
155 | |
157 | |
156 | verblock <<EOF |
158 | verblock <<EOF |
157 | downloading perl |
159 | downloading perl |
158 | to manually download perl yourself, place |
160 | to manually download perl yourself, place |
159 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
161 | perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL |
160 | trying $URL |
162 | trying $URL |
161 | EOF |
|
|
162 | |
163 | |
|
|
164 | either curl or wget is required for automatic download. |
|
|
165 | curl is tried first, then wget. |
|
|
166 | |
|
|
167 | you can configure a download cache directory via DLCACHE |
|
|
168 | in your .staticperlrc to avoid repeated downloads. |
|
|
169 | EOF |
|
|
170 | |
163 | rm -f perl-$PERL_VERSION.tar.$BZ2~ # just to be on the safe side |
171 | rm -f $PERLTAR~ # just to be on the safe side |
164 | curl -f >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
172 | { [ "$DLCACHE" ] && cp "$DLCACHE"/$PERLTAR $PERLTAR~; } \ |
165 | || wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
173 | || wget -O $PERLTAR~ "$URL" \ |
|
|
174 | || curl -f >$PERLTAR~ "$URL" \ |
166 | || fatal "$URL: unable to download" |
175 | || fatal "$URL: unable to download" |
167 | rm -f perl-$PERL_VERSION.tar.$BZ2 |
176 | rm -f $PERLTAR |
168 | mv perl-$PERL_VERSION.tar.$BZ2~ perl-$PERL_VERSION.tar.$BZ2 |
177 | mv $PERLTAR~ $PERLTAR |
|
|
178 | if [ "$DLCACHE" ]; then |
|
|
179 | mkdir -p "$DLCACHE" |
|
|
180 | cp $PERLTAR "$DLCACHE"/$PERLTAR~ && \ |
|
|
181 | mv "$DLCACHE"/$PERLTAR~ "$DLCACHE"/$PERLTAR |
|
|
182 | fi |
169 | fi |
183 | fi |
170 | |
184 | |
171 | verblock <<EOF |
185 | verblock <<EOF |
172 | unpacking perl |
186 | unpacking perl |
173 | EOF |
187 | EOF |
174 | |
188 | |
175 | mkdir -p unpack |
189 | mkdir -p unpack |
176 | rm -rf unpack/perl-$PERL_VERSION |
190 | rm -rf unpack/perl-$PERL_VERSION |
177 | $BZIP2 -d <perl-$PERL_VERSION.tar.$BZ2 | ( cd unpack && tar xf - ) \ |
191 | $BZIP2 -d <$PERLTAR | ( cd unpack && tar xf - ) \ |
178 | || fatal "perl-$PERL_VERSION.tar.$BZ2: error during unpacking" |
192 | || fatal "$PERLTAR: error during unpacking" |
179 | chmod -R u+w unpack/perl-$PERL_VERSION |
193 | chmod -R u+w unpack/perl-$PERL_VERSION |
180 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
194 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
181 | rmdir -p unpack |
195 | rmdir -p unpack |
182 | fi |
196 | fi |
183 | } |
197 | } |