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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download)
Wed Jun 29 22:13:08 2005 UTC (14 years, 3 months ago) by mcummings
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +1 -1 lines
FILE REMOVED
Perl 5.8.6 unmasking; perl 5.8.7 being added
(Portage version: 2.0.51.22-r1)

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

  ViewVC Help
Powered by ViewVC 1.1.20