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.21 by root, Mon Dec 13 18:08:01 2010 UTC vs.
Revision 1.23 by root, Sat Dec 18 13:58:12 2010 UTC

10# perl build variables 10# perl build variables
11MAKE=make 11MAKE=make
12PERL_VERSION=5.12.2 # 5.8.9 is also a good choice 12PERL_VERSION=5.12.2 # 5.8.9 is also a good choice
13PERL_CC=cc 13PERL_CC=cc
14PERL_CONFIGURE="" # additional Configure arguments 14PERL_CONFIGURE="" # additional Configure arguments
15PERL_CPPFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG -USITELIB_EXP -USITEARCHEXP -UARCHLIB_EXP" 15PERL_CCFLAGS="-DPERL_DISABLE_PMC -DPERL_ARENA_SIZE=65536 -D_GNU_SOURCE -DNDEBUG"
16PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math" 16PERL_OPTIMIZE="-Os -ffunction-sections -fdata-sections -finline-limit=8 -ffast-math"
17 17
18ARCH="$(uname -m)" 18ARCH="$(uname -m)"
19 19
20case "$ARCH" in 20case "$ARCH" in
21 i*86 | x86_64 | amd64 ) 21 i*86 | x86_64 | amd64 )
22 #PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64 22 PERL_OPTIMIZE="$PERL_OPTIMIZE -mpush-args -mno-inline-stringops-dynamically -mno-align-stringops -mno-ieee-fp" # x86/amd64
23 PERL_OPTIMIZE="$PERL_OPTIMIZE" # x86/amd64
24 case "$ARCH" in 23 case "$ARCH" in
25 i*86 ) 24 i*86 )
26 PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only 25 PERL_OPTIMIZE="$PERL_OPTIMIZE -fomit-frame-pointer -march=pentium3 -mtune=i386" # x86 only
27 ;; 26 ;;
28 esac 27 esac
71unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG 70unset PERL5OPT PERL5LIB PERLLIB PERL_UNICODE PERLIO_DEBUG
72export LC_ALL=C # just to be on the safe side 71export LC_ALL=C # just to be on the safe side
73 72
74# set version in a way that Makefile.PL can extract 73# set version in a way that Makefile.PL can extract
75VERSION=VERSION; eval \ 74VERSION=VERSION; eval \
76$VERSION=0.911 75$VERSION=0.912
77 76
78BZ2=bz2 77BZ2=bz2
79BZIP2=bzip2 78BZIP2=bzip2
80 79
81fatal() { 80fatal() {
127 126
128clean() { 127clean() {
129 rm -rf "$STATICPERL/src/perl-$PERL_VERSION" 128 rm -rf "$STATICPERL/src/perl-$PERL_VERSION"
130} 129}
131 130
131realclean() {
132 rm -f "$PERL_PREFIX/staticstamp.postinstall"
133 rm -f "$PERL_PREFIX/staticstamp.install"
134 rm -f "$STATICPERL/src/perl-"*"/staticstamp.configure"
135}
136
132fetch() { 137fetch() {
133 rcd "$STATICPERL" 138 rcd "$STATICPERL"
134 139
135 mkdir -p src 140 mkdir -p src
136 rcd src 141 rcd src
174 sed -e "$1" <"$2" > "$2~" || fatal "error while running sed" 179 sed -e "$1" <"$2" > "$2~" || fatal "error while running sed"
175 rm -f "$2" 180 rm -f "$2"
176 mv "$2~" "$2" 181 mv "$2~" "$2"
177} 182}
178 183
184configure_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
200PERL_CC="$PERL_CC"
201PERL_CCFLAGS="$PERL_CCFLAGS"
202PERL_OPTIMIZE="$PERL_OPTIMIZE"
203PERL_LDFLAGS="$PERL_LDFLAGS"
204PERL_LIBS="$PERL_LIBS"
205
206EOF
207 exit 1
208}
209
179configure() { 210configure() {
180 fetch 211 fetch
181 212
182 rcd "$STATICPERL/src/perl-$PERL_VERSION" 213 rcd "$STATICPERL/src/perl-$PERL_VERSION"
183 214
189 220
190 rm -f "$PERL_PREFIX/staticstamp.install" 221 rm -f "$PERL_PREFIX/staticstamp.install"
191 222
192 "$MAKE" distclean >/dev/null 2>&1 223 "$MAKE" distclean >/dev/null 2>&1
193 224
225 sedreplace '/^#define SITELIB/d' config_h.SH
226
194 # I hate them 227 # I hate them for this
195 grep -q -- -fstack-protector Configure && \ 228 grep -q -- -fstack-protector Configure && \
196 sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure 229 sedreplace 's/-fstack-protector/-fno-stack-protector/g' Configure
197 230
198 preconfigure 231 preconfigure
199 232
205 -Uusethreads \ 238 -Uusethreads \
206 -Uuseithreads \ 239 -Uuseithreads \
207 -Uusemultiplicity \ 240 -Uusemultiplicity \
208 -Uusesfio \ 241 -Uusesfio \
209 -Uuseshrplib \ 242 -Uuseshrplib \
243 -A ccflags=" $PERL_CCFLAGS" \
210 -Dcc="$PERL_CC" \ 244 -Dcc="$PERL_CC" \
211 -Dcppflags="$PERL_CPPFLAGS" \
212 -Dccflags="-g2 -fno-strict-aliasing" \
213 -Doptimize="$PERL_OPTIMIZE" \ 245 -Doptimize="$PERL_OPTIMIZE" \
214 -Dldflags="$PERL_LDFLAGS" \ 246 -Dldflags="$PERL_LDFLAGS" \
215 -Dlibs="$PERL_LIBS" \ 247 -Dlibs="$PERL_LIBS" \
216 -Dprefix="$PERL_PREFIX" \ 248 -Dprefix="$PERL_PREFIX" \
217 -Dbin="$PERL_PREFIX/bin" \ 249 -Dbin="$PERL_PREFIX/bin" \
218 -Dprivlib="$PERL_PREFIX/lib" \ 250 -Dprivlib="$PERL_PREFIX/lib" \
219 -Darchlib="$PERL_PREFIX/lib" \ 251 -Darchlib="$PERL_PREFIX/lib" \
220 -Uusevendorprefix \ 252 -Uusevendorprefix \
221 -Dsitelib="$PERL_PREFIX/lib" \ 253 -Dsitelib="$PERL_PREFIX/lib" \
222 -Dsitearch="$PERL_PREFIX/lib" \ 254 -Dsitearch="$PERL_PREFIX/lib" \
223 -Usitelibexp \
224 -Uman1dir \ 255 -Uman1dir \
225 -Uman3dir \ 256 -Uman3dir \
226 -Usiteman1dir \ 257 -Usiteman1dir \
227 -Usiteman3dir \ 258 -Usiteman3dir \
228 -Dpager=/usr/bin/less \ 259 -Dpager=/usr/bin/less \
229 -Demail="$EMAIL" \ 260 -Demail="$EMAIL" \
230 -Dcf_email="$EMAIL" \ 261 -Dcf_email="$EMAIL" \
231 -Dcf_by="$EMAIL" \ 262 -Dcf_by="$EMAIL" \
232 $PERL_CONFIGURE \ 263 $PERL_CONFIGURE \
233 -Duseperlio \ 264 -Duseperlio \
234 -dE || fatal "Configure failed" 265 -dE || configure_failure
235 266
236 sedreplace ' 267 sedreplace '
237 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g 268 s/-Wl,--no-gc-sections/-Wl,--gc-sections/g
238 s/ *-fno-stack-protector */ /g 269 s/ *-fno-stack-protector */ /g
239 ' config.sh 270 ' config.sh
428 command="${1#--}"; shift 459 command="${1#--}"; shift
429 case "$command" in 460 case "$command" in
430 version ) 461 version )
431 echo "staticperl version $VERSION" 462 echo "staticperl version $VERSION"
432 ;; 463 ;;
433 fetch | configure | build | install | clean | distclean) 464 fetch | configure | build | install | clean | realclean | distclean)
434 ( "$command" ) 465 ( "$command" ) || exit
435 ;; 466 ;;
436 instsrc ) 467 instsrc )
437 ( instsrc "$@" ) 468 ( instsrc "$@" ) || exit
438 exit 469 exit
439 ;; 470 ;;
440 instcpan ) 471 instcpan )
441 ( instcpan "$@" ) 472 ( instcpan "$@" ) || exit
442 exit 473 exit
443 ;; 474 ;;
444 cpan ) 475 cpan )
445 ( install ) 476 ( install ) || exit
446 "$PERL_PREFIX/bin/cpan" "$@" 477 "$PERL_PREFIX/bin/cpan" "$@"
447 exit 478 exit
448 ;; 479 ;;
449 mkbundle ) 480 mkbundle )
450 ( install ) 481 ( install ) || exit
451 bundle "$@" 482 bundle "$@"
452 exit 483 exit
453 ;; 484 ;;
454 mkperl ) 485 mkperl )
455 ( install ) 486 ( install ) || exit
456 bundle --perl "$@" 487 bundle --perl "$@"
457 exit 488 exit
458 ;; 489 ;;
459 mkapp ) 490 mkapp )
460 ( install ) 491 ( install ) || exit
461 bundle --app "$@" 492 bundle --app "$@"
462 exit 493 exit
463 ;; 494 ;;
464 help ) 495 help )
465 podusage 2 496 podusage 2

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines