--- nspr-4.9.6.ebuild 2013-03-29 02:24:59.000000000 +0100 +++ nspr-4.9.6-r1.ebuild 2013-04-15 11:35:04.000000000 +0200 @@ -2,12 +2,10 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-libs/nspr/nspr-4.9.6.ebuild,v 1.1 2013/03/29 01:24:59 anarchy Exp $ -EAPI=3 +EAPI=5 WANT_AUTOCONF="2.1" -inherit autotools eutils multilib toolchain-funcs versionator - -MIN_PV="$(get_version_component_range 2)" +inherit autotools eutils versionator multilib-minimal DESCRIPTION="Netscape Portable Runtime" HOMEPAGE="http://www.mozilla.org/projects/nspr/" @@ -40,56 +38,65 @@ # Respect LDFLAGS sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \ "${S}"/mozilla/nsprpub/config/rules.mk || die + + # not all generated makefiles are put into ${S}/build + # in-source build needs copying, we can't just set BUILD_DIR="${S}/build" + multilib_copy_sources } -src_configure() { - cd "${S}"/build +multilib_src_configure() { + cd build - # We use the standard BUILD_xxx but nspr uses HOST_xxx - tc-export_build_env BUILD_CC - export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS} - tc-export AR CC CXX RANLIB - [[ ${CBUILD} != ${CHOST} ]] \ - && export CROSS_COMPILE=1 \ - || unset CROSS_COMPILE - - local myconf - echo > "${T}"/test.c - ${CC} ${CFLAGS} ${CPPFLAGS} -c "${T}"/test.c -o "${T}"/test.o || die - case $(file "${T}"/test.o) in - *32-bit*x86-64*|*64-bit*|*ppc64*|*x86_64*) myconf+=" --enable-64bit";; - *32-bit*|*ppc*|*i386*) ;; - *) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";; - esac + # "real" cross-compiling, i.e. non-multilib needs testing - 2013-04-12 + if tc-is-cross-compiler; then + tc-export AR CC CXX RANLIB + + # most probably not needed + #export ac_cv_path_AR="${AR}" + + # build system swaps the meaning of BUILD and HOST + tc-export_build_env BUILD_CC + export HOST_CC=${BUILD_CC} \ + HOST_CFLAGS=${BUILD_CFLAGS} \ + HOST_LDFLAGS=${BUILD_LDFLAGS} \ + CROSS_COMPILE=1 + fi + + # econf sets --host=${CHOST}, eclasses might set --build=${CBUILD} + # switch CHOST and CBUILD for a proper econf - do not export these + local CHOST="${CBUILD:-${CHOST}}" + local CTARGET="${CTARGET:-${CHOST}}" + local CBUILD="${CTARGET}" - # Ancient autoconf needs help finding the right tools. LC_ALL="C" ECONF_SOURCE="../mozilla/nsprpub" \ - ac_cv_path_AR="${AR}" \ econf \ --libdir="${EPREFIX}/usr/$(get_libdir)" \ + $(if has_multilib_profile; then test64=$(get_libdir) + else test64=${CTARGET}; test64=${test64%%-*}; fi + if [[ -z "${test64##*64}" ]]; then echo "--enable-64bit" ; fi + ) \ $(use_enable debug) \ - $(use_enable !debug optimize) \ - ${myconf} + $(use_enable !debug optimize) } -src_compile() { - cd "${S}"/build - emake || die "failed to build" +multilib_src_compile() { + emake -C build || die "failed to build" } -src_install() { - # Their build system is royally confusing, as usual - MINOR_VERSION=${MIN_PV} # Used for .so version - cd "${S}"/build - emake DESTDIR="${D}" install || die "emake install failed" - - cd "${ED}"/usr/$(get_libdir) - einfo "removing static libraries as upstream has requested!" - rm -f *.a || die "failed to remove static libraries." - - # install nspr-config - dobin "${S}"/build/config/nspr-config || die "failed to install nspr-config" +multilib_src_install() { + emake -C build DESTDIR="${D}" install || die "emake install failed" # Remove stupid files in /usr/bin + einfo "removing static libraries as upstream has requested!" + rm -f "${ED}"/usr/$(get_libdir)/*.a || die "failed to remove static libraries." rm -f "${ED}"/usr/bin/prerr.properties || die "failed to cleanup unneeded files" + + # Append version magic + find "${ED}/usr/$(get_libdir)" -name "*.so" -exec mv {}{,.${PV}} \; \ + || die "appending version magic failed" + + # Install nspr-config + is_final_abi && { + dobin build/config/nspr-config || die "failed to install nspr-config" + } }