/[gentoo-x86]/sys-devel/libperl/libperl-5.8.8-r1.ebuild
Gentoo

Contents of /sys-devel/libperl/libperl-5.8.8-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.26 - (show annotations) (download)
Fri May 29 14:22:00 2009 UTC (10 years, 4 months ago) by tove
Branch: MAIN
CVS Tags: HEAD
Changes since 1.25: +1 -1 lines
FILE REMOVED
Remove security vulnerable version for bug #271738
(Portage version: 2.2_rc33/cvs/Linux i686)

1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-devel/libperl/libperl-5.8.8-r1.ebuild,v 1.25 2008/05/10 10:46:43 grobian Exp $
4
5 # The basic theory based on comments from Daniel Robbins <drobbins@gentoo.org>.
6 #
7 # We split the perl ebuild into libperl and perl. The layout is as follows:
8 #
9 # libperl:
10 #
11 # This is a slotted (SLOT=[0-9]*) ebuild, meaning we should be able to have a
12 # few versions that are not binary compadible installed.
13 #
14 # How we get libperl.so multi-versioned, is by adding to the link command:
15 #
16 # -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3`
17 #
18 # This gives us:
19 #
20 # $(LIBPERL): $& perl$(OBJ_EXT) $(obj) $(LIBPERLEXPORT)
21 # $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) \
22 # -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3`
23 #
24 # We then configure perl with LIBPERL set to:
25 #
26 # LIBPERL="libperl.so.${SLOT}.`echo ${PV} | cut -d. -f1,2`"
27 #
28 # Or with the variables defined in this ebuild:
29 #
30 # LIBPERL="libperl.so.${PERLSLOT}.${SHORT_PV}"
31 #
32 # The result is that our 'soname' is 'libperl.so.${PERLSLOT}' (at the time of
33 # writing this for perl-5.8.0, 'libperl.so.1'), causing all apps that is linked
34 # to libperl to link to 'libperl.so.${PERLSLOT}'.
35 #
36 # If a new perl version, perl-z.y.z comes out that have a libperl not binary
37 # compatible with the previous version, we just keep the previous libperl
38 # installed, and all apps linked to it will still be able to use:
39 #
40 # libperl.so.${PERLSLOT}'
41 #
42 # while the new ones will link to:
43 #
44 # libperl.so.$((PERLSLOT+1))'
45 #
46 # perl:
47 #
48 # Not much to this one. It compiles with a static libperl.a, and are unslotted
49 # (meaning SLOT=0). We thus always have the latest *stable* perl version
50 # installed, with corrisponding version of libperl. The perl ebuild will of
51 # course DEPEND on libperl.
52 #
53 # Martin Schlemmer <azarah@gentoo.org> (28 Dec 2002).
54
55 IUSE="berkdb debug gdbm ithreads"
56
57 inherit eutils flag-o-matic toolchain-funcs multilib
58
59 # The slot of this binary compat version of libperl.so
60 PERLSLOT="1"
61
62 SHORT_PV="${PV%.*}"
63 MY_P="perl-${PV/_rc/-RC}"
64 S="${WORKDIR}/${MY_P}"
65 DESCRIPTION="Larry Wall's Practical Extraction and Reporting Language"
66 SRC_URI="mirror://cpan/src/${MY_P}.tar.bz2"
67 HOMEPAGE="http://www.perl.org"
68 SLOT="${PERLSLOT}"
69 LIBPERL="libperl$(get_libname ${PERLSLOT}.${SHORT_PV})"
70 LICENSE="|| ( Artistic GPL-2 )"
71 KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
72
73 # rac 2004.08.06
74
75 # i am not kidding here. you will forkbomb yourself out of existence
76 # because make check -n wants to make miniperl, which runs itself at
77 # the very end to make sure it's working right. this behaves very
78 # badly when you -n it, because it won't exist and will therefore try
79 # to build itself again ad infinitum.
80
81 RESTRICT="test"
82
83 DEPEND="berkdb? ( sys-libs/db )
84 gdbm? ( >=sys-libs/gdbm-1.8.0 )
85 elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs )"
86
87 RDEPEND="
88 berkdb? ( sys-libs/db )
89 gdbm? ( >=sys-libs/gdbm-1.8.0 )"
90
91 PDEPEND="~dev-lang/perl-${PV}"
92
93 pkg_setup() {
94 # I think this should rather be displayed if you *have* 'ithreads'
95 # in USE if it could break things ...
96 if use ithreads
97 then
98 ewarn ""
99 ewarn "PLEASE NOTE: You are compiling perl-5.8 with"
100 ewarn "interpreter-level threading enabled."
101 ewarn "Threading is not supported by all applications "
102 ewarn "that compile against perl. You use threading at "
103 ewarn "your own discretion. "
104 ewarn ""
105 epause 10
106 fi
107 }
108
109 src_unpack() {
110
111 unpack ${A}
112
113 # Fix the build scripts to create libperl with a soname of ${SLOT}.
114 # We basically add:
115 #
116 # -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3`
117 #
118 # to the line that links libperl.so, and then set LIBPERL to:
119 #
120 # LIBPERL=libperl.so.${SLOT}.`echo ${PV} | cut -d. -f1,2`
121 #
122 cd ${S};
123 epatch ${FILESDIR}/${PN}-create-libperl-soname.patch
124
125 # Configure makes an unwarranted assumption that /bin/ksh is a
126 # good shell. This patch makes it revert to using /bin/sh unless
127 # /bin/ksh really is executable. Should fix bug 42665.
128 # rac 2004.06.09
129 cd ${S}; epatch ${FILESDIR}/${PN}-noksh.patch
130
131 # we need the same @INC-inversion magic here we do in perl
132 cd ${S}; epatch ${FILESDIR}/${P}-reorder-INC.patch
133
134 # makedepend.SH contains a syntax error which is ignored by bash but causes
135 # dash to abort
136 epatch ${FILESDIR}/${P}-makedepend-syntax.patch
137
138 # On PA7200, uname -a contains a single quote and we need to
139 # filter it otherwise configure fails. See #125535.
140 epatch ${FILESDIR}/perl-hppa-pa7200-configure.patch
141
142 use amd64 && cd ${S} && epatch ${FILESDIR}/${P}-lib64.patch
143 [[ ${CHOST} == *-dragonfly* ]] && cd ${S} && epatch ${FILESDIR}/${P}-dragonfly-clean.patch
144 [[ ${CHOST} == *-freebsd* ]] && cd ${S} && epatch ${FILESDIR}/${P}-fbsdhints.patch
145 cd ${S}; epatch ${FILESDIR}/${P}-cplusplus.patch
146 has_version '>=sys-devel/gcc-4.2' && epatch ${FILESDIR}/${P}-gcc42-command-line.patch
147 }
148
149 myconf() {
150 myconf=( "${myconf[@]}" "$@" )
151 }
152
153 src_compile() {
154 declare -a myconf
155
156 # Perl has problems compiling with -Os in your flags
157 # some arches and -O do not mix :)
158 use arm && replace-flags -O? -O1
159 use ppc && replace-flags -O? -O1
160 use ia64 && replace-flags -O? -O1
161 # Perl has problems compiling with -Os in your flags with glibc
162 use elibc_uclibc || replace-flags "-Os" "-O2"
163 ( gcc-specs-ssp && use ia64 ) && append-flags -fno-stack-protector
164 # This flag makes compiling crash in interesting ways
165 filter-flags "-malign-double"
166 # Fixes bug #97645
167 use ppc && filter-flags -mpowerpc-gpopt
168 # Fixes bug #143895 on gcc-4.1.1
169 filter-flags "-fsched2-use-superblocks"
170
171 export LC_ALL="C"
172
173 case ${CHOST} in
174 *-freebsd*) osname="freebsd" ;;
175 *-dragonfly*) osname="dragonfly" ;;
176 *-netbsd*) osname="netbsd" ;;
177 *-openbsd*) osname="openbsd" ;;
178 *-darwin*) osname="darwin" ;;
179
180 *) osname="linux" ;;
181 esac
182
183 if use ithreads
184 then
185 einfo "using ithreads"
186 mythreading="-multi"
187 myconf -Dusethreads
188 myarch=${CHOST}
189 myarch="${myarch%%-*}-${osname}-thread"
190 else
191 myarch=${CHOST}
192 myarch="${myarch%%-*}-${osname}"
193 fi
194
195 local inclist=$(for v in $PERL_OLDVERSEN; do echo -n "$v $v/$myarch$mythreading "; done)
196
197 # allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
198
199 myndbm='U'
200 mygdbm='U'
201 mydb='U'
202
203 if use gdbm
204 then
205 mygdbm='D'
206 myndbm='D'
207 fi
208 if use berkdb
209 then
210 mydb='D'
211 has_version '=sys-libs/db-1*' && myndbm='D'
212 fi
213
214 myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
215
216 if use mips
217 then
218 # this is needed because gcc 3.3-compiled kernels will hang
219 # the machine trying to run this test - check with `Kumba
220 # <rac@gentoo.org> 2003.06.26
221 myconf -Dd_u32align
222 fi
223
224 if use debug
225 then
226 CFLAGS="${CFLAGS} -g"
227 myconf -DDEBUGGING
228 fi
229
230 if use sparc
231 then
232 myconf -Ud_longdbl
233 fi
234
235 if use alpha && "$(tc-getCC)" == "ccc"
236 then
237 ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
238 myconf -Ui_db -Ui_ndbm
239 fi
240
241 rm -f config.sh Policy.sh
242
243 [[ -n "${ABI}" ]] && myconf "-Dusrinc=$(get_ml_incdir)"
244
245 [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
246
247 if [[ $(get_libdir) != "lib" ]] ; then
248 myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
249 fi
250
251 sh Configure -des \
252 -Darchname="${myarch}" \
253 -Dcccdlflags="-fPIC" \
254 -Dccdlflags="-rdynamic" \
255 -Dcc="$(tc-getCC)" \
256 -Dprefix="/usr" \
257 -Dvendorprefix="/usr" \
258 -Dsiteprefix="/usr" \
259 -Dlocincpth=" " \
260 -Doptimize="${CFLAGS}" \
261 -Duselargefiles \
262 -Duseshrplib \
263 -Dman3ext="3pm" \
264 -Dlibperl="${LIBPERL}" \
265 -Dd_dosuid \
266 -Dd_semctl_semun \
267 -Dcf_by="Gentoo" \
268 -Ud_csh \
269 "${myconf[@]}" || die "Unable to configure"
270
271 emake -j1 -f Makefile depend || die "Couldn't make libperl$(get_libname) depends"
272 emake -j1 -f Makefile LIBPERL=${LIBPERL} ${LIBPERL} || die "Unable to make libperl$(get_libname)"
273 mv ${LIBPERL} ${WORKDIR}
274 }
275
276 src_install() {
277
278 export LC_ALL="C"
279
280 if [ "${PN}" = "libperl" ]
281 then
282 dolib.so ${WORKDIR}/${LIBPERL}
283 dosym ${LIBPERL} /usr/$(get_libdir)/libperl$(get_libname ${PERLSLOT})
284 else
285 # Need to do this, else apps do not link to dynamic version of
286 # the library ...
287 local coredir="/usr/$(get_libdir)/perl5/${PV}/${myarch}${mythreading}/CORE"
288 dodir ${coredir}
289 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/${LIBPERL}
290 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname ${PERLSLOT})
291 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname)
292
293 # Fix for "stupid" modules and programs
294 dodir /usr/$(get_libdir)/perl5/site_perl/${PV}/${myarch}${mythreading}
295
296 make DESTDIR="${D}" \
297 INSTALLMAN1DIR="${D}/usr/share/man/man1" \
298 INSTALLMAN3DIR="${D}/usr/share/man/man3" \
299 install || die "Unable to make install"
300
301 cp -f utils/h2ph utils/h2ph_patched
302
303 LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \
304 -a -d ${D}/usr/$(get_libdir)/perl5/${PV}/${myarch}${mythreading} <<EOF
305 asm/termios.h
306 syscall.h
307 syslimits.h
308 syslog.h
309 sys/ioctl.h
310 sys/socket.h
311 sys/time.h
312 wait.h
313 EOF
314
315 # This is to fix a missing c flag for backwards compat
316 for i in `find ${D}/usr/$(get_libdir)/perl5 -iname "Config.pm"`;do
317 sed -e "s:ccflags=':ccflags='-DPERL5 :" \
318 -e "s:cppflags=':cppflags='-DPERL5 :" \
319 ${i} > ${i}.new &&\
320 mv ${i}.new ${i} || die "Sed failed"
321 done
322
323 # A poor fix for the miniperl issues
324 dosed 's:./miniperl:/usr/bin/perl:' /usr/$(get_libdir)/perl5/${PV}/ExtUtils/xsubpp
325 fperms 0444 /usr/$(get_libdir)/perl5/${PV}/ExtUtils/xsubpp
326 dosed 's:./miniperl:/usr/bin/perl:' /usr/bin/xsubpp
327 fperms 0755 /usr/bin/xsubpp
328
329 ./perl installman \
330 --man1dir="${D}/usr/share/man/man1" --man1ext='1' \
331 --man3dir="${D}/usr/share/man/man3" --man3ext='3'
332
333 # This removes ${D} from Config.pm and .packlist
334 for i in `find ${D} -iname "Config.pm"` `find ${D} -iname ".packlist"`;do
335 einfo "Removing ${D} from ${i}..."
336 sed -e "s:${D}::" ${i} > ${i}.new &&\
337 mv ${i}.new ${i} || die "Sed failed"
338 done
339 fi
340
341 dodoc Changes* Artistic Copying README Todo* AUTHORS
342
343 if [ "${PN}" = "perl" ]
344 then
345 # HTML Documentation
346 # We expect errors, warnings, and such with the following.
347
348 dodir /usr/share/doc/${PF}/html
349 ./perl installhtml \
350 --podroot='.' \
351 --podpath='lib:ext:pod:vms' \
352 --recurse \
353 --htmldir="${D}/usr/share/doc/${PF}/html" \
354 --libpods='perlfunc:perlguts:perlvar:perlrun:perlop'
355 fi
356 }
357
358 pkg_postinst() {
359
360 # Make sure we do not have stale/invalid libperl.so 's ...
361 if [ -f "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" -a ! -L "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" ]
362 then
363 mv -f ${ROOT}usr/$(get_libdir)/libperl$(get_libname) ${ROOT}usr/$(get_libdir)/libperl$(get_libname).old
364 fi
365
366 # Next bit is to try and setup the /usr/lib/libperl.so symlink
367 # properly ...
368 local libnumber="`ls -1 ${ROOT}usr/$(get_libdir)/libperl$(get_libname ?.*) | grep -v '\.old' | wc -l`"
369 if [ "${libnumber}" -eq 1 ]
370 then
371 # Only this version of libperl is installed, so just link libperl.so
372 # to the *soname* version of it ...
373 ln -snf libperl$(get_libname ${PERLSLOT}) ${ROOT}usr/$(get_libdir)/libperl$(get_libname)
374 else
375 if [ -x "${ROOT}/usr/bin/perl" ]
376 then
377 # OK, we have more than one version .. first try to figure out
378 # if there are already a perl installed, if so, link libperl.so
379 # to that *soname* version of libperl.so ...
380 local perlversion="`${ROOT}/usr/bin/perl -V:version | cut -d\' -f2 | cut -d. -f1,2`"
381
382 cd ${ROOT}usr/$(get_libdir)
383 # Link libperl.so to the *soname* versioned lib ...
384 ln -snf `echo libperl$(get_libname ?.${perlversion}) | cut -d. -f1,2,3` libperl$(get_libname)
385 else
386 local x latest
387
388 # Nope, we are not so lucky ... try to figure out what version
389 # is the latest, and keep fingers crossed ...
390 for x in `ls -1 ${ROOT}usr/$(get_libdir)/libperl$(get_libname ?.*)`
391 do
392 latest="${x}"
393 done
394
395 cd ${ROOT}usr/$(get_libdir)
396 # Link libperl.so to the *soname* versioned lib ...
397 ln -snf `echo ${latest##*/} | cut -d. -f1,2,3` libperl$(get_libname)
398 fi
399 fi
400 }

  ViewVC Help
Powered by ViewVC 1.1.20