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

Contents of /sys-devel/libperl/libperl-5.8.6.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (show annotations) (download)
Fri Sep 8 10:44:59 2006 UTC (13 years, 1 month ago) by mcummings
Branch: MAIN
CVS Tags: HEAD
Changes since 1.21: +1 -1 lines
FILE REMOVED
Cleaning out stale files
(Portage version: 2.1.1_rc1-r3)
 (Signed Manifest commit)

1 # Copyright 1999-2006 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.6.ebuild,v 1.21 2006/02/07 18:54:56 mcummings 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
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="ftp://ftp.cpan.org/pub/CPAN/src/${MY_P}.tar.bz2"
67 HOMEPAGE="http://www.perl.org"
68 SLOT="${PERLSLOT}"
69 LIBPERL="libperl.so.${PERLSLOT}.${SHORT_PV}"
70 LICENSE="Artistic GPL-2"
71 KEYWORDS="~alpha ~amd64 arm ~hppa ~ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86"
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="!elibc_uclibc? ( sys-apps/groff )
84 berkdb? ( sys-libs/db )
85 gdbm? ( >=sys-libs/gdbm-1.8.0 )"
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 else
107 ewarn ""
108 ewarn "PLEASE NOTE: If you want to compile perl-5.8 with"
109 ewarn "threading enabled , you must restart this emerge"
110 ewarn "with USE=ithreads emerge...."
111 ewarn "Threading is not supported by all applications "
112 ewarn "that compile against perl. You use threading at "
113 ewarn "your own discretion. "
114 ewarn ""
115 epause 10
116 fi
117 }
118
119 src_unpack() {
120
121 unpack ${A}
122
123 # Fix the build scripts to create libperl with a soname of ${SLOT}.
124 # We basically add:
125 #
126 # -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3`
127 #
128 # to the line that links libperl.so, and then set LIBPERL to:
129 #
130 # LIBPERL=libperl.so.${SLOT}.`echo ${PV} | cut -d. -f1,2`
131 #
132 cd ${S}; epatch ${FILESDIR}/${PN}-create-libperl-soname.patch
133
134 # uclibc support - dragonheart 2004.06.16
135 cd ${S}; epatch ${FILESDIR}/${PN}-uclibc.patch
136
137 # Configure makes an unwarranted assumption that /bin/ksh is a
138 # good shell. This patch makes it revert to using /bin/sh unless
139 # /bin/ksh really is executable. Should fix bug 42665.
140 # rac 2004.06.09
141 cd ${S}; epatch ${FILESDIR}/${PN}-noksh.patch
142
143 # we need the same @INC-inversion magic here we do in perl
144 cd ${S}; epatch ${FILESDIR}/${PN}-reorder-INC.patch
145 }
146
147 src_compile() {
148 # Perl has problems compiling with -Os in your flags
149 use elibc_uclibc || replace-flags "-Os" "-O2"
150 # This flag makes compiling crash in interesting ways
151 filter-flags "-malign-double"
152
153 export LC_ALL="C"
154 local myconf=""
155
156 case ${CHOST} in
157 *-freebsd*) osname="freebsd" ;;
158 *-netbsd*) osname="netbsd" ;;
159 *-openbsd*) osname="openbsd" ;;
160 *-darwin*) osname="darwin" ;;
161
162 *) osname="linux" ;;
163 esac
164
165 if use ithreads
166 then
167 einfo "using ithreads"
168 mythreading="-multi"
169 myconf="-Dusethreads ${myconf}"
170 myarch=$(get_abi_CHOST)
171 myarch="${myarch%%-*}-${osname}-thread"
172 else
173 myarch=$(get_abi_CHOST)
174 myarch="${myarch%%-*}-${osname}"
175 fi
176
177 ewarn "myarch: ${myarch}"
178
179 if use gdbm
180 then
181 myconf="${myconf} -Di_gdbm"
182 fi
183 if use berkdb
184 then
185 myconf="${myconf} -Di_db -Di_ndbm"
186 else
187 myconf="${myconf} -Ui_db -Ui_ndbm"
188 fi
189 if use mips
190 then
191 # this is needed because gcc 3.3-compiled kernels will hang
192 # the machine trying to run this test - check with `Kumba
193 # <rac@gentoo.org> 2003.06.26
194 myconf="${myconf} -Dd_u32align"
195 fi
196
197 if use debug
198 then
199 CFLAGS="${CFLAGS} -g"
200 fi
201
202 if use sparc
203 then
204 myconf="${myconf} -Ud_longdbl"
205 fi
206
207 rm -f config.sh Policy.sh
208
209 [ -n "${ABI}" ] && myconf="${myconf} -Dusrinc=$(get_ml_incdir)"
210
211 [[ ${ELIBC} == "FreeBSD" ]] && myconf="${myconf} -Dlibc=/usr/lib/libc.a"
212
213 sh Configure -des \
214 -Darchname="${myarch}" \
215 -Dcccdlflags='-fPIC' \
216 -Dccdlflags='-rdynamic' \
217 -Dcc="$(tc-getCC)" \
218 -Dprefix='/usr' \
219 -Dvendorprefix='/usr' \
220 -Dsiteprefix='/usr' \
221 -Dlocincpth=' ' \
222 -Doptimize="${CFLAGS}" \
223 -Duselargefiles \
224 -Duseshrplib \
225 -Dman3ext='3pm' \
226 -Dlibperl="${LIBPERL}" \
227 -Dd_dosuid \
228 -Dd_semctl_semun \
229 -Dcf_by='Gentoo' \
230 -Ud_csh \
231 ${myconf} || die
232
233 emake -j1 -f Makefile depend || die "Couldn't make libperl.so depends"
234 emake -j1 -f Makefile LIBPERL=${LIBPERL} ${LIBPERL} || die "Unable to make libperl.so"
235 mv ${LIBPERL} ${WORKDIR}
236 }
237
238 src_install() {
239
240 export LC_ALL="C"
241
242 if [ "${PN}" = "libperl" ]
243 then
244 dolib.so ${WORKDIR}/${LIBPERL}
245 dosym ${LIBPERL} /usr/$(get_libdir)/libperl.so.${PERLSLOT}
246 else
247 # Need to do this, else apps do not link to dynamic version of
248 # the library ...
249 local coredir="/usr/lib/perl5/${PV}/${myarch}${mythreading}/CORE"
250 dodir ${coredir}
251 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/${LIBPERL}
252 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl.so.${PERLSLOT}
253 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl.so
254
255 # Fix for "stupid" modules and programs
256 dodir /usr/lib/perl5/site_perl/${PV}/${myarch}${mythreading}
257
258 make DESTDIR="${D}" \
259 INSTALLMAN1DIR="${D}/usr/share/man/man1" \
260 INSTALLMAN3DIR="${D}/usr/share/man/man3" \
261 install || die "Unable to make install"
262
263 cp -f utils/h2ph utils/h2ph_patched
264
265 LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \
266 -a -d ${D}/usr/lib/perl5/${PV}/${myarch}${mythreading} <<EOF
267 asm/termios.h
268 syscall.h
269 syslimits.h
270 syslog.h
271 sys/ioctl.h
272 sys/socket.h
273 sys/time.h
274 wait.h
275 EOF
276
277 # This is to fix a missing c flag for backwards compat
278 for i in `find ${D}/usr/lib/perl5 -iname "Config.pm"`;do
279 sed -e "s:ccflags=':ccflags='-DPERL5 :" \
280 -e "s:cppflags=':cppflags='-DPERL5 :" \
281 ${i} > ${i}.new &&\
282 mv ${i}.new ${i} || die "Sed failed"
283 done
284
285 # A poor fix for the miniperl issues
286 dosed 's:./miniperl:/usr/bin/perl:' /usr/lib/perl5/${PV}/ExtUtils/xsubpp
287 fperms 0444 /usr/lib/perl5/${PV}/ExtUtils/xsubpp
288 dosed 's:./miniperl:/usr/bin/perl:' /usr/bin/xsubpp
289 fperms 0755 /usr/bin/xsubpp
290
291 ./perl installman \
292 --man1dir="${D}/usr/share/man/man1" --man1ext='1' \
293 --man3dir="${D}/usr/share/man/man3" --man3ext='3'
294
295 # This removes ${D} from Config.pm and .packlist
296 for i in `find ${D} -iname "Config.pm"` `find ${D} -iname ".packlist"`;do
297 einfo "Removing ${D} from ${i}..."
298 sed -e "s:${D}::" ${i} > ${i}.new &&\
299 mv ${i}.new ${i} || die "Sed failed"
300 done
301 fi
302
303 dodoc Changes* Artistic Copying README Todo* AUTHORS
304
305 if [ "${PN}" = "perl" ]
306 then
307 # HTML Documentation
308 # We expect errors, warnings, and such with the following.
309
310 dodir /usr/share/doc/${PF}/html
311 ./perl installhtml \
312 --podroot='.' \
313 --podpath='lib:ext:pod:vms' \
314 --recurse \
315 --htmldir="${D}/usr/share/doc/${PF}/html" \
316 --libpods='perlfunc:perlguts:perlvar:perlrun:perlop'
317 fi
318 }
319
320 pkg_postinst() {
321
322 # Make sure we do not have stale/invalid libperl.so 's ...
323 if [ -f "${ROOT}usr/$(get_libdir)/libperl.so" -a ! -L "${ROOT}usr/$(get_libdir)/libperl.so" ]
324 then
325 mv -f ${ROOT}usr/$(get_libdir)/libperl.so ${ROOT}usr/$(get_libdir)/libperl.so.old
326 fi
327
328 # Next bit is to try and setup the /usr/lib/libperl.so symlink
329 # properly ...
330 local libnumber="`ls -1 ${ROOT}usr/$(get_libdir)/libperl.so.?.* | grep -v '\.old' | wc -l`"
331 if [ "${libnumber}" -eq 1 ]
332 then
333 # Only this version of libperl is installed, so just link libperl.so
334 # to the *soname* version of it ...
335 ln -snf libperl.so.${PERLSLOT} ${ROOT}usr/$(get_libdir)/libperl.so
336 else
337 if [ -x "${ROOT}/usr/bin/perl" ]
338 then
339 # OK, we have more than one version .. first try to figure out
340 # if there are already a perl installed, if so, link libperl.so
341 # to that *soname* version of libperl.so ...
342 local perlversion="`${ROOT}/usr/bin/perl -V:version | cut -d\' -f2 | cut -d. -f1,2`"
343
344 cd ${ROOT}usr/$(get_libdir)
345 # Link libperl.so to the *soname* versioned lib ...
346 ln -snf `echo libperl.so.?.${perlversion} | cut -d. -f1,2,3` libperl.so
347 else
348 local x latest
349
350 # Nope, we are not so lucky ... try to figure out what version
351 # is the latest, and keep fingers crossed ...
352 for x in `ls -1 ${ROOT}usr/$(get_libdir)/libperl.so.?.*`
353 do
354 latest="${x}"
355 done
356
357 cd ${ROOT}usr/$(get_libdir)
358 # Link libperl.so to the *soname* versioned lib ...
359 ln -snf `echo ${latest##*/} | cut -d. -f1,2,3` libperl.so
360 fi
361 fi
362 }
363

  ViewVC Help
Powered by ViewVC 1.1.20