1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
7 PYTHON_REQ_USE="threads"
8 inherit toolchain-funcs multilib python-any-r1 versionator pax-utils
12 DESCRIPTION="Stand-alone JavaScript C library"
13 HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey"
14 SRC_URI="http://archive.mozilla.org/pub/js/${MY_PN}${PV}.tar.gz
15 https://dev.gentoo.org/~axs/distfiles/${PN}-slot17-patches-01.tar.xz"
19 # "MIPS, MacroAssembler is not supported" wrt #491294 for -mips
20 KEYWORDS="alpha ~amd64 ~arm -hppa ia64 -mips ppc ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
21 IUSE="debug jit minimal static-libs test"
23 REQUIRED_USE="debug? ( jit )"
24 RESTRICT="ia64? ( test )"
26 S="${WORKDIR}/${MY_P}"
27 BUILDDIR="${S}/js/src"
29 RDEPEND=">=dev-libs/nspr-4.9.4
32 >=sys-libs/zlib-1.1.4"
39 if [[ ${MERGE_TYPE} != "binary" ]]; then
40 python-any-r1_pkg_setup
46 "${WORKDIR}"/sm17/${PN}-${SLOT}-js-config-shebang.patch
47 "${WORKDIR}"/sm17/${PN}-${SLOT}-ia64-mmap.patch
48 "${WORKDIR}"/sm17/${PN}-17.0.0-fix-file-permissions.patch
49 "${WORKDIR}"/sm17/${PN}-17-clang.patch
50 "${FILESDIR}"/${PN}-perl-defined-array-check.patch
51 "${WORKDIR}"/sm17/${PN}-17-fix_pointer_dereference.patch
57 # Remove obsolete jsuword bug #506160
58 sed -i -e '/jsuword/d' "${BUILDDIR}"/jsval.h || die "sed failed"
60 if [[ ${CHOST} == *-freebsd* ]]; then
61 # Don't try to be smart, this does not work in cross-compile anyway
62 ln -sfn "${BUILDDIR}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk" || die
67 cd "${BUILDDIR}" || die
69 CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
70 AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
81 $(use_enable jit tracejit) \
82 $(use_enable jit methodjit) \
83 $(use_enable static-libs static) \
84 $(use_enable test tests)
89 CFLAGS="${BUILD_CFLAGS}" \
90 CXXFLAGS="${BUILD_CXXFLAGS}" \
94 RANLIB="${BUILD_RANLIB}" \
98 cd "${BUILDDIR}" || die
99 if tc-is-cross-compiler; then
100 tc-export_build_env BUILD_{AR,CC,CXX,RANLIB}
101 cross_make host_jsoplengen host_jskwgen
102 cross_make -C config nsinstall
103 mv {,native-}host_jskwgen || die
104 mv {,native-}host_jsoplengen || die
105 mv config/{,native-}nsinstall || die
107 -e 's@./host_jskwgen@./native-host_jskwgen@' \
108 -e 's@./host_jsoplengen@./native-host_jsoplengen@' \
110 sed -i -e 's@/nsinstall@/native-nsinstall@' config/config.mk || die
111 rm -f config/host_nsinstall.o \
112 config/host_pathsub.o \
114 host_jsoplengen.o || die
120 cd "${BUILDDIR}/jsapi-tests" || die
125 cd "${BUILDDIR}" || die
128 if ! use minimal; then
130 pax-mark m "${ED}/usr/bin/js${SLOT}" || die
133 rm -f "${ED}/usr/bin/js${SLOT}" || die
136 if ! use static-libs; then
137 # We can't actually disable building of static libraries
138 # They're used by the tests and in a few other places
139 find "${D}" -iname '*.a' -delete || die