--- libperl-5.8.8-r2.ebuild 2010-02-02 07:12:27.000000000 -0500 +++ libperl-5.8.8-r3.ebuild 2010-02-02 07:23:13.110499678 -0500 @@ -104,6 +104,14 @@ ewarn "" epause 10 fi + + if tc-is-cross-compiler ; then + ewarn "It appears you are cross-compiling ${PN}." + ewarn "You must have libperl-${PV} (>=libperl-5.8.8-r3) and" + ewarn "perl-${PV} (>=perl-5.8.8-r9) installed on your" + ewarn "native build system or this build might fail." + epause 5 + fi } src_unpack() { @@ -155,6 +163,25 @@ # Respect CFLAGS even for linking when done with compiler epatch "${FILESDIR}"/${P}-ccld-cflags.patch + # Check the environment for {PERL_LIB}, {PERL_ARCHLIB} + # and {PERL_INC} and use relative headers + epatch "${FILESDIR}"/native-perlinc.patch + + # Dynamically load modules from ${PERLHOSTLIB} to + # use while compiling + epatch "${FILESDIR}"/perl-dynloader.patch + + # Use Config_heavy.pl from ${PERL_ARCHLIB} + epatch "${FILESDIR}"/perl-configpm-switch.patch + + if tc-is-cross-compiler; then + # Use ${HOSTPERL}, not miniperl, for cross-compiling + epatch "${FILESDIR}"/Makefile.SH.patch + + epatch "${FILESDIR}"/perl-moreconfig.patch + epatch "${FILESDIR}"/letgcc-find-errno.patch + fi + # Respect LDFLAGS sed -e 's/$(SHRPLDFLAGS)/& $(LDFLAGS)/' -i Makefile.SH } @@ -261,25 +288,38 @@ 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 \ - -Duseshrplib \ - -Dman3ext="3pm" \ - -Dlibperl="${LIBPERL}" \ - -Dd_dosuid \ - -Dd_semctl_semun \ - -Dcf_by="Gentoo" \ - -Ud_csh \ - "${myconf[@]}" || die "Unable to configure" + if tc-is-cross-compiler; then + # ${S}/config.sh is generated from config-bits. + # Bash substitution is used to alter options for each build + + source "${FILESDIR}"/config-bits || die "sourcing of config-bits failed" + make_configsh || die "make_configsh failed" + + sed -i -e "s|/usr/include|${ROOT}usr/include|g" \ + "${S}"/ext/Errno/Errno_pm.PL || die "sed of ${S}/ext/Errno/Errno_pm.PL failed" + + sh Configure -S $(use debug && echo '-DDEBUGGING') || die "Unable to configure" + else + sh Configure -des \ + -Darchname="${myarch}" \ + -Dcccdlflags="-fPIC" \ + -Dccdlflags="-rdynamic" \ + -Dcc="$(tc-getCC)" \ + -Dprefix="/usr" \ + -Dvendorprefix="/usr" \ + -Dsiteprefix="/usr" \ + -Dlocincpth=" " \ + -Doptimize="${CFLAGS}" \ + -Duselargefiles \ + -Duseshrplib \ + -Dman3ext="3pm" \ + -Dlibperl="${LIBPERL}" \ + -Dd_dosuid \ + -Dd_semctl_semun \ + -Dcf_by="Gentoo" \ + -Ud_csh \ + "${myconf[@]}" || die "Unable to configure" + fi emake -j1 -f Makefile depend || die "Couldn't make libperl$(get_libname) depends" emake -j1 -f Makefile LDFLAGS="${LDFLAGS}" LIBPERL=${LIBPERL} ${LIBPERL} || die "Unable to make libperl$(get_libname)"