1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
7 PYTHON_REQ_USE="threads"
8 inherit autotools toolchain-funcs multilib python-any-r1 versionator pax-utils
11 TARBALL_PV="$(replace_all_version_separators '' $(get_version_component_range 1-3))"
13 TARBALL_P="${MY_PN}${TARBALL_PV}-1.0.0"
14 DESCRIPTION="Stand-alone JavaScript C library"
15 HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey"
16 SRC_URI="https://archive.mozilla.org/pub/js/${TARBALL_P}.tar.gz
17 https://dev.gentoo.org/~axs/distfiles/${PN}-slot0-patches-02.tar.xz
22 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 x86 ~x64-macos"
23 IUSE="debug minimal static-libs test"
24 RESTRICT="!test? ( test )"
26 S="${WORKDIR}/${MY_P}"
27 BUILDDIR="${S}/js/src"
29 RDEPEND=">=dev-libs/nspr-4.7.0
31 x64-macos? ( dev-libs/jemalloc )"
38 "${WORKDIR}"/sm0/${P}-fix-install-symlinks.patch
39 "${WORKDIR}"/sm0/${P}-fix-ppc64.patch
40 "${WORKDIR}"/sm0/${P}-arm_respect_cflags-3.patch
41 "${WORKDIR}"/sm0/${PN}-1.8.7-freebsd-pthreads.patch
42 "${WORKDIR}"/sm0/${P}-perf_event-check.patch
43 "${WORKDIR}"/sm0/${P}-symbol-versions.patch
44 "${WORKDIR}"/sm0/${P}-ia64-fix.patch
45 "${WORKDIR}"/sm0/${P}-ia64-static-strings.patch
46 "${WORKDIR}"/sm0/${P}-isfinite.patch
47 "${FILESDIR}"/${PN}-perl-defined-array-check.patch
48 "${WORKDIR}"/sm0/${PN}-1.8.7-x32.patch
49 "${WORKDIR}"/sm0/${P}-gcc6.patch
50 "${WORKDIR}"/sm0/${P}-drop-asm-volatile-toplevel.patch
54 HTML_DOCS=( ${BUILDDIR}/README.html )
57 if [[ ${MERGE_TYPE} != "binary" ]]; then
67 cd "${BUILDDIR}" || die
72 cd "${BUILDDIR}" || die
74 CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
75 AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
77 ac_cv_lib_dnet_dnet_ntoa=no \
78 ac_cv_lib_dnet_stub_dnet_ntoa=no \
86 --disable-profile-guided-optimization \
88 $(use_enable static-libs static) \
89 $(use_enable test tests)
94 CFLAGS="${BUILD_CFLAGS}" \
95 CXXFLAGS="${BUILD_CXXFLAGS}" \
99 RANLIB="${BUILD_RANLIB}" \
103 cd "${BUILDDIR}" || die
104 if tc-is-cross-compiler; then
105 tc-export_build_env BUILD_{AR,CC,CXX,RANLIB}
106 cross_make jscpucfg host_jsoplengen host_jskwgen
107 cross_make -C config nsinstall
108 mv {,native-}jscpucfg || die
109 mv {,native-}host_jskwgen || die
110 mv {,native-}host_jsoplengen || die
111 mv config/{,native-}nsinstall || die
113 -e 's@./jscpucfg@./native-jscpucfg@' \
114 -e 's@./host_jskwgen@./native-host_jskwgen@' \
115 -e 's@./host_jsoplengen@./native-host_jsoplengen@' \
117 sed -i -e 's@/nsinstall@/native-nsinstall@' config/config.mk || die
118 rm -f config/host_nsinstall.o \
119 config/host_pathsub.o \
121 host_jsoplengen.o || die
127 cd "${BUILDDIR}/jsapi-tests" || die
129 pax-mark mr jsapi-tests
134 cd "${BUILDDIR}" || die
135 emake DESTDIR="${D}" install
136 # bug 437520 , exclude js shell for small systems
137 if ! use minimal ; then
139 pax-mark m "${ED}/usr/bin/js"
143 if ! use static-libs; then
144 # We can't actually disable building of static libraries
145 # They're used by the tests and in a few other places
146 find "${D}" -iname '*.a' -delete || die