# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-lang/perl/perl-5.8.8-r2.ebuild,v 1.29 2007/02/11 14:15:44 grobian Exp $ inherit eutils flag-o-matic toolchain-funcs multilib # The slot of this binary compat version of libperl.so PERLSLOT="1" SHORT_PV="${PV%.*}" MY_P="perl-${PV/_rc/-RC}" MY_PV="${PV%_rc*}" DESCRIPTION="Larry Wall's Practical Extraction and Report Language" S="${WORKDIR}/${MY_P}" SRC_URI="mirror://cpan/src/${MY_P}.tar.gz" HOMEPAGE="http://www.perl.org/" LIBPERL="libperl$(get_libname ${PERLSLOT}.${SHORT_PV})" LICENSE="|| ( Artistic GPL-2 )" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" IUSE="berkdb debug doc gdbm ithreads perlsuid build" PERL_OLDVERSEN="" DEPEND="berkdb? ( sys-libs/db ) gdbm? ( >=sys-libs/gdbm-1.8.3 ) >=sys-devel/libperl-${PV} elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs ) !) or db1 myndbm='U' mygdbm='U' mydb='U' if use gdbm ; then mygdbm='D' myndbm='D' fi if use berkdb ; then mydb='D' has_version '=sys-libs/db-1*' && myndbm='D' fi myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db" if use mips ; then # this is needed because gcc 3.3-compiled kernels will hang # the machine trying to run this test - check with `Kumba # 2003.06.26 myconf -Dd_u32align fi if use perlsuid ; then myconf -Dd_dosuid ewarn "You have enabled Perl's suid compile. Please" ewarn "read http://perldoc.com/perl5.8.2/INSTALL.html#suidperl" epause 3 fi if use debug ; then CFLAGS="${CFLAGS} -g" myconf -DDEBUGGING fi if use sparc ; then myconf -Ud_longdbl fi if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then ewarn "Perl will not be built with berkdb support, use gcc if you needed it..." myconf -Ui_db -Ui_ndbm fi [[ -n "${ABI}" ]] && myconf "-Dusrinc=$(get_ml_incdir)" [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a" if [[ $(get_libdir) != "lib" ]] ; then # We need to use " and not ', as the written config.sh use ' ... myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)" fi sh Configure -des \ -Darchname="${myarch}" \ -Dcccdlflags='-fPIC' \ -Dccdlflags='-rdynamic' \ -Dcc="$(tc-getCC)" \ -Dprefix='/usr' \ -Dvendorprefix='/usr' \ -Dsiteprefix='/usr' \ -Dlocincpth=' ' \ -Doptimize="${CFLAGS}" \ -Duselargefiles \ -Dd_semctl_semun \ -Dscriptdir=/usr/bin \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dinstallman1dir=/usr/share/man/man1 \ -Dinstallman3dir=/usr/share/man/man3 \ -Dman1ext='1' \ -Dman3ext='3pm' \ -Dinc_version_list="$inclist" \ -Dinc_version_list="$inclist" \ -Dlocincpth="/usr/src/linux/include" \ -Dcf_by='Gentoo' \ -Ud_csh \ -Dusenm \ "${myconf[@]}" || die "Unable to configure" } src_compile() { # would like to bracket this with a test for the existence of a # dotfile, but can't clean it automatically now. src_configure emake -j1 || die "Unable to make" } src_test() { use elibc_uclibc && export MAKEOPTS="${MAKEOPTS} -j1" emake -i test CCDLFLAGS= || die "test failed" } src_install() { export LC_ALL="C" # Need to do this, else apps do not link to dynamic version of # the library ... local coredir="/usr/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading}/CORE" dodir ${coredir} dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/${LIBPERL} dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname ${PERLSLOT}) dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname) # Fix for "stupid" modules and programs dodir /usr/$(get_libdir)/perl5/site_perl/${MY_PV}/${myarch}${mythreading} local installtarget=install if use build ; then installtarget=install.perl fi make DESTDIR="${D}" ${installtarget} || die "Unable to make ${installtarget}" rm "${D}"/usr/bin/perl #TODO: eselect? ln -s perl${MY_PV} "${D}"/usr/bin/perl # cp -f utils/h2ph utils/h2ph_patched # epatch "${FILESDIR}"/${PN}-h2ph-ansi-header.patch # # LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \ # -a -d "${D}"/usr/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading} < /dev/null # Remove cruft einfo "Removing files that are not in the minimal install" echo "${MINIMAL_PERL_INSTALL}" for f in $(find . -type f ) ; do has "${f}" ${MINIMAL_PERL_INSTALL} || rm -f "${f}" done # Remove empty directories find . -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null popd > /dev/null } pkg_postinst() { INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${MY_PV}'|etc|local|perl$/; print "$line\n" }') if [[ "${ROOT}" = "/" ]] ; then ebegin "Removing old .ph files" for DIR in ${INC}; do if [[ -d "${ROOT}/${DIR}" ]]; then for file in $(find "${ROOT}/${DIR}" -name "*.ph" -type f); do rm "${ROOT}/${file}" einfo "<< ${file}" done fi done # Silently remove the now empty dirs for DIR in ${INC}; do if [[ -d "${ROOT}/${DIR}" ]]; then find "${ROOT}/${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null fi done ebegin "Generating ConfigLocal.pm (ignore any error)" enc2xs -C ebegin "Converting C header files to the corresponding Perl format" cd /usr/include h2ph * h2ph -r sys/* arpa/* netinet/* bits/* security/* asm/* gnu/* linux/* gentoo* # TODO: vv isn't it done above already ^^^^^ #cd /usr/include/linux #h2ph * fi # This has been moved into a function because rumor has it that a future release # of portage will allow us to check what version was just removed - which means # we will be able to invoke this only as needed :) # Tried doing this via -z, but $INC is too big... if [[ "${INC}x" != "x" ]]; then cleaner_msg epause 5 fi } cleaner_msg() { eerror "You have had multiple versions of perl. It is recommended" eerror "that you run perl-cleaner now. perl-cleaner will" eerror "assist with this transition. This script is capable" eerror "of cleaning out old .ph files, rebuilding modules for " eerror "your new version of perl, as well as re-emerging" eerror "applications that compiled against your old libperl$(get_libname)" eerror eerror "PLEASE DO NOT INTERRUPT THE RUNNING OF THIS SCRIPT." eerror "Part of the rebuilding of applications compiled against " eerror "your old libperl involves temporarily unmerging" eerror "them - interruptions could leave you with unmerged" eerror "packages before they can be remerged." eerror "" eerror "If you have run perl-cleaner and a package still gives" eerror "you trouble, and re-emerging it fails to correct" eerror "the problem, please check http://bugs.gentoo.org/" eerror "for more information or to report a bug." eerror "" }