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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations) (download)
Mon Mar 7 11:36:45 2011 UTC (4 years, 5 months ago) by tove
Branch: MAIN
Changes since 1.14: +2 -4 lines
Drop -Dusrinc=$(get_ml_incdir) (#357737)

(Portage version: 2.2.0_alpha26/cvs/Linux x86_64)

1 # Copyright 1999-2011 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-r2.ebuild,v 1.14 2010/03/31 18:48:44 armin76 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-1 GPL-2 GPL-3 )"
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 || use ppc64 && 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 # patch to fix bug #198196
149 # UTF/Regular expressions boundary error (CVE-2007-5116)
150 epatch "${FILESDIR}"/${P}-utf8-boundary.patch
151
152 # patch to fix bug #219203
153 epatch "${FILESDIR}"/${P}-CVE-2008-1927.patch
154
155 # Respect CFLAGS even for linking when done with compiler
156 epatch "${FILESDIR}"/${P}-ccld-cflags.patch
157
158 # Respect LDFLAGS
159 sed -e 's/$(SHRPLDFLAGS)/& $(LDFLAGS)/' -i Makefile.SH
160 }
161
162 myconf() {
163 myconf=( "${myconf[@]}" "$@" )
164 }
165
166 src_compile() {
167 declare -a myconf
168
169 # Perl has problems compiling with -Os in your flags
170 # some arches and -O do not mix :)
171 use ppc && replace-flags -O? -O1
172 # Perl has problems compiling with -Os in your flags with glibc
173 use elibc_uclibc || replace-flags "-Os" "-O2"
174 ( gcc-specs-ssp && use ia64 ) && append-flags -fno-stack-protector
175 # This flag makes compiling crash in interesting ways
176 filter-flags "-malign-double"
177 # Fixes bug #97645
178 use ppc && filter-flags -mpowerpc-gpopt
179 # Fixes bug #143895 on gcc-4.1.1
180 filter-flags "-fsched2-use-superblocks"
181
182 export LC_ALL="C"
183
184 case ${CHOST} in
185 *-freebsd*) osname="freebsd" ;;
186 *-dragonfly*) osname="dragonfly" ;;
187 *-netbsd*) osname="netbsd" ;;
188 *-openbsd*) osname="openbsd" ;;
189 *-darwin*) osname="darwin" ;;
190
191 *) osname="linux" ;;
192 esac
193
194 if use ithreads
195 then
196 einfo "using ithreads"
197 mythreading="-multi"
198 myconf -Dusethreads
199 myarch=${CHOST}
200 myarch="${myarch%%-*}-${osname}-thread"
201 else
202 myarch=${CHOST}
203 myarch="${myarch%%-*}-${osname}"
204 fi
205
206 local inclist=$(for v in $PERL_OLDVERSEN; do echo -n "$v $v/$myarch$mythreading "; done)
207
208 # allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
209
210 myndbm='U'
211 mygdbm='U'
212 mydb='U'
213
214 if use gdbm
215 then
216 mygdbm='D'
217 myndbm='D'
218 fi
219 if use berkdb
220 then
221 mydb='D'
222 has_version '=sys-libs/db-1*' && myndbm='D'
223 fi
224
225 myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
226
227 if use mips
228 then
229 # this is needed because gcc 3.3-compiled kernels will hang
230 # the machine trying to run this test - check with `Kumba
231 # <rac@gentoo.org> 2003.06.26
232 myconf -Dd_u32align
233 fi
234
235 if use debug
236 then
237 CFLAGS="${CFLAGS} -g"
238 myconf -DDEBUGGING
239 fi
240
241 if use sparc
242 then
243 myconf -Ud_longdbl
244 fi
245
246 if use alpha && "$(tc-getCC)" == "ccc"
247 then
248 ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
249 myconf -Ui_db -Ui_ndbm
250 fi
251
252 rm -f config.sh Policy.sh
253
254 [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
255
256 if [[ $(get_libdir) != "lib" ]] ; then
257 myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
258 fi
259
260 sh Configure -des \
261 -Darchname="${myarch}" \
262 -Dcccdlflags="-fPIC" \
263 -Dccdlflags="-rdynamic" \
264 -Dcc="$(tc-getCC)" \
265 -Dprefix="/usr" \
266 -Dvendorprefix="/usr" \
267 -Dsiteprefix="/usr" \
268 -Dlocincpth=" " \
269 -Doptimize="${CFLAGS}" \
270 -Duselargefiles \
271 -Duseshrplib \
272 -Dman3ext="3pm" \
273 -Dlibperl="${LIBPERL}" \
274 -Dd_dosuid \
275 -Dd_semctl_semun \
276 -Dcf_by="Gentoo" \
277 -Ud_csh \
278 "${myconf[@]}" || die "Unable to configure"
279
280 emake -j1 -f Makefile depend || die "Couldn't make libperl$(get_libname) depends"
281 emake -j1 -f Makefile LDFLAGS="${LDFLAGS}" LIBPERL=${LIBPERL} ${LIBPERL} || die "Unable to make libperl$(get_libname)"
282 mv ${LIBPERL} "${WORKDIR}"
283 }
284
285 src_install() {
286
287 export LC_ALL="C"
288
289 if [ "${PN}" = "libperl" ]
290 then
291 dolib.so "${WORKDIR}"/${LIBPERL}
292 dosym ${LIBPERL} /usr/$(get_libdir)/libperl$(get_libname ${PERLSLOT})
293 else
294 # Need to do this, else apps do not link to dynamic version of
295 # the library ...
296 local coredir="/usr/$(get_libdir)/perl5/${PV}/${myarch}${mythreading}/CORE"
297 dodir ${coredir}
298 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/${LIBPERL}
299 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname ${PERLSLOT})
300 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname)
301
302 # Fix for "stupid" modules and programs
303 dodir /usr/$(get_libdir)/perl5/site_perl/${PV}/${myarch}${mythreading}
304
305 make DESTDIR="${D}" \
306 INSTALLMAN1DIR="${D}/usr/share/man/man1" \
307 INSTALLMAN3DIR="${D}/usr/share/man/man3" \
308 install || die "Unable to make install"
309
310 cp -f utils/h2ph utils/h2ph_patched
311
312 LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \
313 -a -d "${D}"/usr/$(get_libdir)/perl5/${PV}/${myarch}${mythreading} <<EOF
314 asm/termios.h
315 syscall.h
316 syslimits.h
317 syslog.h
318 sys/ioctl.h
319 sys/socket.h
320 sys/time.h
321 wait.h
322 EOF
323
324 # This is to fix a missing c flag for backwards compat
325 for i in `find "${D}"/usr/$(get_libdir)/perl5 -iname "Config.pm"`;do
326 sed -e "s:ccflags=':ccflags='-DPERL5 :" \
327 -e "s:cppflags=':cppflags='-DPERL5 :" \
328 ${i} > ${i}.new &&\
329 mv ${i}.new ${i} || die "Sed failed"
330 done
331
332 # A poor fix for the miniperl issues
333 dosed 's:./miniperl:/usr/bin/perl:' /usr/$(get_libdir)/perl5/${PV}/ExtUtils/xsubpp
334 fperms 0444 /usr/$(get_libdir)/perl5/${PV}/ExtUtils/xsubpp
335 dosed 's:./miniperl:/usr/bin/perl:' /usr/bin/xsubpp
336 fperms 0755 /usr/bin/xsubpp
337
338 ./perl installman \
339 --man1dir="${D}/usr/share/man/man1" --man1ext='1' \
340 --man3dir="${D}/usr/share/man/man3" --man3ext='3'
341
342 # This removes ${D} from Config.pm and .packlist
343 for i in `find "${D}" -iname "Config.pm"` `find "${D}" -iname ".packlist"`;do
344 einfo "Removing ${D} from ${i}..."
345 sed -e "s:${D}::" ${i} > "${i}.new" &&\
346 mv "${i}.new" "${i}" || die "Sed failed"
347 done
348 fi
349
350 dodoc Changes* Artistic Copying README Todo* AUTHORS
351
352 if [ "${PN}" = "perl" ]
353 then
354 # HTML Documentation
355 # We expect errors, warnings, and such with the following.
356
357 dodir /usr/share/doc/${PF}/html
358 ./perl installhtml \
359 --podroot='.' \
360 --podpath='lib:ext:pod:vms' \
361 --recurse \
362 --htmldir="${D}/usr/share/doc/${PF}/html" \
363 --libpods='perlfunc:perlguts:perlvar:perlrun:perlop'
364 fi
365 }
366
367 pkg_postinst() {
368
369 # Make sure we do not have stale/invalid libperl.so 's ...
370 if [ -f "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" -a ! -L "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" ]
371 then
372 mv -f "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" "${ROOT}usr/$(get_libdir)/libperl$(get_libname).old"
373 fi
374
375 # Next bit is to try and setup the /usr/lib/libperl.so symlink
376 # properly ...
377 local libnumber="`ls -1 "${ROOT}"usr/$(get_libdir)/libperl$(get_libname ?.*) | grep -v '\.old' | wc -l`"
378 if [ "${libnumber}" -eq 1 ]
379 then
380 # Only this version of libperl is installed, so just link libperl.so
381 # to the *soname* version of it ...
382 ln -snf libperl$(get_libname ${PERLSLOT}) "${ROOT}"/usr/$(get_libdir)/libperl$(get_libname)
383 else
384 if [ -x "${ROOT}/usr/bin/perl" ]
385 then
386 # OK, we have more than one version .. first try to figure out
387 # if there are already a perl installed, if so, link libperl.so
388 # to that *soname* version of libperl.so ...
389 local perlversion="`${ROOT}/usr/bin/perl -V:version | cut -d\' -f2 | cut -d. -f1,2`"
390
391 cd "${ROOT}"/usr/$(get_libdir)
392 # Link libperl.so to the *soname* versioned lib ...
393 ln -snf `echo libperl$(get_libname ?.${perlversion}) | cut -d. -f1,2,3` libperl$(get_libname)
394 else
395 local x latest
396
397 # Nope, we are not so lucky ... try to figure out what version
398 # is the latest, and keep fingers crossed ...
399 for x in `ls -1 "${ROOT}"/usr/$(get_libdir)/libperl$(get_libname ?.*)`
400 do
401 latest="${x}"
402 done
403
404 cd "${ROOT}"/usr/$(get_libdir)
405 # Link libperl.so to the *soname* versioned lib ...
406 ln -snf `echo ${latest##*/} | cut -d. -f1,2,3` libperl$(get_libname)
407 fi
408 fi
409 }

  ViewVC Help
Powered by ViewVC 1.1.20