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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Tue Nov 30 21:01:58 2004 UTC (14 years, 10 months ago) by rac
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +1 -1 lines
FILE REMOVED
5.8.6

1 # Copyright 1999-2004 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.3.ebuild,v 1.13 2004/09/27 11:33:08 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
58
59 # Perl has problems compiling with -Os in your flags
60 replace-flags "-Os" "-O2"
61 # This flag makes compiling crash in interesting ways
62 filter-flags "-malign-double"
63
64 # The slot of this binary compat version of libperl.so
65 PERLSLOT="1"
66
67 SHORT_PV="${PV%.*}"
68 MY_P="perl-${PV/_rc/-RC}"
69 S="${WORKDIR}/${MY_P}"
70 DESCRIPTION="Larry Wall's Practical Extraction and Reporting Language"
71 SRC_URI="ftp://ftp.cpan.org/pub/CPAN/src/${MY_P}.tar.gz"
72 HOMEPAGE="http://www.perl.org"
73 RESTRICT="maketest"
74
75 if [ "${PN}" = "libperl" ]
76 then
77 SLOT="${PERLSLOT}"
78 else
79 SLOT="0"
80 fi
81
82 LIBPERL="libperl.so.${PERLSLOT}.${SHORT_PV}"
83
84 LICENSE="Artistic GPL-2"
85 KEYWORDS="~x86 ~ppc ~sparc ~mips ~alpha arm ~hppa ~amd64 ~ia64 ~ppc64 s390"
86
87 DEPEND="sys-apps/groff
88 berkdb? ( sys-libs/db )
89 gdbm? ( >=sys-libs/gdbm-1.8.0 )
90 >=sys-apps/portage-2.0.45-r4"
91
92 RDEPEND="
93 berkdb? ( sys-libs/db )
94 gdbm? ( >=sys-libs/gdbm-1.8.0 )"
95
96 PDEPEND=">=dev-lang/perl-${PV}"
97
98 pkg_setup() {
99 # I think this should rather be displayed if you *have* 'ithreads'
100 # in USE if it could break things ...
101 if use ithreads
102 then
103 ewarn ""
104 ewarn "PLEASE NOTE: You are compiling perl-5.8 with"
105 ewarn "interpreter-level threading enabled."
106 ewarn "Threading is not supported by all applications "
107 ewarn "that compile against perl. You use threading at "
108 ewarn "your own discretion. "
109 ewarn ""
110 epause 10
111 else
112 ewarn ""
113 ewarn "PLEASE NOTE: If you want to compile perl-5.8 with"
114 ewarn "threading enabled , you must restart this emerge"
115 ewarn "with USE=ithreads emerge...."
116 ewarn "Threading is not supported by all applications "
117 ewarn "that compile against perl. You use threading at "
118 ewarn "your own discretion. "
119 ewarn ""
120 epause 10
121 fi
122 }
123
124 src_unpack() {
125
126 unpack ${A}
127
128 # Fix the build scripts to create libperl with a soname of ${SLOT}.
129 # We basically add:
130 #
131 # -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3`
132 #
133 # to the line that links libperl.so, and then set LIBPERL to:
134 #
135 # LIBPERL=libperl.so.${SLOT}.`echo ${PV} | cut -d. -f1,2`
136 #
137 cd ${S}; epatch ${FILESDIR}/${P}-create-libperl-soname.patch
138 }
139
140 src_compile() {
141
142 export LC_ALL="C"
143 local myconf=""
144
145 if use ithreads
146 then
147 einfo "using ithreads"
148 mythreading="-multi"
149 myconf="-Dusethreads ${myconf}"
150 myarch="${CHOST%%-*}-linux-thread"
151 else
152 myarch="${CHOST%%-*}-linux"
153 fi
154
155 if use gdbm
156 then
157 myconf="${myconf} -Di_gdbm"
158 fi
159 if use berkdb
160 then
161 myconf="${myconf} -Di_db -Di_ndbm"
162 else
163 myconf="${myconf} -Ui_db -Ui_ndbm"
164 fi
165 if use mips
166 then
167 # this is needed because gcc 3.3-compiled kernels will hang
168 # the machine trying to run this test - check with `Kumba
169 # <rac@gentoo.org> 2003.06.26
170 myconf="${myconf} -Dd_u32align"
171 fi
172
173 if use debug
174 then
175 CFLAGS="${CFLAGS} -g"
176 fi
177
178 if use sparc
179 then
180 myconf="${myconf} -Ud_longdbl"
181 fi
182
183 if [ "${PN}" = "libperl" ]
184 then
185 rm -f config.sh Policy.sh
186
187 sh Configure -des \
188 -Darchname="${myarch}" \
189 -Dcccdlflags='-fPIC' \
190 -Dccdlflags='-rdynamic' \
191 -Dcc="${CC:-gcc}" \
192 -Dprefix='/usr' \
193 -Dvendorprefix='/usr' \
194 -Dsiteprefix='/usr' \
195 -Dlocincpth=' ' \
196 -Doptimize="${CFLAGS}" \
197 -Duselargefiles \
198 -Duseshrplib \
199 -Dman3ext='3pm' \
200 -Dlibperl="${LIBPERL}" \
201 -Dd_dosuid \
202 -Dd_semctl_semun \
203 -Dcf_by='Gentoo' \
204 -Ud_csh \
205 ${myconf} || die
206
207 emake -f Makefile depend || die "Couldn't make libperl.so depends"
208 emake -f Makefile ${LIBPERL} || die "Unable to make libperl.so"
209 mv ${LIBPERL} ${WORKDIR}
210 else
211 cat > config.over <<EOF
212 installprefix=${D}/usr
213 installarchlib=\`echo \$installarchlib | sed "s!\$prefix!\$installprefix!"\`
214 installbin=\`echo \$installbin | sed "s!\$prefix!\$installprefix!"\`
215 installman1dir=\`echo \$installman1dir | sed "s!\$prefix!\$installprefix!"\`
216 installman3dir=\`echo \$installman3dir | sed "s!\$prefix!\$installprefix!"\`
217 installman1dir=\`echo \$installman1dir | sed "s!/share/share/!/share/!"\`
218 installman3dir=\`echo \$installman3dir | sed "s!/share/share/!/share/!"\`
219 installman1dir=\`echo \$installman1dir | sed "s!/usr/man/!/usr/share/man/!"\`
220 installman3dir=\`echo \$installman3dir | sed "s!/usr/man/!/usr/share/man/!"\`
221 man1ext=1
222 man3ext=3pm
223 installprivlib=\`echo \$installprivlib | sed "s!\$prefix!\$installprefix!"\`
224 installscript=\`echo \$installscript | sed "s!\$prefix!\$installprefix!"\`
225 installsitelib=\`echo \$installsitelib | sed "s!\$prefix!\$installprefix!"\`
226 installsitearch=\`echo \$installsitearch | sed "s!\$prefix!\$installprefix!"\`
227 EOF
228 sleep 10
229 sh Configure -des \
230 -Darchname="${myarch}" \
231 -Dcc="${CC:-gcc}" \
232 -Dprefix='/usr' \
233 -Dvendorprefix='/usr' \
234 -Dsiteprefix='/usr' \
235 -Dlocincpth=' ' \
236 -Doptimize="${CFLAGS}" \
237 -Duselargefiles \
238 -Dd_dosuid \
239 -Dd_semctl_semun \
240 -Dscriptdir=/usr/bin \
241 -Dman3ext='3pm' \
242 -Dcf_by='Gentoo' \
243 -Ud_csh \
244 ${myconf} || die "Unable to configure"
245
246 MAKEOPTS="${MAKEOPTS} -j1" emake || die "Unable to make"
247
248 emake -i test CCDLFLAGS=
249 fi
250 }
251
252 src_install() {
253
254 export LC_ALL="C"
255
256 if [ "${PN}" = "libperl" ]
257 then
258 dolib.so ${WORKDIR}/${LIBPERL}
259 preplib
260 else
261 # Need to do this, else apps do not link to dynamic version of
262 # the library ...
263 local coredir="/usr/lib/perl5/${PV}/${myarch}${mythreading}/CORE"
264 dodir ${coredir}
265 dosym ../../../../${LIBPERL} ${coredir}/${LIBPERL}
266 dosym ../../../../${LIBPERL} ${coredir}/libperl.so.${PERLSLOT}
267 dosym ../../../../${LIBPERL} ${coredir}/libperl.so
268
269 # Fix for "stupid" modules and programs
270 dodir /usr/lib/perl5/site_perl/${PV}/${myarch}${mythreading}
271
272 make DESTDIR="${D}" \
273 INSTALLMAN1DIR="${D}/usr/share/man/man1" \
274 INSTALLMAN3DIR="${D}/usr/share/man/man3" \
275 install || die "Unable to make install"
276
277 cp -f utils/h2ph utils/h2ph_patched
278
279 LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \
280 -a -d ${D}/usr/lib/perl5/${PV}/${myarch}${mythreading} <<EOF
281 asm/termios.h
282 syscall.h
283 syslimits.h
284 syslog.h
285 sys/ioctl.h
286 sys/socket.h
287 sys/time.h
288 wait.h
289 EOF
290
291 # This is to fix a missing c flag for backwards compat
292 for i in `find ${D}/usr/lib/perl5 -iname "Config.pm"`;do
293 sed -e "s:ccflags=':ccflags='-DPERL5 :" \
294 -e "s:cppflags=':cppflags='-DPERL5 :" \
295 ${i} > ${i}.new &&\
296 mv ${i}.new ${i} || die "Sed failed"
297 done
298
299 # A poor fix for the miniperl issues
300 dosed 's:./miniperl:/usr/bin/perl:' /usr/lib/perl5/${PV}/ExtUtils/xsubpp
301 fperms 0444 /usr/lib/perl5/${PV}/ExtUtils/xsubpp
302 dosed 's:./miniperl:/usr/bin/perl:' /usr/bin/xsubpp
303 fperms 0755 /usr/bin/xsubpp
304
305 ./perl installman \
306 --man1dir="${D}/usr/share/man/man1" --man1ext='1' \
307 --man3dir="${D}/usr/share/man/man3" --man3ext='3'
308
309 # This removes ${D} from Config.pm and .packlist
310 for i in `find ${D} -iname "Config.pm"` `find ${D} -iname ".packlist"`;do
311 einfo "Removing ${D} from ${i}..."
312 sed -e "s:${D}::" ${i} > ${i}.new &&\
313 mv ${i}.new ${i} || die "Sed failed"
314 done
315 fi
316
317 dodoc Changes* Artistic Copying README Todo* AUTHORS
318
319 if [ "${PN}" = "perl" ]
320 then
321 # HTML Documentation
322 # We expect errors, warnings, and such with the following.
323
324 dodir /usr/share/doc/${PF}/html
325 ./perl installhtml \
326 --podroot='.' \
327 --podpath='lib:ext:pod:vms' \
328 --recurse \
329 --htmldir="${D}/usr/share/doc/${PF}/html" \
330 --libpods='perlfunc:perlguts:perlvar:perlrun:perlop'
331 fi
332 }
333
334 pkg_postinst() {
335
336 # Make sure we do not have stale/invalid libperl.so 's ...
337 if [ -f "${ROOT}usr/lib/libperl.so" -a ! -L "${ROOT}usr/lib/libperl.so" ]
338 then
339 mv -f ${ROOT}usr/lib/libperl.so ${ROOT}usr/lib/libperl.so.old
340 fi
341
342 # Next bit is to try and setup the /usr/lib/libperl.so symlink
343 # properly ...
344 local libnumber="`ls -1 ${ROOT}usr/lib/libperl.so.?.* | grep -v '\.old' | wc -l`"
345 if [ "${libnumber}" -eq 1 ]
346 then
347 # Only this version of libperl is installed, so just link libperl.so
348 # to the *soname* version of it ...
349 ln -snf libperl.so.${PERLSLOT} ${ROOT}usr/lib/libperl.so
350 else
351 if [ -x "${ROOT}/usr/bin/perl" ]
352 then
353 # OK, we have more than one version .. first try to figure out
354 # if there are already a perl installed, if so, link libperl.so
355 # to that *soname* version of libperl.so ...
356 local perlversion="`${ROOT}/usr/bin/perl -V:version | cut -d\' -f2 | cut -d. -f1,2`"
357
358 cd ${ROOT}usr/lib
359 # Link libperl.so to the *soname* versioned lib ...
360 ln -snf `echo libperl.so.?.${perlversion} | cut -d. -f1,2,3` libperl.so
361 else
362 local x latest
363
364 # Nope, we are not so lucky ... try to figure out what version
365 # is the latest, and keep fingers crossed ...
366 for x in `ls -1 ${ROOT}usr/lib/libperl.so.?.*`
367 do
368 latest="${x}"
369 done
370
371 cd ${ROOT}usr/lib
372 # Link libperl.so to the *soname* versioned lib ...
373 ln -snf `echo ${latest##*/} | cut -d. -f1,2,3` libperl.so
374 fi
375 fi
376 }
377

  ViewVC Help
Powered by ViewVC 1.1.20