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 |
… | |
… | |
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 | |
163 | |
162 | either curl or wget is required for automatic download. |
164 | either curl or wget is required for automatic download. |
163 | curl is tried first, then wget. |
165 | curl is tried first, then wget. |
164 | EOF |
|
|
165 | |
166 | |
|
|
167 | you can configure a download cache directory via DLCACHE |
|
|
168 | in your .staticperlrc to avoid repeated downloads. |
|
|
169 | EOF |
|
|
170 | |
166 | 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 |
167 | curl -f >perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
172 | { [ "$DLCACHE" ] && cp -l "$DLCACHE"/$PERLTAR $PERLTAR~; } \ |
168 | || wget -O perl-$PERL_VERSION.tar.$BZ2~ "$URL" \ |
173 | || wget -O $PERLTAR~ "$URL" \ |
|
|
174 | || curl -f >$PERLTAR~ "$URL" \ |
169 | || fatal "$URL: unable to download" |
175 | || fatal "$URL: unable to download" |
170 | rm -f perl-$PERL_VERSION.tar.$BZ2 |
176 | rm -f $PERLTAR |
171 | 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 -l $PERLTAR "$DLCACHE"/$PERLTAR~ && \ |
|
|
181 | mv "$DLCACHE"/$PERLTAR~ "$DLCACHE"/$PERLTAR |
|
|
182 | fi |
172 | fi |
183 | fi |
173 | |
184 | |
174 | verblock <<EOF |
185 | verblock <<EOF |
175 | unpacking perl |
186 | unpacking perl |
176 | EOF |
187 | EOF |
177 | |
188 | |
178 | mkdir -p unpack |
189 | mkdir -p unpack |
179 | rm -rf unpack/perl-$PERL_VERSION |
190 | rm -rf unpack/perl-$PERL_VERSION |
180 | $BZIP2 -d <perl-$PERL_VERSION.tar.$BZ2 | ( cd unpack && tar xf - ) \ |
191 | $BZIP2 -d <$PERLTAR | ( cd unpack && tar xf - ) \ |
181 | || fatal "perl-$PERL_VERSION.tar.$BZ2: error during unpacking" |
192 | || fatal "$PERLTAR: error during unpacking" |
182 | chmod -R u+w unpack/perl-$PERL_VERSION |
193 | chmod -R u+w unpack/perl-$PERL_VERSION |
183 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
194 | mv unpack/perl-$PERL_VERSION perl-$PERL_VERSION |
184 | rmdir -p unpack |
195 | rmdir -p unpack |
185 | fi |
196 | fi |
186 | } |
197 | } |