1 #!/bin/bash
3 eval $(echo '#include "./patchlevel.h"
4 SETver=PERL_REVISION.PERL_VERSION;
5 SETsubver= PERL_SUBVERSION' | gcc -E -DPERL_PATCHLEVEL_H_IMPLICIT - \
6 | sed -n '/^SET/{s///;s/ //gp;}')
8 fullver="$ver.$subver"
9 nextver="$ver."$(($subver+1))
10 ccflags=-DDEBIAN
11 arch_cpu=${DEB_BUILD_ARCH_CPU:-$(dpkg-architecture -qDEB_BUILD_ARCH_CPU)}
12 gnu_type=${DEB_BUILD_GNU_TYPE:-$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)}
13 multiarch_dir=${DEB_HOST_MULTIARCH:-$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)}
14 optimize=-O2
15 debugging=-g
17 case "$1" in
18 --static) # static perl
19 build_type=static
20 opts="-Uuseshrplib";;
22 --debug) # debugperl
23 build_type=debug
24 debugging=both # add -DDEBUGGING
25 opts="-Uuseshrplib";;
27 --shared) # shared library
28 build_type=shared
29 opts="-Duseshrplib -Dlibperl=libperl.so.$fullver";;
31 --version)
32 exec echo $ver;;
34 --full-version)
35 exec echo $fullver;;
37 --next-version)
38 exec echo $nextver;;
40 --strip)
41 case ",$DEB_BUILD_OPTIONS," in
42 *[,\ ]nostrip[,\ ]*) exec echo no;;
43 *) exec echo yes;;
44 esac;;
46 --test-target)
47 case ",$DEB_BUILD_OPTIONS," in
48 *[,\ ]nocheck[,\ ]*) exit;;
49 *[,\ ]x-perl-notest[,\ ]*) exit;;
50 *) exec echo test;;
51 esac;;
53 --install-type)
54 # The default installation type for /usr/bin/perl of shared or
55 # static may be changed by including x-perl-static or x-perl-shared
56 # in DEB_BUILD_OPTIONS. The default is shared except for i386 where
57 # there is a measurable performance penalty.
58 case ",$DEB_BUILD_OPTIONS," in
59 *[,\ ]x-perl-static[,\ ]*) exec echo static;;
60 *[,\ ]x-perl-shared[,\ ]*) exec echo shared;;
61 esac
62 case "$arch_cpu" in
63 i386) exec echo static;;
64 *) exec echo shared;;
65 esac;;
67 *) echo "$0: need --shared, --static, or --debug option"
68 exit 2;;
69 esac
71 case "$arch_cpu:$build_type" in
72 sh4:*) # required to correctly handle floating point on sh4
73 ccflags="$ccflags -mieee";;
75 m68k:shared) # work around an optimiser bug
76 ccflags="$ccflags -fno-regmove";;
77 esac
79 case ",$DEB_BUILD_OPTIONS," in
80 *[,\ ]noopt[,\ ]*)
81 optimize="$optimize${optimize:+ }-O0";;
82 esac
84 if [ -n "$multiarch_dir" ]; then
85 extra_path="\"-Dplibpth=/lib/$multiarch_dir /usr/lib/$multiarch_dir\""
86 fi
88 # post-configure tweaks
89 cp debian/config.over .
91 # need bash when sourcing config.over
92 eval /bin/bash Configure \
93 -Dusethreads \
94 -Duselargefiles \
95 -Dccflags=\'$ccflags\' \
96 -Dcccdlflags=-fPIC \
97 -Darchname=$gnu_type \
98 -Dprefix=/usr \
99 -Dprivlib=/usr/share/perl/$ver \
100 -Darchlib=/usr/lib/perl/$ver \
101 -Dvendorprefix=/usr \
102 -Dvendorlib=/usr/share/perl5 \
103 -Dvendorarch=/usr/lib/perl5 \
104 -Dsiteprefix=/usr/local \
105 -Dsitelib=/usr/local/share/perl/$fullver \
106 -Dsitearch=/usr/local/lib/perl/$fullver \
107 -Dman1dir=/usr/share/man/man1 \
108 -Dman3dir=/usr/share/man/man3 \
109 -Dsiteman1dir=/usr/local/man/man1 \
110 -Dsiteman3dir=/usr/local/man/man3 \
111 -Duse64bitint \
112 -Dman1ext=1 \
113 -Dman3ext=3perl \
114 -Dpager=/usr/bin/sensible-pager \
115 -Uafs \
116 -Ud_csh \
117 -Ud_ualarm \
118 -Uusesfio \
119 -Uusenm \
120 -Ui_libutil \
121 -DDEBUGGING=$debugging \
122 -Doptimize=\"$optimize\" \
123 $extra_path \
124 $opts -des
