From a047717347ef856a7925e9597c0b0bd7040b3466 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 30 Jul 2014 16:57:43 -0700 Subject: [PATCH] spidermonkey: fix cross-compiling logic The existing ebuild uses a really crazy hack for cross compiling which may have worked a few versions ago but it doesn't now. The root issue is that Mozilla mixes up the meaning of "host" and "target" so give in to their stupid and setup the environment with their meaning. The configure script claimed in a comment: In Mozilla, we use the names $target, $host and $build incorrectly, but are too far gone to back out now. See Bug 475488: - When we say $target, we mean $host, that is, the system on which Mozilla will be run. - When we say $host, we mean $build, that is, the system on which Mozilla is built. - $target (in its correct usage) is for compilers who generate code for a different platform than $host, so it would not be used by Mozilla. I'm inclined to smack someone with a stick. --- ...3.ebuild => spidermonkey-17.0.0-r4.ebuild} | 44 +++++++------------ .../profiles/coreos/base/package.use | 2 + 2 files changed, 18 insertions(+), 28 deletions(-) rename sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/{spidermonkey-17.0.0-r3.ebuild => spidermonkey-17.0.0-r4.ebuild} (70%) diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-17.0.0-r3.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild similarity index 70% rename from sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-17.0.0-r3.ebuild rename to sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild index 6fdfce9819..344ee5b0b9 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-17.0.0-r3.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild @@ -58,17 +58,28 @@ src_prepare() { src_configure() { cd "${BUILDDIR}" || die - CC="$(tc-getCC)" CXX="$(tc-getCXX)" \ - AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \ - LD="$(tc-getLD)" \ + # Mozilla screws up the meaning of BUILD, HOST, and TARGET :( + tc-export_build_env CC CXX LD AR RANLIB PKG_CONFIG \ + BUILD_CC BUILD_CXX BUILD_LD BUILD_AR BUILD_RANLIB + export HOST_CC="${BUILD_CC}" HOST_CFLAGS="${BUILD_CFLAGS}" \ + HOST_CXX="${BUILD_CXX}" HOST_CXXFLAGS="${BUILD_CXXFLAGS}" \ + HOST_LD="${BUILD_LD}" HOST_LDFLAGS="${BUILD_LDFLAGS}" \ + HOST_AR="${BUILD_AR}" HOST_RANLIB="${BUILD_RANLIB}" + + # Use pkg-config instead of nspr-config to use $SYSROOT + local nspr_cflags="$(${PKG_CONFIG} --cflags nspr)" || die + local nspr_libs="$(${PKG_CONFIG} --libs nspr)" || die + econf \ ${myopts} \ + --host="${CBUILD}" \ + --target="${CHOST}" \ --enable-jemalloc \ --enable-readline \ --enable-threadsafe \ - --with-system-nspr \ --enable-system-ffi \ - --enable-jemalloc \ + --with-nspr-cflags="${nspr_cflags}" \ + --with-nspr-libs="${nspr_libs}" \ $(use_enable debug) \ $(use_enable jit tracejit) \ $(use_enable jit methodjit) \ @@ -78,29 +89,6 @@ src_configure() { src_compile() { cd "${BUILDDIR}" || die - if tc-is-cross-compiler; then - make CFLAGS="" CXXFLAGS="" \ - CC=$(tc-getBUILD_CC) CXX=$(tc-getBUILD_CXX) \ - AR=$(tc-getBUILD_AR) RANLIB=$(tc-getBUILD_RANLIB) \ - jscpucfg host_jsoplengen host_jskwgen || die - make CFLAGS="" CXXFLAGS="" \ - CC=$(tc-getBUILD_CC) CXX=$(tc-getBUILD_CXX) \ - AR=$(tc-getBUILD_AR) RANLIB=$(tc-getBUILD_RANLIB) \ - -C config nsinstall || die - mv {,native-}jscpucfg || die - mv {,native-}host_jskwgen || die - mv {,native-}host_jsoplengen || die - mv config/{,native-}nsinstall || die - sed -e 's@./jscpucfg@./native-jscpucfg@' \ - -e 's@./host_jskwgen@./native-host_jskwgen@' \ - -e 's@./host_jsoplengen@./native-host_jsoplengen@' \ - -i Makefile || die - sed -e 's@/nsinstall@/native-nsinstall@' -i config/config.mk || die - rm -f config/host_nsinstall.o \ - config/host_pathsub.o \ - host_jskwgen.o \ - host_jsoplengen.o || die - fi emake } diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/package.use b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/package.use index c5f0e50d90..d63a0dcc2e 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/package.use +++ b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/package.use @@ -81,3 +81,5 @@ sys-apps/systemd -ssl # disable kernel config detection and module building net-firewall/ipset -modules + +dev-lang/spidermonkey minimal