From 5cffb2585c8c58ec4b83c120da46d583fa754a7f 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. --- .../spidermonkey/spidermonkey-1.8.5-r4.ebuild | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild index 45eca06fd0..e5dff36be1 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild @@ -66,17 +66,30 @@ src_prepare() { } src_configure() { + local nspr_cflags nspr_libs 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 + nspr_cflags="$(${PKG_CONFIG} --cflags nspr)" || die + nspr_libs="$(${PKG_CONFIG} --libs nspr)" || die + econf \ ${myopts} \ + --host="${CBUILD}" \ + --target="${CHOST}" \ --enable-jemalloc \ --enable-readline \ --enable-threadsafe \ - --with-system-nspr \ + --with-nspr-cflags="${nspr_cflags}" \ + --with-nspr-libs="${nspr_libs}" \ $(use_enable debug) \ $(use_enable static-libs static) \ $(use_enable test tests) @@ -84,29 +97,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 }