Merge pull request #778 from marineam/polkit

Mozilla's js engine, needed for polkit
This commit is contained in:
Michael Marineau 2014-07-30 17:13:23 -07:00
commit 44256af916
6 changed files with 246 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST mozjs17.0.0.tar.gz 6778934 SHA256 321e964fe9386785d3bf80870640f2fa1c683e32fe988eeb201b04471c172fba SHA512 39b68aeb9f712f146778d8b68ee795709a1372c8ab893a222af4eb34882427d6f5cf877e743d6cb2f1b4348c194d8f3774f00cb775b03515b34b49560b748be4 WHIRLPOOL 4df7b51577787194065162b09d2c3dda849c13fa901305f9925d4ca5d38bb7f8e2daa943099e003fb9d11f9264ae2d77ccf04e5eea11e3ddcb624b504b99d52f

View File

@ -0,0 +1,67 @@
--- a/js/src/gc/Memory.cpp 2013-02-11 17:33:22.000000000 -0500
+++ b/js/src/gc/Memory.cpp 2014-01-08 12:36:29.406851422 -0500
@@ -302,10 +302,46 @@
void
InitMemorySubsystem()
{
+#if !defined(__ia64__)
if (size_t(sysconf(_SC_PAGESIZE)) != PageSize)
MOZ_CRASH();
+#endif
}
+static inline void *
+MapMemory(size_t length, int prot, int flags, int fd, off_t offset)
+{
+#if defined(__ia64__)
+ /*
+ * The JS engine assumes that all allocated pointers have their high 17 bits clear,
+ * which ia64's mmap doesn't support directly. However, we can emulate it by passing
+ * mmap an "addr" parameter with those bits clear. The mmap will return that address,
+ * or the nearest available memory above that address, providing a near-guarantee
+ * that those bits are clear. If they are not, we return NULL below to indicate
+ * out-of-memory.
+ *
+ * The addr is chosen as 0x0000070000000000, which still allows about 120TB of virtual
+ * address space.
+ *
+ * See Bug 589735 for more information.
+ */
+ void *region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset);
+ if (region == MAP_FAILED)
+ return MAP_FAILED;
+ /*
+ * If the allocated memory doesn't have its upper 17 bits clear, consider it
+ * as out of memory.
+ */
+ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) {
+ JS_ALWAYS_TRUE(0 == munmap(region, length));
+ return MAP_FAILED;
+ }
+ return region;
+#else
+ return mmap(NULL, length, prot, flags, fd, offset);
+#endif
+}
+
void *
MapAlignedPages(size_t size, size_t alignment)
{
@@ -319,12 +353,15 @@
/* Special case: If we want page alignment, no further work is needed. */
if (alignment == PageSize) {
- return mmap(NULL, size, prot, flags, -1, 0);
+ void *region = MapMemory(size, prot, flags, -1, 0);
+ if (region == MAP_FAILED)
+ return NULL;
+ return region;
}
/* Overallocate and unmap the region's edges. */
size_t reqSize = Min(size + 2 * alignment, 2 * size);
- void *region = mmap(NULL, reqSize, prot, flags, -1, 0);
+ void *region = MapMemory(reqSize, prot, flags, -1, 0);
if (region == MAP_FAILED)
return NULL;

View File

@ -0,0 +1,22 @@
--- a/js/src/js-config.in 2013-03-25 16:34:20.000000000 -0400
+++ b/js/src/js-config.in 2013-08-09 22:15:29.000901763 -0400
@@ -2,7 +2,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#filter substitution
+%filter substitution
prefix='@prefix@'
mozilla_version='@MOZILLA_VERSION@'
--- a/js/src/Makefile.in 2013-03-25 16:34:20.000000000 -0400
+++ b/js/src/Makefile.in 2013-08-09 22:17:20.211903793 -0400
@@ -778,7 +778,7 @@
$(JS_CONFIG_NAME): js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk
$(RM) $@.tmp
- $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(JS_CONFIG_SUBSTITUTIONS) $< > $@.tmp \
+ $(PYTHON) $(topsrcdir)/config/Preprocessor.py --marker="%" $(JS_CONFIG_SUBSTITUTIONS) $< > $@.tmp \
&& mv $@.tmp $@ && chmod +x $@
SCRIPTS = $(JS_CONFIG_NAME)

View File

@ -0,0 +1,37 @@
diff -urN a/js/src/Makefile.in b/js/src/Makefile.in
--- a/js/src/Makefile.in 2013-03-25 15:34:20.000000000 -0500
+++ b/js/src/Makefile.in 2014-03-08 08:26:36.726979744 -0600
@@ -788,7 +788,7 @@
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(JS_CONFIG_SUBSTITUTIONS) $< > $@
install:: $(LIBRARY_NAME).pc
- $(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
+ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(libdir)/pkgconfig
######################################################
# BEGIN SpiderMonkey header installation
@@ -836,19 +836,19 @@
#
install:: $(INSTALLED_HEADERS)
- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)
+ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(MODULE)
install:: $(EXPORTS_ds)
- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)/ds
+ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(MODULE)/ds
install:: $(EXPORTS_gc)
- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)/gc
+ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(MODULE)/gc
install:: $(EXPORTS_js)
- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)/js
+ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(MODULE)/js
install:: $(EXPORTS_mozilla)
- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)/mozilla
+ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(MODULE)/mozilla
#
# END SpiderMonkey header installation

View File

@ -0,0 +1,117 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/spidermonkey/spidermonkey-17.0.0-r3.ebuild,v 1.7 2014/04/19 17:43:30 ago Exp $
EAPI="5"
WANT_AUTOCONF="2.1"
PYTHON_COMPAT=( python2_{6,7} )
PYTHON_REQ_USE="threads"
inherit eutils toolchain-funcs multilib python-any-r1 versionator pax-utils
MY_PN="mozjs"
MY_P="${MY_PN}${PV}"
DESCRIPTION="Stand-alone JavaScript C library"
HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
SRC_URI="http://ftp.mozilla.org/pub/mozilla.org/js/${MY_PN}${PV}.tar.gz"
LICENSE="NPL-1.1"
SLOT="17"
# "MIPS, MacroAssembler is not supported" wrt #491294 for -mips
KEYWORDS="alpha amd64 arm -hppa ia64 -mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
IUSE="debug jit minimal static-libs test"
REQUIRED_USE="debug? ( jit )"
RESTRICT="ia64? ( test )"
S="${WORKDIR}/${MY_P}"
BUILDDIR="${S}/js/src"
RDEPEND=">=dev-libs/nspr-4.9.4
virtual/libffi
>=sys-libs/zlib-1.1.4"
DEPEND="${RDEPEND}
${PYTHON_DEPS}
app-arch/zip
virtual/pkgconfig"
pkg_setup(){
if [[ ${MERGE_TYPE} != "binary" ]]; then
python-any-r1_pkg_setup
export LC_ALL="C"
fi
}
src_prepare() {
epatch "${FILESDIR}"/${PN}-${SLOT}-js-config-shebang.patch
epatch "${FILESDIR}"/${PN}-${SLOT}-ia64-mmap.patch
epatch "${FILESDIR}"/${PN}-17.0.0-fix-file-permissions.patch
# Remove obsolete jsuword bug #506160
sed -i -e '/jsuword/d' "${BUILDDIR}"/jsval.h ||die "sed failed"
epatch_user
if [[ ${CHOST} == *-freebsd* ]]; then
# Don't try to be smart, this does not work in cross-compile anyway
ln -sfn "${BUILDDIR}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk" || die
fi
}
src_configure() {
cd "${BUILDDIR}" || die
# 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 \
--enable-system-ffi \
--with-nspr-cflags="${nspr_cflags}" \
--with-nspr-libs="${nspr_libs}" \
$(use_enable debug) \
$(use_enable jit tracejit) \
$(use_enable jit methodjit) \
$(use_enable static-libs static) \
$(use_enable test tests)
}
src_compile() {
cd "${BUILDDIR}" || die
emake
}
src_test() {
cd "${BUILDDIR}/jsapi-tests" || die
emake check
}
src_install() {
cd "${BUILDDIR}" || die
emake DESTDIR="${D}" install
if ! use minimal; then
if use jit; then
pax-mark m "${ED}/usr/bin/js${SLOT}"
fi
else
rm -f "${ED}/usr/bin/js${SLOT}"
fi
if ! use static-libs; then
# We can't actually disable building of static libraries
# They're used by the tests and in a few other places
find "${D}" -iname '*.a' -delete || die
fi
}

View File

@ -81,3 +81,5 @@ sys-apps/systemd -ssl
# disable kernel config detection and module building # disable kernel config detection and module building
net-firewall/ipset -modules net-firewall/ipset -modules
dev-lang/spidermonkey minimal