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.40 by root, Sun May 1 07:56:26 2011 UTC vs.
Revision 1.46 by root, Sun Jun 26 17:27:18 2011 UTC

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
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>"
9DLCACHE=
9 10
10# perl build variables 11# perl build variables
11MAKE=make 12MAKE=make
12PERL_VERSION=5.12.3 # 5.8.9 is also a good choice 13PERL_VERSION=5.12.3 # 5.8.9 is also a good choice
13PERL_CC=cc 14PERL_CC=cc
78# life easier when working in e.g. "staticperl cpan / look" 79# life easier when working in e.g. "staticperl cpan / look"
79PATH="$PERL_PREFIX/perl/bin:$PATH" 80PATH="$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
82VERSION=VERSION; eval \ 83VERSION=VERSION; eval \
83$VERSION="1.21" 84$VERSION="1.31"
84 85
85BZ2=bz2 86BZ2=bz2
86BZIP2=bzip2 87BZIP2=bzip2
87 88
88fatal() { 89fatal() {
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
157downloading perl 159downloading perl
158to manually download perl yourself, place 160to manually download perl yourself, place
159perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL 161perl-$PERL_VERSION.tar.$BZ2 in $STATICPERL
160trying $URL 162trying $URL
161EOF
162 163
164either curl or wget is required for automatic download.
165curl is tried first, then wget.
166
167you can configure a download cache directory via DLCACHE
168in your .staticperlrc to avoid repeated downloads.
169EOF
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
172unpacking perl 186unpacking perl
173EOF 187EOF
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}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines