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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Fri Aug 12 12:09:37 2005 UTC (14 years, 3 months ago) by swegener
Branch: MAIN
Changes since 1.5: +2 -2 lines
USE_EXPANDed flags don't go into IUSE
(Portage version: 2.0.51.22-r2)

1 mcummings 1.1 # Copyright 1999-2005 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 swegener 1.6 # $Header: /var/cvsroot/gentoo-x86/sys-devel/libperl/libperl-5.8.7.ebuild,v 1.5 2005/08/12 10:20:13 mcummings Exp $
4 mcummings 1.1
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 swegener 1.6 IUSE="berkdb debug gdbm ithreads"
56 mcummings 1.1
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 mcummings 1.5 LIBPERL="libperl$(get_libname).${PERLSLOT}.${SHORT_PV}"
70 mcummings 1.1 LICENSE="Artistic GPL-2"
71 mcummings 1.5 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc-macos ~ppc64 ~s390 ~sh ~sparc ~x86"
72 mcummings 1.1
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 solar 1.4 DEPEND="!elibc_uclibc? ( sys-apps/groff )
84 mcummings 1.1 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     # Now upstreamed - MPC 2005.06.28
136     #cd ${S}; epatch ${FILESDIR}/${PN}-uclibc.patch
137    
138     # Configure makes an unwarranted assumption that /bin/ksh is a
139     # good shell. This patch makes it revert to using /bin/sh unless
140     # /bin/ksh really is executable. Should fix bug 42665.
141     # rac 2004.06.09
142     cd ${S}; epatch ${FILESDIR}/${PN}-noksh.patch
143    
144     # we need the same @INC-inversion magic here we do in perl
145     cd ${S}; epatch ${FILESDIR}/${PN}-reorder-INC.patch
146     }
147    
148     src_compile() {
149     # Perl has problems compiling with -Os in your flags
150     use elibc_uclibc || replace-flags "-Os" "-O2"
151     # This flag makes compiling crash in interesting ways
152     filter-flags "-malign-double"
153    
154     export LC_ALL="C"
155     local myconf=""
156    
157     if [[ ${KERNEL} == "FreeBSD" && "${ELIBC}" = "FreeBsd" ]]; then
158     osname="freebsd"
159 mcummings 1.5 elif [[ ${USERLAND} == "Darwin" ]]; then
160     osname="darwin"
161 mcummings 1.1 else
162     osname="linux"
163     fi
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 mcummings 1.5 emake -j1 -f Makefile depend || die "Couldn't make libperl$(get_libname) depends"
234     emake -j1 -f Makefile LIBPERL=${LIBPERL} ${LIBPERL} || die "Unable to make libperl$(get_libname)"
235 mcummings 1.1 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     preplib
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 mcummings 1.5 dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname).${PERLSLOT}
253     dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname)
254 mcummings 1.1
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 mcummings 1.5 if [ -f "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" -a ! -L "${ROOT}usr/$(get_libdir)/libperl$(get_libname)" ]
324 mcummings 1.1 then
325 mcummings 1.5 mv -f ${ROOT}usr/$(get_libdir)/libperl$(get_libname) ${ROOT}usr/$(get_libdir)/libperl$(get_libname).old
326 mcummings 1.1 fi
327    
328     # Next bit is to try and setup the /usr/lib/libperl.so symlink
329     # properly ...
330 mcummings 1.5 local libnumber="`ls -1 ${ROOT}usr/$(get_libdir)/libperl$(get_libname).?.* | grep -v '\.old' | wc -l`"
331 mcummings 1.1 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 mcummings 1.5 ln -snf libperl$(get_libname).${PERLSLOT} ${ROOT}usr/$(get_libdir)/libperl$(get_libname)
336 mcummings 1.1 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 mcummings 1.5 ln -snf `echo libperl$(get_libname).?.${perlversion} | cut -d. -f1,2,3` libperl$(get_libname)
347 mcummings 1.1 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 mcummings 1.5 for x in `ls -1 ${ROOT}usr/$(get_libdir)/libperl$(get_libname).?.*`
353 mcummings 1.1 do
354     latest="${x}"
355     done
356    
357     cd ${ROOT}usr/$(get_libdir)
358     # Link libperl.so to the *soname* versioned lib ...
359 mcummings 1.5 ln -snf `echo ${latest##*/} | cut -d. -f1,2,3` libperl$(get_libname)
360 mcummings 1.1 fi
361     fi
362     }
363    

  ViewVC Help
Powered by ViewVC 1.1.20