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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (show annotations) (download)
Sat Feb 21 11:21:17 2004 UTC (15 years, 7 months ago) by mcummings
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +1 -1 lines
FILE REMOVED
finishing the clean up

1 # Copyright 1999-2004 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/sys-devel/libperl/libperl-5.8.0.ebuild,v 1.17 2004/01/18 06:46:05 rac 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
56 IUSE="berkdb gdbm"
57
58 inherit eutils flag-o-matic
59
60 # Perl has problems compiling with -Os in your flags
61 replace-flags "-Os" "-O2"
62 # This flag makes compiling crash in interesting ways
63 filter-flags "-malign-double"
64
65
66 # The slot of this binary compat version of libperl.so
67 PERLSLOT="1"
68
69 SHORT_PV="`echo ${PV} | cut -d. -f1,2`"
70 MY_P="${P/lib}"
71 S="${WORKDIR}/${MY_P}"
72 DESCRIPTION="Larry Wall's Practical Extraction and Reporting Language"
73 SRC_URI="ftp://ftp.perl.org/pub/CPAN/src/${MY_P}.tar.gz"
74 HOMEPAGE="http://www.perl.org"
75
76 if [ "${PN}" = "libperl" ]
77 then
78 SLOT="${PERLSLOT}"
79 else
80 SLOT="0"
81 fi
82
83 LIBPERL="libperl.so.${PERLSLOT}.${SHORT_PV}"
84
85 LICENSE="Artistic GPL-2"
86 KEYWORDS="amd64 x86 sparc ppc alpha mips hppa arm ia64"
87
88 DEPEND="sys-apps/groff
89 berkdb? ( amd64? sys-libs/db : ( >=sys-libs/db-3.2.3h-r3 =sys-libs/db-1.85-r1 ) )
90 gdbm? ( >=sys-libs/gdbm-1.8.0 )
91 >=sys-apps/portage-2.0.45-r4"
92 if [ "${PN}" = "perl" ]
93 then
94 DEPEND="${DEPEND}
95 =sys-devel/libperl-${PV}*"
96 fi
97
98 RDEPEND="
99 berkdb? ( amd64? sys-libs/db : ( >=sys-libs/db-3.2.3h-r3 =sys-libs/db-1.85-r1 ) )
100 gdbm? ( >=sys-libs/gdbm-1.8.0 )"
101
102 if [ "${PN}" = "libperl" ]
103 then
104 # If we are installing a new version of libperl, we *have* to update perl as
105 # well, else all things linking to libperl.so will break at *build* time ..
106 PDEPEND=">=dev-lang/perl-${PV}"
107 else
108 PDEPEND=">=dev-perl/Safe-2.09"
109 fi
110
111 pkg_setup() {
112 # I think this should rather be displayed if you *have* 'threads'
113 # in USE if it could break things ...
114 if [ -n "`use threads`" ]
115 then
116 ewarn ""
117 ewarn "PLEASE NOTE: You are compiling perl-5.8 with"
118 ewarn "threading enabled."
119 ewarn "Threading is not supported by all applications "
120 ewarn "that compile against perl. You use threading at "
121 ewarn "your own discretion. "
122 ewarn ""
123 sleep 10
124 else
125 ewarn ""
126 ewarn "PLEASE NOTE: If you want to compile perl-5.8 with"
127 ewarn "threading enabled , you must restart this emerge"
128 ewarn "with USE=threads emerge...."
129 ewarn "Threading is not supported by all applications "
130 ewarn "that compile against perl. You use threading at "
131 ewarn "your own discretion. "
132 ewarn ""
133 sleep 10
134 fi
135
136 if [ "${PN}" = "perl" -a ! -f /usr/lib/${LIBPERL} ]
137 then
138 # Make sure we have libperl installed ...
139 eerror "Cannot find /usr/lib/${LIBPERL}! Make sure that you"
140 eerror "have sys-libs/libperl installed properly ..."
141 die "Cannot find /usr/lib/${LIBPERL}!"
142 fi
143 }
144
145 src_unpack() {
146
147 unpack ${A}
148
149 if [ "${PN}" = "libperl" ]
150 then
151 # Fix the build scripts to create libperl with a soname of ${SLOT}.
152 # We basically add:
153 #
154 # -Wl,-soname -Wl,libperl.so.`echo $(LIBPERL) | cut -d. -f3`
155 #
156 # to the line that links libperl.so, and then set LIBPERL to:
157 #
158 # LIBPERL=libperl.so.${SLOT}.`echo ${PV} | cut -d. -f1,2`
159 #
160 cd ${S}; epatch ${FILESDIR}/${P}-create-libperl-soname.patch
161 else
162 # Fix the definition of 'int sockatmark(int);' in perl.h to have __THROW.
163 # This fixes bug #12605.
164 # <azarah@gentoo.org> (28 Dec 2002).
165 cd ${S}; epatch ${FILESDIR}/${P}-sockatmark-should-__THROW.patch
166 fi
167 }
168
169 src_compile() {
170
171 export LC_ALL="C"
172 local myconf=""
173
174 if [ "`use threads`" ]
175 then
176 einfo "using threads"
177 mythreading="-multi"
178 myconf="-Dusethreads ${myconf}"
179 myarch="${CHOST%%-*}-linux-thread"
180 else
181 myarch="${CHOST%%-*}-linux"
182 fi
183
184 if [ "`use gdbm`" ]
185 then
186 myconf="${myconf} -Di_gdbm"
187 fi
188 if [ "`use berkdb`" ]
189 then
190 myconf="${myconf} -Di_db -Di_ndbm"
191 else
192 myconf="${myconf} -Ui_db -Ui_ndbm"
193 fi
194 if [ "`use mips`" ]
195 then
196 # this is needed because gcc 3.3-compiled kernels will hang
197 # the machine trying to run this test - check with `Kumba
198 # <rac@gentoo.org> 2003.06.26
199 myconf="${myconf} -Dd_u32align"
200 fi
201 if [ "`use sparc`" ]
202 then
203 myconf="${myconf} -Ud_longdbl"
204 fi
205 if [ "`use sparc64`" ]
206 then
207 myconf="${myconf} -Ud_longdbl"
208 fi
209
210 if [ "${PN}" = "libperl" ]
211 then
212 rm -f config.sh Policy.sh
213
214 sh Configure -des \
215 -Darchname="${myarch}" \
216 -Dcccdlflags='-fPIC' \
217 -Dccdlflags='-rdynamic' \
218 -Dcc="${CC:-gcc}" \
219 -Dprefix='/usr' \
220 -Dvendorprefix='/usr' \
221 -Dsiteprefix='/usr' \
222 -Dlocincpth=' ' \
223 -Doptimize="${CFLAGS}" \
224 -Duselargefiles \
225 -Duseshrplib \
226 -Dman3ext='3pm' \
227 -Dlibperl="${LIBPERL}" \
228 -Dd_dosuid \
229 -Dd_semctl_semun \
230 -Dcf_by='Gentoo' \
231 -Ud_csh \
232 ${myconf} || die
233
234 emake -f Makefile depend || die "Couldn't make libperl.so depends"
235 emake -f Makefile ${LIBPERL} || die "Unable to make libperl.so"
236 mv ${LIBPERL} ${WORKDIR}
237 else
238 cat > config.over <<EOF
239 installprefix=${D}/usr
240 installarchlib=\`echo \$installarchlib | sed "s!\$prefix!\$installprefix!"\`
241 installbin=\`echo \$installbin | sed "s!\$prefix!\$installprefix!"\`
242 installman1dir=\`echo \$installman1dir | sed "s!\$prefix!\$installprefix!"\`
243 installman3dir=\`echo \$installman3dir | sed "s!\$prefix!\$installprefix!"\`
244 installman1dir=\`echo \$installman1dir | sed "s!/share/share/!/share/!"\`
245 installman3dir=\`echo \$installman3dir | sed "s!/share/share/!/share/!"\`
246 installman1dir=\`echo \$installman1dir | sed "s!/usr/man/!/usr/share/man/!"\`
247 installman3dir=\`echo \$installman3dir | sed "s!/usr/man/!/usr/share/man/!"\`
248 man1ext=1
249 man3ext=3pm
250 installprivlib=\`echo \$installprivlib | sed "s!\$prefix!\$installprefix!"\`
251 installscript=\`echo \$installscript | sed "s!\$prefix!\$installprefix!"\`
252 installsitelib=\`echo \$installsitelib | sed "s!\$prefix!\$installprefix!"\`
253 installsitearch=\`echo \$installsitearch | sed "s!\$prefix!\$installprefix!"\`
254 EOF
255 sleep 10
256 sh Configure -des \
257 -Darchname="${myarch}" \
258 -Dcc="${CC:-gcc}" \
259 -Dprefix='/usr' \
260 -Dvendorprefix='/usr' \
261 -Dsiteprefix='/usr' \
262 -Dlocincpth=' ' \
263 -Doptimize="${CFLAGS}" \
264 -Duselargefiles \
265 -Dd_dosuid \
266 -Dd_semctl_semun \
267 -Dscriptdir=/usr/bin \
268 -Dman3ext='3pm' \
269 -Dcf_by='Gentoo' \
270 -Ud_csh \
271 ${myconf} || die "Unable to configure"
272
273 MAKEOPTS="${MAKEOPTS} -j1" emake || die "Unable to make"
274
275 emake -i test CCDLFLAGS=
276 fi
277 }
278
279 src_install() {
280
281 export LC_ALL="C"
282
283 if [ "${PN}" = "libperl" ]
284 then
285 dolib.so ${WORKDIR}/${LIBPERL}
286 preplib
287 else
288 # Need to do this, else apps do not link to dynamic version of
289 # the library ...
290 local coredir="/usr/lib/perl5/${PV}/${myarch}${mythreading}/CORE"
291 dodir ${coredir}
292 dosym ../../../../${LIBPERL} ${coredir}/${LIBPERL}
293 dosym ../../../../${LIBPERL} ${coredir}/libperl.so.${PERLSLOT}
294 dosym ../../../../${LIBPERL} ${coredir}/libperl.so
295
296 # Fix for "stupid" modules and programs
297 dodir /usr/lib/perl5/site_perl/${PV}/${myarch}${mythreading}
298
299 make DESTDIR="${D}" \
300 INSTALLMAN1DIR="${D}/usr/share/man/man1" \
301 INSTALLMAN3DIR="${D}/usr/share/man/man3" \
302 install || die "Unable to make install"
303
304 cp -f utils/h2ph utils/h2ph_patched
305 epatch ${FILESDIR}/perl-5.8.0-RC2-special-h2ph-not-failing-on-machine_ansi_header.patch
306
307 LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \
308 -a -d ${D}/usr/lib/perl5/${PV}/${myarch}${mythreading} <<EOF
309 asm/termios.h
310 syscall.h
311 syslimits.h
312 syslog.h
313 sys/ioctl.h
314 sys/socket.h
315 sys/time.h
316 wait.h
317 EOF
318
319 # This is to fix a missing c flag for backwards compat
320 for i in `find ${D}/usr/lib/perl5 -iname "Config.pm"`;do
321 sed -e "s:ccflags=':ccflags='-DPERL5 :" \
322 -e "s:cppflags=':cppflags='-DPERL5 :" \
323 ${i} > ${i}.new &&\
324 mv ${i}.new ${i} || die "Sed failed"
325 done
326
327 # A poor fix for the miniperl issues
328 dosed 's:./miniperl:/usr/bin/perl:' /usr/lib/perl5/${PV}/ExtUtils/xsubpp
329 fperms 0444 /usr/lib/perl5/${PV}/ExtUtils/xsubpp
330 dosed 's:./miniperl:/usr/bin/perl:' /usr/bin/xsubpp
331 fperms 0755 /usr/bin/xsubpp
332
333
334 ./perl installman \
335 --man1dir="${D}/usr/share/man/man1" --man1ext='1' \
336 --man3dir="${D}/usr/share/man/man3" --man3ext='3'
337
338 # This removes ${D} from Config.pm and .packlist
339 for i in `find ${D} -iname "Config.pm"` `find ${D} -iname ".packlist"`;do
340 einfo "Removing ${D} from ${i}..."
341 sed -e "s:${D}::" ${i} > ${i}.new &&\
342 mv ${i}.new ${i} || die "Sed failed"
343 done
344 fi
345
346 dodoc Changes* Artistic Copying README Todo* AUTHORS
347
348 if [ "${PN}" = "perl" ]
349 then
350 # HTML Documentation
351 # We expect errors, warnings, and such with the following.
352
353 dodir /usr/share/doc/${PF}/html
354 ./perl installhtml \
355 --podroot='.' \
356 --podpath='lib:ext:pod:vms' \
357 --recurse \
358 --htmldir="${D}/usr/share/doc/${PF}/html" \
359 --libpods='perlfunc:perlguts:perlvar:perlrun:perlop'
360 fi
361 }
362
363 pkg_postinst() {
364
365 # Make sure we do not have stale/invalid libperl.so 's ...
366 if [ -f "${ROOT}usr/lib/libperl.so" -a ! -L "${ROOT}usr/lib/libperl.so" ]
367 then
368 mv -f ${ROOT}usr/lib/libperl.so ${ROOT}usr/lib/libperl.so.old
369 fi
370
371 if [ "${PN}" = "libperl" ]
372 then
373 # Next bit is to try and setup the /usr/lib/libperl.so symlink
374 # properly ...
375 local libnumber="`ls -1 ${ROOT}usr/lib/libperl.so.?.* | grep -v '\.old' | wc -l`"
376 if [ "${libnumber}" -eq 1 ]
377 then
378 # Only this version of libperl is installed, so just link libperl.so
379 # to the *soname* version of it ...
380 ln -snf libperl.so.${PERLSLOT} ${ROOT}usr/lib/libperl.so
381 else
382 if [ -x "${ROOT}/usr/bin/perl" ]
383 then
384 # OK, we have more than one version .. first try to figure out
385 # if there are already a perl installed, if so, link libperl.so
386 # to that *soname* version of libperl.so ...
387 local perlversion="`${ROOT}/usr/bin/perl -V:version | cut -d\' -f2 | cut -d. -f1,2`"
388
389 cd ${ROOT}usr/lib
390 # Link libperl.so to the *soname* versioned lib ...
391 ln -snf `echo libperl.so.?.${perlversion} | cut -d. -f1,2,3` libperl.so
392 else
393 local x latest
394
395 # Nope, we are not so lucky ... try to figure out what version
396 # is the latest, and keep fingers crossed ...
397 for x in `ls -1 ${ROOT}usr/lib/libperl.so.?.*`
398 do
399 latest="${x}"
400 done
401
402 cd ${ROOT}usr/lib
403 # Link libperl.so to the *soname* versioned lib ...
404 ln -snf `echo ${latest##*/} | cut -d. -f1,2,3` libperl.so
405 fi
406 fi
407 else
408 local perllib="`readlink -f ${ROOT}usr/lib/libperl.so | sed -e 's:^.*/::'`"
409
410 # If we are installing perl, we need the /usr/lib/libperl.so symlink to
411 # point to the version of perl we are running, else builing something
412 # against libperl.so will break ...
413 if [ "${perllib}" != "${LIBPERL}" ]
414 then
415 # Delete stale symlinks
416 rm -f ${ROOT}usr/lib/libperl.so
417 rm -f ${ROOT}usr/lib/libperl.so.${PERLSLOT}
418 # Regenerate libperl.so.${PERLSLOT}
419 ln -snf ${LIBPERL} ${ROOT}usr/lib/libperl.so.${PERLSLOT}
420 # Create libperl.so (we use the *soname* versioned lib here ..)
421 ln -snf libperl.so.${PERLSLOT} ${ROOT}usr/lib/libperl.so
422 fi
423
424 if [ "${ROOT}" = "/" ]
425 then
426 ebegin "Converting C header files to the corresponding Perl format"
427 cd /usr/include; h2ph *.h sys/*.h
428 fi
429
430 eerror ""
431 eerror "If this is an upgrade to a perl 5.6.1 system,"
432 eerror "~OR~ an upgrade to a previous Gentoo release"
433 eerror "of perl 5.8.0, prior to -r8 "
434 eerror "you may need to recompile applications that"
435 eerror "were emerged against the old libperl.so"
436 eerror ""
437 eerror "${FILESDIR}/libperl_rebuilder "
438 eerror "is provided to assist with this. "
439 eerror "PLEASE DO NOT INTERRUPT THE RUNNING OF THIS SCRIPT."
440 eerror "Part of the rebuilding of applications compiled against "
441 eerror "your old libperl involves temporarily unmerging"
442 eerror "them - interruptions could leave you with unmerged"
443 eerror "packages before they can be remerged."
444 eerror ""
445 eerror "If you have run the rebuilder and a package still gives"
446 eerror "you trouble, and re-emerging it fails to correct"
447 eerror "the problem, please check http://bugs.gentoo.org/"
448 eerror "for more information or to report a bug."
449 eerror ""
450 sleep 5
451 eerror ""
452
453 fi
454 }
455
456

  ViewVC Help
Powered by ViewVC 1.1.20