summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-lang/spidermonkey
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-lang/spidermonkey')
-rw-r--r--dev-lang/spidermonkey/Manifest5
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.5-build.patch138
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.6-header.patch13
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.7.0-ldflags.patch42
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.7.0-threadsafe.diff18
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-2.patch102
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-3.patch99
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-install-symlinks.patch15
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-ppc64.patch61
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-fix.patch53
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-static-strings.patch381
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-isfinite.patch11
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-perf_event-check.patch21
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.5-symbol-versions.patch32
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.7-filter_desc.patch18
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.7-freebsd-pthreads.patch11
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.7-symbol-versions.patch32
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.8.7-x32.patch25
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-1.9.2.13-as-needed.patch22
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-17-ia64-mmap.patch67
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-17-js-config-shebang.patch22
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-17.0.0-fix-file-permissions.patch37
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-24-system-icu.patch199
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-24-upward-growing-stack.patch41
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-24.2.0-fix-file-permissions.patch29
-rw-r--r--dev-lang/spidermonkey/files/spidermonkey-perl-defined-array-check.patch11
-rw-r--r--dev-lang/spidermonkey/metadata.xml14
-rw-r--r--dev-lang/spidermonkey/spidermonkey-1.7.0-r1.ebuild51
-rw-r--r--dev-lang/spidermonkey/spidermonkey-1.7.0-r2.ebuild52
-rw-r--r--dev-lang/spidermonkey/spidermonkey-1.7.0-r3.ebuild52
-rw-r--r--dev-lang/spidermonkey/spidermonkey-1.7.0.ebuild50
-rw-r--r--dev-lang/spidermonkey/spidermonkey-1.8.2.15-r2.ebuild77
-rw-r--r--dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild136
-rw-r--r--dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild132
-rw-r--r--dev-lang/spidermonkey/spidermonkey-24.2.0-r3.ebuild147
35 files changed, 2216 insertions, 0 deletions
diff --git a/dev-lang/spidermonkey/Manifest b/dev-lang/spidermonkey/Manifest
new file mode 100644
index 000000000000..bd16fe6e9ab4
--- /dev/null
+++ b/dev-lang/spidermonkey/Manifest
@@ -0,0 +1,5 @@
+DIST firefox-3.6.15.source.tar.bz2 51552828 SHA256 405aa411a8ddb456017564522cbb486850e34fe14485b1c31fa93fc5c750870f SHA512 82bf0a6c6cb30fc0b18b067ac3d9cb7e48a0fd0126edd851e628d49e429aea33500a5a5eba87bce922e51b1b7410ccccfe4f8b7ce5573bdbd718c76da7acb1da WHIRLPOOL b788d7ba2cfcaec4f317e615878401a7a1fb985aaa43829831c17b699812e59adb7874247114e0143da63198118cab059796fc5d5fd08d72ccc54b4fef279f85
+DIST js-1.7.0.tar.gz 1165607 SHA256 44363f0f3895800ee6010763eae90c0d15ed28e07d783bc7b3c607ce98d8668b SHA512 9d9fbd9c1dae969ca19ddb0f977ac56f3e0479ec393b859de252fcdd8b7fc325e80399073540884ed365ce56a3219be34c0db9300d5e50f32969660c90527e51 WHIRLPOOL 8044b306b3a1f0abed5ac8a6bf4f9ed70e1ebc6f83f44934a6306d9ed68cd73124f82e40430d764f158377031f5ee986595e58fdb52259ab6a3a8674eaf4eed1
+DIST js185-1.0.0.tar.gz 6164605 SHA256 5d12f7e1f5b4a99436685d97b9b7b75f094d33580227aa998c406bbae6f2a687 SHA512 2af7122a7c7007fd7b6668776fe1222515a810b3e43bbf0f76b8f94e1ef406ffd3fb5ccec393021b00274c05b38a77235bc8d6886994c56762fcaf0aa7cf6718 WHIRLPOOL 58b372713275874d3ae3c6b58c12c56bf8d17d024d591e321538bcdd8e615332e41655954368ce86b90e970209e3fd650c39d931000880f5ec22cb044b5d7a4e
+DIST mozjs-24.2.0.tar.bz2 15624530 SHA256 e62f3f331ddd90df1e238c09d61a505c516fe9fd8c5c95336611d191d18437d8 SHA512 49805e256f6fa797505c01b7596d5bb941ed7a2454862c52ed42ad48b5ae4540b777e77ed8da1b98c89f8622ed2c76052187983687008a4ff53594addb328df4 WHIRLPOOL ea74d19c79b1a0fe407e2803900c49c23e8b76444fb4e20995072c3c59427e8df1895df04f2f4de779a1c58cd1166dd97aeaf7564350832011efe89dbcf9583e
+DIST mozjs17.0.0.tar.gz 6778934 SHA256 321e964fe9386785d3bf80870640f2fa1c683e32fe988eeb201b04471c172fba SHA512 39b68aeb9f712f146778d8b68ee795709a1372c8ab893a222af4eb34882427d6f5cf877e743d6cb2f1b4348c194d8f3774f00cb775b03515b34b49560b748be4 WHIRLPOOL 4df7b51577787194065162b09d2c3dda849c13fa901305f9925d4ca5d38bb7f8e2daa943099e003fb9d11f9264ae2d77ccf04e5eea11e3ddcb624b504b99d52f
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.5-build.patch b/dev-lang/spidermonkey/files/spidermonkey-1.5-build.patch
new file mode 100644
index 000000000000..a5c4b47db529
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.5-build.patch
@@ -0,0 +1,138 @@
+--- js/src/Makefile.ref
++++ js/src/Makefile.ref
+@@ -127,7 +127,7 @@ endif
+ ifdef JS_READLINE
+ # For those platforms with the readline library installed.
+ DEFINES += -DEDITLINE
+-PROG_LIBS += -lreadline -ltermcap
++PROG_LIBS += -lreadline
+ else
+ ifdef JS_EDITLINE
+ # Use the editline library, built locally.
+@@ -370,3 +370,16 @@ TARFILES = files `cat files`
+ SUFFIXES: .i
+ %.i: %.c
+ $(CC) -C -E $(CFLAGS) $< > $*.i
++
++DESTDIR :=
++PREFIX := /usr
++BINDIR := $(PREFIX)/bin
++MY_LIBDIR := $(PREFIX)/$(LIBDIR)
++INCLUDEDIR := $(PREFIX)/include/js
++INSTALL := install -g 0 -o root
++install:
++ $(INSTALL) -m 755 -d $(DESTDIR)$(INCLUDEDIR) $(DESTDIR)$(MY_LIBDIR) $(DESTDIR)$(BINDIR)
++ $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DESTDIR)$(MY_LIBDIR)
++ $(INSTALL) -m 644 $(LIBRARY) $(DESTDIR)$(MY_LIBDIR)
++ $(INSTALL) -m 755 $(OBJDIR)/js $(OBJDIR)/jscpucfg $(DESTDIR)$(BINDIR)
++ $(INSTALL) -m 644 $(HFILES) $(DESTDIR)$(INCLUDEDIR)
+--- js/src/config/Linux_All.mk
++++ js/src/config/Linux_All.mk
+@@ -41,37 +41,15 @@
+ # Config for all versions of Linux
+ #
+
+-CC = gcc
+-CCC = g++
+ CFLAGS += -Wall -Wno-format
+ OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R
+
+ RANLIB = echo
+-MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS)
++MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS) -soname $(notdir $@)
+
+ #.c.o:
+ # $(CC) -c -MD $*.d $(CFLAGS) $<
+
+-CPU_ARCH = $(shell uname -m)
+-# don't filter in x86-64 architecture
+-ifneq (x86_64,$(CPU_ARCH))
+-ifeq (86,$(findstring 86,$(CPU_ARCH)))
+-CPU_ARCH = x86
+-OS_CFLAGS+= -DX86_LINUX
+-
+-ifeq (gcc, $(CC))
+-# if using gcc on x86, check version for opt bug
+-# (http://bugzilla.mozilla.org/show_bug.cgi?id=24892)
+-GCC_VERSION := $(shell gcc -v 2>&1 | grep version | awk '{ print $$3 }')
+-GCC_LIST:=$(sort 2.91.66 $(GCC_VERSION) )
+-
+-ifeq (2.91.66, $(firstword $(GCC_LIST)))
+-CFLAGS+= -DGCC_OPT_BUG
+-endif
+-endif
+-endif
+-endif
+-
+ GFX_ARCH = x
+
+ OS_LIBS = -lm -lc
+@@ -88,16 +66,6 @@
+ endif
+
+ # Use the editline library to provide line-editing support.
+-JS_EDITLINE = 1
++JS_READLINE = 1
+
+-ifeq ($(CPU_ARCH),x86_64)
+-# Use VA_COPY() standard macro on x86-64
+-# FIXME: better use it everywhere
+ OS_CFLAGS += -DHAVE_VA_COPY -DVA_COPY=va_copy
+-endif
+-
+-ifeq ($(CPU_ARCH),x86_64)
+-# We need PIC code for shared libraries
+-# FIXME: better patch rules.mk & fdlibm/Makefile*
+-OS_CFLAGS += -DPIC -fPIC
+-endif
+--- js/src/rules.mk
++++ js/src/rules.mk
+@@ -82,6 +82,10 @@ $(OBJDIR)/%.o: %.c
+ @$(MAKE_OBJDIR)
+ $(CC) -o $@ -c $(CFLAGS) $*.c
+
++$(OBJDIR)/%.lo: %.c
++ @$(MAKE_OBJDIR)
++ $(CC) -o $@ -c $(CFLAGS) $*.c -fPIC
++
+ $(OBJDIR)/%.o: %.s
+ @$(MAKE_OBJDIR)
+ $(AS) -o $@ $(ASFLAGS) $*.s
+@@ -111,11 +115,12 @@ $(SHARED_LIBRARY): $(LIB_OBJS)
+ /implib:"$(OBJDIR)/$(@F:.dll=.lib)" $^
+ else
+ $(LIBRARY): $(LIB_OBJS)
+- $(AR) rv $@ $?
++ $(AR) cr $@ $?
+ $(RANLIB) $@
+
+-$(SHARED_LIBRARY): $(LIB_OBJS)
+- $(MKSHLIB) -o $@ $(LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS)
++SHARED_LIB_OBJS := $(LIB_OBJS:.o=.lo)
++$(SHARED_LIBRARY): $(SHARED_LIB_OBJS)
++ $(MKSHLIB) -o $@ $(SHARED_LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS)
+ endif
+ endif
+
+--- js/src/fdlibm/Makefile.ref
++++ js/src/fdlibm/Makefile.ref
+@@ -151,7 +151,7 @@
+
+ $(OBJDIR)/%.o: %.c
+ @$(MAKE_OBJDIR)
+- $(CC) -o $@ -c $(CFLAGS) $*.c
++ $(CC) -o $@ -c $(CFLAGS) $*.c -fPIC
+
+ $(OBJDIR)/%.o: %.s
+ @$(MAKE_OBJDIR)
+--- js/src/config.mk
++++ js/src/config.mk
+@@ -112,6 +112,8 @@
+ CP = cp
+ endif
+
++BUILD_OPT := 1
++
+ ifdef BUILD_OPT
+ OPTIMIZER = -O
+ DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.6-header.patch b/dev-lang/spidermonkey/files/spidermonkey-1.6-header.patch
new file mode 100644
index 000000000000..df4cf7d50744
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.6-header.patch
@@ -0,0 +1,13 @@
+Index: src/Makefile.ref
+===================================================================
+--- src.orig/Makefile.ref
++++ src/Makefile.ref
+@@ -185,6 +185,8 @@ JS_HFILES = \
+ jsstr.h \
+ jsxdrapi.h \
+ jsxml.h \
++ jsutil.h \
++ jsprf.h \
+ $(NULL)
+
+ API_HFILES = \
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.7.0-ldflags.patch b/dev-lang/spidermonkey/files/spidermonkey-1.7.0-ldflags.patch
new file mode 100644
index 000000000000..4ddc3461ea11
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.7.0-ldflags.patch
@@ -0,0 +1,42 @@
+Respect LDFLAGS
+
+http://bugs.gentoo.org/show_bug.cgi?id=331129
+
+--- js/src/Makefile.ref
++++ js/src/Makefile.ref
+@@ -87,7 +87,7 @@
+ LDFLAGS = $(XLDFLAGS)
+
+ ifndef NO_LIBM
+-LDFLAGS += -lm
++OTHER_LIBS += -lm
+ endif
+
+ # Prevent floating point errors caused by VC++ optimizations
+@@ -325,7 +325,7 @@
+ $(CC) -o $@ -c $(CFLAGS) $<
+
+ $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX): $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
+- $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^
++ $(CC) $(HOST_LDFLAGS) -o $@ $(CFLAGS) $(OTHER_LIBS) $^
+
+ endif
+
+@@ -338,7 +338,7 @@
+ link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
+ else
+ $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
+- $(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
++ $(CC) $(HOST_LDFLAGS) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(OTHER_LIBS) \
+ $(PROG_LIBS)
+ endif
+
+@@ -355,7 +355,7 @@
+ $(OBJDIR)/jscpucfg > $@
+
+ $(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
+- $(CC) -o $@ $(OBJDIR)/jscpucfg.o
++ $(CC) $(HOST_LDFLAGS) -o $@ $(OBJDIR)/jscpucfg.o
+
+ # Add to TARGETS for clobber rule
+ TARGETS += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.7.0-threadsafe.diff b/dev-lang/spidermonkey/files/spidermonkey-1.7.0-threadsafe.diff
new file mode 100644
index 000000000000..8728811fbfc4
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.7.0-threadsafe.diff
@@ -0,0 +1,18 @@
+Index: src/Makefile.ref
+===================================================================
+--- src.orig/Makefile.ref
++++ src/Makefile.ref
+@@ -63,11 +63,11 @@ INCLUDES += -I$(OBJDIR)
+
+ ifdef JS_THREADSAFE
+ DEFINES += -DJS_THREADSAFE
+-INCLUDES += -I$(DIST)/include/nspr
++INCLUDES += -I/usr/include/nspr
+ ifdef USE_MSVC
+ OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib
+ else
+-OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX)
++OTHER_LIBS += -L/usr/$(LIBDIR)/nspr -lnspr$(NSPR_LIBSUFFIX)
+ endif
+ endif
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-2.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-2.patch
new file mode 100644
index 000000000000..106ec144f893
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-2.patch
@@ -0,0 +1,102 @@
+--- a/js-1.8.5/js/src/configure.in 2011-03-31 15:08:36.000000000 -0400
++++ b/js-1.8.5/js/src/configure.in 2012-11-02 15:32:38.000000000 -0400
+@@ -3550,7 +3550,7 @@
+ _SAVE_CFLAGS="$CFLAGS"
+ if test "$GNU_CC"; then
+ # gcc needs -mfpu=neon to recognize NEON instructions
+- CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
++ CFLAGS="$CFLAGS -mfpu=neon"
+ fi
+ AC_TRY_COMPILE([],
+ [asm("vadd.i8 d0, d0, d0");],
+@@ -4654,12 +4654,6 @@
+ dnl ========================================================
+ MOZ_ARG_HEADER(Individual module options)
+
+-dnl Setup default CPU arch for arm target
+-case "$target_cpu" in
+- arm*)
+- MOZ_ARM_ARCH=armv7
+- ;;
+-esac
+ dnl ========================================================
+ dnl = Enable building the Thumb2 instruction set
+ dnl ========================================================
+@@ -4668,66 +4662,35 @@
+ MOZ_THUMB2=1,
+ MOZ_THUMB2=)
+ if test -n "$MOZ_THUMB2"; then
+- MOZ_ARM_ARCH=armv7
++ AC_MSG_WARN([thumb2 enabled instead of autodetected -- hope you know what you are doing])
++else
++ AC_MSG_CHECKING([for thumb2 support in arm architecture])
++ AC_LANG_SAVE
++ AC_LANG_C
++ AC_TRY_LINK([int ac_test(int i) { return i; }],[asm(".syntax unified\n.thumb\nb.w ac_test\n.arm"); if (ac_test(1)) return 1;],
++ [MOZ_THUMB2=1
++ AC_MSG_RESULT([yes])],
++ [MOZ_THUMB2=
++ AC_MSG_RESULT([no])])
++ AC_LANG_RESTORE
+ fi
+
+ dnl ========================================================
+ dnl = Enable building for ARM specific CPU features
+ dnl ========================================================
+-MOZ_ARG_WITH_STRING(cpu-arch,
+-[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7],
+- MOZ_ARM_ARCH=$withval)
+-
+ if test -n "$MOZ_THUMB2"; then
+ case "$target_cpu" in
+ arm*)
+- if test "$MOZ_ARM_ARCH" != "armv7"; then
+- AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
+- fi
+ if test "$GNU_CC"; then
+ AC_DEFINE(MOZ_THUMB2)
+- AC_DEFINE(MOZ_ARM_ARCH)
+- CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+ else
+ AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
+ fi
+ ;;
+- *)
+- AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
+- ;;
+- esac
+-elif test "$MOZ_ARM_ARCH" = "armv7"; then
+- case "$target_cpu" in
+- arm*)
+- if test "$GNU_CC"; then
+- AC_DEFINE(MOZ_ARM_ARCH)
+- CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- else
+- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
+- fi
+- ;;
+- *)
+- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
+- ;;
+- esac
+-else
+- case "$target_cpu" in
+- arm*)
+- if test "$GNU_CC"; then
+- CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
+- CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
+- ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
+- fi
+- ;;
+ esac
+ fi
+
+ AC_SUBST(MOZ_THUMB2)
+-AC_SUBST(MOZ_ARM_ARCH)
+
+ dnl ========================================================
+ dnl =
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-3.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-3.patch
new file mode 100644
index 000000000000..ed497ceebb0b
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-arm_respect_cflags-3.patch
@@ -0,0 +1,99 @@
+--- a/js-1.8.5/js/src/configure.in 2011-03-31 15:08:36.000000000 -0400
++++ b/js-1.8.5/js/src/configure.in 2012-11-02 15:32:38.000000000 -0400
+@@ -3550,7 +3550,7 @@
+ _SAVE_CFLAGS="$CFLAGS"
+ if test "$GNU_CC"; then
+ # gcc needs -mfpu=neon to recognize NEON instructions
+- CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
++ CFLAGS="$CFLAGS -mfpu=neon"
+ fi
+ AC_TRY_COMPILE([],
+ [asm("vadd.i8 d0, d0, d0");],
+@@ -4654,12 +4654,6 @@
+ dnl ========================================================
+ MOZ_ARG_HEADER(Individual module options)
+
+-dnl Setup default CPU arch for arm target
+-case "$target_cpu" in
+- arm*)
+- MOZ_ARM_ARCH=armv7
+- ;;
+-esac
+ dnl ========================================================
+ dnl = Enable building the Thumb2 instruction set
+ dnl ========================================================
+@@ -4668,66 +4662,32 @@
+ MOZ_THUMB2=1,
+ MOZ_THUMB2=)
+ if test -n "$MOZ_THUMB2"; then
+- MOZ_ARM_ARCH=armv7
++ AC_MSG_WARN([thumb2 enabled instead of autodetected -- hope you know what you are doing])
++else
++ AC_MSG_CHECKING([whether to build for thumb2])
++ AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
++ [MOZ_THUMB2=1
++ AC_MSG_RESULT([yes])],
++ [MOZ_THUMB2=
++ AC_MSG_RESULT([no])])
+ fi
+
+ dnl ========================================================
+ dnl = Enable building for ARM specific CPU features
+ dnl ========================================================
+-MOZ_ARG_WITH_STRING(cpu-arch,
+-[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7],
+- MOZ_ARM_ARCH=$withval)
+-
+ if test -n "$MOZ_THUMB2"; then
+ case "$target_cpu" in
+ arm*)
+- if test "$MOZ_ARM_ARCH" != "armv7"; then
+- AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
+- fi
+ if test "$GNU_CC"; then
+ AC_DEFINE(MOZ_THUMB2)
+- AC_DEFINE(MOZ_ARM_ARCH)
+- CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+ else
+ AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
+ fi
+ ;;
+- *)
+- AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
+- ;;
+- esac
+-elif test "$MOZ_ARM_ARCH" = "armv7"; then
+- case "$target_cpu" in
+- arm*)
+- if test "$GNU_CC"; then
+- AC_DEFINE(MOZ_ARM_ARCH)
+- CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
+- else
+- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
+- fi
+- ;;
+- *)
+- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
+- ;;
+- esac
+-else
+- case "$target_cpu" in
+- arm*)
+- if test "$GNU_CC"; then
+- CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
+- CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
+- ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
+- fi
+- ;;
+ esac
+ fi
+
+ AC_SUBST(MOZ_THUMB2)
+-AC_SUBST(MOZ_ARM_ARCH)
+
+ dnl ========================================================
+ dnl =
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-install-symlinks.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-install-symlinks.patch
new file mode 100644
index 000000000000..c867e45ee4f3
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-install-symlinks.patch
@@ -0,0 +1,15 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=628723#c43
+
+--- js/src/Makefile.in
++++ js/src/Makefile.in
+@@ -888,8 +888,8 @@
+ ifeq (,$(HOST_BIN_SUFFIX))
+ mv -f $(SHLIB_ANY_VER) $(SHLIB_EXACT_VER)
+ @[ ! -h $(SHLIB_ABI_VER) ] || rm -f $(SHLIB_ABI_VER)
+- ln -s $(SHLIB_EXACT_VER) $(SHLIB_ABI_VER)
+- ln -s $(SHLIB_ABI_VER) $(SHLIB_ANY_VER)
++ ln -s $(notdir $(SHLIB_EXACT_VER)) $(SHLIB_ABI_VER)
++ ln -s $(notdir $(SHLIB_ABI_VER)) $(SHLIB_ANY_VER)
+ endif
+ endif
+ ifneq (,$(IMPORT_LIBRARY))
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-ppc64.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-ppc64.patch
new file mode 100644
index 000000000000..3927c8717930
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-fix-ppc64.patch
@@ -0,0 +1,61 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1303461188 -7200
+# Node ID 59771590e9203d48ef8cbcd7eaf2f8ae45dbb1c1
+# Parent c4b82ec27d6d6e1c02ef0abb3b6e805bfdd092ec
+Bug 638056 - Avoid "The cacheFlush support is missing on this platform" error on exotic platforms. r=cdleary
+
+diff --git a/js/src/Makefile.in b/js/src/Makefile.in
+--- a/js/src/Makefile.in
++++ b/js/src/Makefile.in
+@@ -383,17 +383,17 @@ CPPSRCS += checks.cc \
+ platform.cc \
+ utils.cc \
+ $(NONE)
+
+ #
+ # END enclude sources for V8 dtoa
+ #############################################
+
+-ifeq (,$(filter-out powerpc sparc,$(TARGET_CPU)))
++ifeq (,$(filter arm% %86 x86_64,$(TARGET_CPU)))
+
+ VPATH += $(srcdir)/assembler \
+ $(srcdir)/assembler/wtf \
+ $(srcdir)/yarr/pcre \
+ $(NULL)
+
+ CPPSRCS += pcre_compile.cpp \
+ pcre_exec.cpp \
+
+# HG changeset patch
+# User Luke Wagner <lw@mozilla.com>
+# Date 1299520258 28800
+# Node ID 68203913d04cf5be53fd16278816183d5670ba5c
+# Parent 27e5814815491ebb68e474e453aff6c2ea908c43
+Bug 618485 - Add missing 64-bit big-endian jsval_layout field (r=luke)
+
+diff --git a/js/src/jsval.h b/js/src/jsval.h
+--- a/js/src/jsval.h
++++ b/js/src/jsval.h
+@@ -342,16 +342,17 @@ typedef union jsval_layout
+ JSValueTag tag : 17;
+ uint64 payload47 : 47;
+ } debugView;
+ struct {
+ union {
+ int32 i32;
+ uint32 u32;
+ JSWhyMagic why;
++ jsuword word;
+ } payload;
+ } s;
+ double asDouble;
+ void *asPtr;
+ } jsval_layout;
+ # endif /* JS_BITS_PER_WORD */
+ #endif /* defined(IS_LITTLE_ENDIAN) */
+
+
+
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-fix.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-fix.patch
new file mode 100644
index 000000000000..bebe5587180f
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-fix.patch
@@ -0,0 +1,53 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=589735
+
+--- a/js/src/jsgcchunk.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsgcchunk.cpp 2012-11-02 10:36:08.324453878 +0100
+@@ -318,15 +318,48 @@
+ static void *
+ MapPages(void *addr, size_t size)
+ {
++#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.
++ */
++#endif
++
+ /*
+ * We don't use MAP_FIXED here, because it can cause the *replacement*
+ * of existing mappings, and we only want to create new mappings.
+ */
++#if defined(__ia64__)
++ void *p = mmap(addr ? addr : (void*)0x0000070000000000,
++ size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
++ -1, 0);
++#else
+ void *p = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
+ -1, 0);
++#endif
+ if (p == MAP_FAILED)
+ return NULL;
++#if defined(__ia64__)
++ /*
++ * If the caller requested a specific memory location, verify that's what mmap returned.
++ * Otherwise: If the allocated memory doesn't have its upper 17 bits clear, consider it
++ * as out of memory.
++ */
++ if (addr && p != addr
++ || !addr && ((long long)p & 0xffff800000000000)) {
++#else
++ /* If the caller requested a specific memory location, verify that's what mmap returned. */
+ if (addr && p != addr) {
++#endif
+ /* We succeeded in mapping memory, but not in the right place. */
+ JS_ALWAYS_TRUE(munmap(p, size) == 0);
+ return NULL;
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-static-strings.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-static-strings.patch
new file mode 100644
index 000000000000..5cfed32ae68e
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-ia64-static-strings.patch
@@ -0,0 +1,381 @@
+https://bugzilla.mozilla.org/show_bug.cgi?id=589735
+
+--- a/js/src/jsatom.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsatom.cpp 2012-11-02 10:43:16.970562590 +0100
+@@ -603,11 +603,13 @@
+ JSString str, *str2;
+ JSAtomState *state;
+
++#ifdef JS_HAS_STATIC_STRINGS
+ if (length == 1) {
+ jschar c = *chars;
+ if (c < UNIT_STRING_LIMIT)
+ return STRING_TO_ATOM(JSString::unitString(c));
+ }
++#endif
+
+ str.initFlatNotTerminated((jschar *)chars, length);
+ state = &cx->runtime->atomState;
+--- a/js/src/jsiter.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsiter.cpp 2012-11-02 10:43:16.974562590 +0100
+@@ -1002,9 +1002,12 @@
+
+ JSString *str;
+ jsint i;
++#ifdef JS_HAS_STATIC_STRINGS
+ if (rval->isInt32() && (jsuint(i = rval->toInt32()) < INT_STRING_LIMIT)) {
+ str = JSString::intString(i);
+- } else {
++ } else
++#endif
++ {
+ str = js_ValueToString(cx, *rval);
+ if (!str)
+ return false;
+--- a/js/src/jsnum.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsnum.cpp 2012-11-02 10:43:16.982562589 +0100
+@@ -605,8 +605,10 @@
+ {
+ uint32 ui;
+ if (si >= 0) {
++#ifdef JS_HAS_STATIC_STRINGS
+ if (si < INT_STRING_LIMIT)
+ return JSString::intString(si);
++#endif
+ ui = si;
+ } else {
+ ui = uint32(-si);
+@@ -1169,6 +1171,7 @@
+
+ int32_t i;
+ if (JSDOUBLE_IS_INT32(d, &i)) {
++#ifdef JS_HAS_STATIC_STRINGS
+ if (base == 10 && jsuint(i) < INT_STRING_LIMIT)
+ return JSString::intString(i);
+ if (jsuint(i) < jsuint(base)) {
+@@ -1176,6 +1179,7 @@
+ return JSString::intString(i);
+ return JSString::unitString(jschar('a' + i - 10));
+ }
++#endif
+
+ if (JSString *str = c->dtoaCache.lookup(base, d))
+ return str;
+--- a/js/src/jsstr.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsstr.cpp 2012-11-02 10:43:16.990562588 +0100
+@@ -3121,6 +3121,8 @@
+ JS_FS_END
+ };
+
++#ifdef JS_HAS_STATIC_STRINGS
++
+ /*
+ * Set up some tools to make it easier to generate large tables. After constant
+ * folding, for each n, Rn(0) is the comma-separated list R(0), R(1), ..., R(2^n-1).
+@@ -3291,6 +3293,8 @@
+ #undef R3
+ #undef R7
+
++#endif /* defined(JS_HAS_STATIC_STRINGS) */
++
+ JSBool
+ js_String(JSContext *cx, uintN argc, Value *vp)
+ {
+@@ -3331,6 +3335,7 @@
+ uint16_t code;
+ if (!ValueToUint16(cx, argv[0], &code))
+ return JS_FALSE;
++#ifdef JS_HAS_STATIC_STRINGS
+ if (code < UNIT_STRING_LIMIT) {
+ str = JSString::unitString(code);
+ if (!str)
+@@ -3338,6 +3343,7 @@
+ vp->setString(str);
+ return JS_TRUE;
+ }
++#endif
+ argv[0].setInt32(code);
+ }
+ chars = (jschar *) cx->malloc((argc + 1) * sizeof(jschar));
+@@ -3367,8 +3373,10 @@
+ {
+ JS_ASSERT(JS_ON_TRACE(cx));
+ jschar c = (jschar)i;
++#ifdef JS_HAS_STATIC_STRINGS
+ if (c < UNIT_STRING_LIMIT)
+ return JSString::unitString(c);
++#endif
+ return js_NewStringCopyN(cx, &c, 1);
+ }
+ #endif
+--- a/js/src/jsstr.h 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsstr.h 2012-11-02 10:43:16.998562587 +0100
+@@ -57,6 +57,15 @@
+ #include "jsvalue.h"
+ #include "jscell.h"
+
++#if !defined(__ia64__)
++/*
++ * Don't use static strings on ia64 since the compiler may put the static
++ * memory out of the acceptable 47-bit jsval pointer range.
++ */
++# define JS_HAS_STATIC_STRINGS
++#endif
++
++#ifdef JS_HAS_STATIC_STRINGS
+ enum {
+ UNIT_STRING_LIMIT = 256U,
+ SMALL_CHAR_LIMIT = 128U, /* Bigger chars cannot be in a length-2 string. */
+@@ -64,6 +73,7 @@
+ INT_STRING_LIMIT = 256U,
+ NUM_HUNDRED_STRINGS = 156U
+ };
++#endif
+
+ extern jschar *
+ js_GetDependentStringChars(JSString *str);
+@@ -380,10 +390,15 @@
+ typedef uint8 SmallChar;
+
+ static inline bool fitsInSmallChar(jschar c) {
++#ifdef JS_HAS_STATIC_STRINGS
+ return c < SMALL_CHAR_LIMIT && toSmallChar[c] != INVALID_SMALL_CHAR;
++#else
++ return false;
++#endif
+ }
+
+ static inline bool isUnitString(void *ptr) {
++#ifdef JS_HAS_STATIC_STRINGS
+ jsuword delta = reinterpret_cast<jsuword>(ptr) -
+ reinterpret_cast<jsuword>(unitStringTable);
+ if (delta >= UNIT_STRING_LIMIT * sizeof(JSString))
+@@ -392,9 +407,13 @@
+ /* If ptr points inside the static array, it must be well-aligned. */
+ JS_ASSERT(delta % sizeof(JSString) == 0);
+ return true;
++#else
++ return false;
++#endif
+ }
+
+ static inline bool isLength2String(void *ptr) {
++#ifdef JS_HAS_STATIC_STRINGS
+ jsuword delta = reinterpret_cast<jsuword>(ptr) -
+ reinterpret_cast<jsuword>(length2StringTable);
+ if (delta >= NUM_SMALL_CHARS * NUM_SMALL_CHARS * sizeof(JSString))
+@@ -403,9 +422,13 @@
+ /* If ptr points inside the static array, it must be well-aligned. */
+ JS_ASSERT(delta % sizeof(JSString) == 0);
+ return true;
++#else
++ return false;
++#endif
+ }
+
+ static inline bool isHundredString(void *ptr) {
++#ifdef JS_HAS_STATIC_STRINGS
+ jsuword delta = reinterpret_cast<jsuword>(ptr) -
+ reinterpret_cast<jsuword>(hundredStringTable);
+ if (delta >= NUM_HUNDRED_STRINGS * sizeof(JSString))
+@@ -414,6 +437,9 @@
+ /* If ptr points inside the static array, it must be well-aligned. */
+ JS_ASSERT(delta % sizeof(JSString) == 0);
+ return true;
++#else
++ return false;
++#endif
+ }
+
+ static inline bool isStatic(void *ptr) {
+@@ -424,6 +450,7 @@
+ #pragma align 8 (__1cIJSStringPunitStringTable_, __1cIJSStringSlength2StringTable_, __1cIJSStringShundredStringTable_)
+ #endif
+
++#ifdef JS_HAS_STATIC_STRINGS
+ static const SmallChar INVALID_SMALL_CHAR = -1;
+
+ static const jschar fromSmallChar[];
+@@ -436,6 +463,7 @@
+ * strings, we keep a table to map from integer to the correct string.
+ */
+ static const JSString *const intStringTable[];
++#endif
+
+ static JSFlatString *unitString(jschar c);
+ static JSLinearString *getUnitString(JSContext *cx, JSString *str, size_t index);
+--- a/js/src/jsstrinlines.h 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jsstrinlines.h 2012-11-02 10:43:17.010562586 +0100
+@@ -215,52 +215,75 @@
+ inline JSFlatString *
+ JSString::unitString(jschar c)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+ JS_ASSERT(c < UNIT_STRING_LIMIT);
+ return const_cast<JSString *>(&unitStringTable[c])->assertIsFlat();
++#else
++ JS_NOT_REACHED("no static strings");
++ return NULL;
++#endif
+ }
+
+ inline JSLinearString *
+ JSString::getUnitString(JSContext *cx, JSString *str, size_t index)
+ {
+ JS_ASSERT(index < str->length());
++#ifdef JS_HAS_STATIC_STRINGS
+ const jschar *chars = str->getChars(cx);
+ if (!chars)
+ return NULL;
+ jschar c = chars[index];
+ if (c < UNIT_STRING_LIMIT)
+ return unitString(c);
++#endif
+ return js_NewDependentString(cx, str, index, 1);
+ }
+
+ inline JSFlatString *
+ JSString::length2String(jschar c1, jschar c2)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+ JS_ASSERT(fitsInSmallChar(c1));
+ JS_ASSERT(fitsInSmallChar(c2));
+ return const_cast<JSString *> (
+ &length2StringTable[(((size_t)toSmallChar[c1]) << 6) + toSmallChar[c2]]
+ )->assertIsFlat();
++#else
++ JS_NOT_REACHED("no static strings");
++ return NULL;
++#endif
+ }
+
+ inline JSFlatString *
+ JSString::length2String(uint32 i)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+ JS_ASSERT(i < 100);
+ return length2String('0' + i / 10, '0' + i % 10);
++#else
++ JS_NOT_REACHED("no static strings");
++ return NULL;
++#endif
+ }
+
+ inline JSFlatString *
+ JSString::intString(jsint i)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+ jsuint u = jsuint(i);
+ JS_ASSERT(u < INT_STRING_LIMIT);
+ return const_cast<JSString *>(JSString::intStringTable[u])->assertIsFlat();
++#else
++ JS_NOT_REACHED("no static strings");
++ return NULL;
++#endif
+ }
+
+ /* Get a static atomized string for chars if possible. */
+ inline JSFlatString *
+ JSString::lookupStaticString(const jschar *chars, size_t length)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+ if (length == 1) {
+ if (chars[0] < UNIT_STRING_LIMIT)
+ return unitString(chars[0]);
+@@ -290,6 +313,7 @@
+ return intString(i);
+ }
+ }
++#endif
+
+ return NULL;
+ }
+--- a/js/src/jstracer.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jstracer.cpp 2012-11-02 10:43:17.022562584 +0100
+@@ -11505,6 +11505,7 @@
+ }
+ if (vp[1].isString()) {
+ JSString *str = vp[1].toString();
++#ifdef JS_HAS_STATIC_STRINGS
+ if (native == js_str_charAt) {
+ jsdouble i = vp[2].toNumber();
+ if (JSDOUBLE_IS_NaN(i))
+@@ -11518,7 +11519,9 @@
+ set(&vp[0], char_ins);
+ pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
+ return RECORD_CONTINUE;
+- } else if (native == js_str_charCodeAt) {
++ } else
++#endif
++ if (native == js_str_charCodeAt) {
+ jsdouble i = vp[2].toNumber();
+ if (JSDOUBLE_IS_NaN(i))
+ i = 0;
+@@ -12967,6 +12970,7 @@
+ JS_STATIC_ASSERT(sizeof(JSString) == 16 || sizeof(JSString) == 32);
+
+
++#ifdef JS_HAS_STATIC_STRINGS
+ JS_REQUIRES_STACK LIns*
+ TraceRecorder::getUnitString(LIns* str_ins, LIns* idx_ins)
+ {
+@@ -13010,6 +13014,7 @@
+ }
+ return RECORD_CONTINUE;
+ }
++#endif
+
+ // Typed array tracing depends on EXPANDED_LOADSTORE and F2I
+ #if NJ_EXPANDED_LOADSTORE_SUPPORTED && NJ_F2I_SUPPORTED
+@@ -13044,6 +13049,7 @@
+ LIns* obj_ins = get(&lval);
+ LIns* idx_ins = get(&idx);
+
++#ifdef JS_HAS_STATIC_STRINGS
+ // Special case for array-like access of strings.
+ if (lval.isString() && hasInt32Repr(idx)) {
+ if (call)
+@@ -13056,6 +13062,7 @@
+ set(&lval, char_ins);
+ return ARECORD_CONTINUE;
+ }
++#endif
+
+ if (lval.isPrimitive())
+ RETURN_STOP_A("JSOP_GETLEM on a primitive");
+--- a/js/src/jstracer.h 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/jstracer.h 2012-11-02 10:43:17.034562582 +0100
+@@ -1394,10 +1394,12 @@
+ JS_REQUIRES_STACK RecordingStatus getCharCodeAt(JSString *str,
+ nanojit::LIns* str_ins, nanojit::LIns* idx_ins,
+ nanojit::LIns** out_ins);
++#ifdef JS_HAS_STATIC_STRINGS
+ JS_REQUIRES_STACK nanojit::LIns* getUnitString(nanojit::LIns* str_ins, nanojit::LIns* idx_ins);
+ JS_REQUIRES_STACK RecordingStatus getCharAt(JSString *str,
+ nanojit::LIns* str_ins, nanojit::LIns* idx_ins,
+ JSOp mode, nanojit::LIns** out_ins);
++#endif
+
+ JS_REQUIRES_STACK RecordingStatus initOrSetPropertyByName(nanojit::LIns* obj_ins,
+ Value* idvalp, Value* rvalp,
+--- a/js/src/tracejit/Writer.cpp 2011-03-31 21:08:36.000000000 +0200
++++ b/js/src/tracejit/Writer.cpp 2012-11-02 10:43:17.038562582 +0100
+@@ -246,7 +246,9 @@
+ // ins = andq ins_oprnd1, ins_oprnd2
+ ret = true;
+ #endif
+- } else if (ins->isop(LIR_addp) &&
++ }
++#ifdef JS_HAS_STATIC_STRINGS
++ else if (ins->isop(LIR_addp) &&
+ ((ins->oprnd1()->isImmP() &&
+ (void *)ins->oprnd1()->immP() == JSString::unitStringTable) ||
+ (ins->oprnd2()->isImmP() &&
+@@ -258,6 +260,7 @@
+ // ins = addp JSString::unitStringTable, ...
+ ret = true;
+ }
++#endif
+
+ return ret;
+ }
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-isfinite.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-isfinite.patch
new file mode 100644
index 000000000000..edf4d01e64bd
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-isfinite.patch
@@ -0,0 +1,11 @@
+--- js/src/jsnum.h 2011-03-03 05:43:06.000000000 -0500
++++ js/src/jsnum.h.new 2012-08-16 14:58:04.000000000 -0400
+@@ -97,6 +97,8 @@
+ {
+ #ifdef WIN32
+ return _finite(d);
++#elif defined(__UCLIBC__)
++ return isfinite(d);
+ #else
+ return finite(d);
+ #endif
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-perf_event-check.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-perf_event-check.patch
new file mode 100644
index 000000000000..66475b6c34c4
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-perf_event-check.patch
@@ -0,0 +1,21 @@
+--- a/js/src/configure.in 2012-11-01 19:42:20.130330321 +0100
++++ b/js/src/configure.in 2012-11-01 20:34:03.561351492 +0100
+@@ -3477,7 +3477,16 @@
+ esac
+
+ dnl Performance measurement headers.
+-AC_CHECK_HEADER(linux/perf_event.h, HAVE_LINUX_PERF_EVENT_H=1)
++AC_CHECK_HEADER(linux/perf_event.h,
++ [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
++ [AC_TRY_COMPILE([#include <sys/syscall.h>],[return sizeof(__NR_perf_event_open);],
++ ac_cv_perf_event_open=yes,
++ ac_cv_perf_event_open=no)])])
++if test "$ac_cv_perf_event_open" = "yes"; then
++ HAVE_LINUX_PERF_EVENT_H=1
++else
++ HAVE_LINUX_PERF_EVENT_H=
++fi
+ AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
+
+ dnl Checks for libraries.
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.5-symbol-versions.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-symbol-versions.patch
new file mode 100644
index 000000000000..460394d33f13
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.5-symbol-versions.patch
@@ -0,0 +1,32 @@
+diff -Naur js/src/configure.in js.new/src/configure.in
+--- a/js/src/symverscript.in 2012-11-07 09:36:16.000000000 -0500
++++ b/js/src/symverscript.in 2012-11-07 09:37:05.000000000 -0500
+@@ -0,0 +1,4 @@
++mozjs185 {
++ global: *;
++};
++
+diff -Naur js/src/Makefile.in js.new/src/Makefile.in
+--- a/js/src/Makefile.in 2012-11-07 09:36:16.000000000 -0500
++++ b/js/src/Makefile.in 2012-11-07 09:37:09.000000000 -0500
+@@ -837,7 +837,10 @@
+ mozjs185.pc \
+ $(NULL)
+
+-GARBAGE += $(pkg_config_files)
++symverscript: symverscript.in
++ cat $< > $@
++
++GARBAGE += $(pkg_config_files) symverscript
+
+ %.pc: $(srcdir)/%.pc.in Makefile
+ cat $< | sed \
+@@ -872,6 +875,8 @@
+ SHLIB_ABI_VER := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY).$(SRCREL_ABI_VERSION)
+ SHLIB_EXACT_VER := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY).$(SRCREL_VERSION)
+ $(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -Wl,-soname,$(notdir $(SHLIB_ABI_VER))
++$(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
++$(SHARED_LIBRARY): symverscript
+ endif
+ endif
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.7-filter_desc.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-filter_desc.patch
new file mode 100644
index 000000000000..65d0a2df8ba6
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-filter_desc.patch
@@ -0,0 +1,18 @@
+--- a/js/src/Makefile.in 2012-06-18 13:53:41.000000000 -0400
++++ b/js/src/Makefile.in 2012-06-18 13:55:44.000000000 -0400
+@@ -965,10 +965,10 @@
+ endif
+ endif
+
+-install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
+-ifneq (,$(LIBRARY))
+- $(SYSINSTALL) $(LIBRARY) $(DESTDIR)$(libdir)
+- mv -f $(DESTDIR)$(libdir)/$(LIBRARY) $(subst $(STATIC_LIBRARY_NAME),mozjs187-$(SRCREL_ABI_VERSION),$(DESTDIR)$(libdir)/$(LIBRARY))
++install:: $(filter-out %.$(LIBS_DESC_SUFFIX),$(LIBRARY)) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
++ifneq (,$(filter-out %.$(LIBS_DESC_SUFFIX),$(LIBRARY)))
++ $(SYSINSTALL) $(filter-out %.$(LIBS_DESC_SUFFIX),$(LIBRARY)) $(DESTDIR)$(libdir)
++ mv -f $(DESTDIR)$(libdir)/$(filter-out %.$(LIBS_DESC_SUFFIX),$(LIBRARY)) $(subst $(STATIC_LIBRARY_NAME),mozjs187-$(SRCREL_ABI_VERSION),$(DESTDIR)$(libdir)/$(filter-out %.$(LIBS_DESC_SUFFIX),$(LIBRARY)))
+ endif
+ ifneq (,$(SHARED_LIBRARY))
+ ifeq (,$(HOST_BIN_SUFFIX))
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.7-freebsd-pthreads.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-freebsd-pthreads.patch
new file mode 100644
index 000000000000..4324df0d6093
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-freebsd-pthreads.patch
@@ -0,0 +1,11 @@
+--- a/js/src/config/system-headers
++++ b/js/src/config/system-headers
+@@ -595,6 +595,7 @@ proto/exec.h
+ psap.h
+ Pt.h
+ pthread.h
++pthread_np.h
+ pwd.h
+ Python.h
+ QDOffscreen.h
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.7-symbol-versions.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-symbol-versions.patch
new file mode 100644
index 000000000000..3945172688d0
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-symbol-versions.patch
@@ -0,0 +1,32 @@
+diff -Naur js/src/configure.in js.new/src/configure.in
+--- a/js/src/symverscript.in 2012-11-07 09:36:16.000000000 -0500
++++ b/js/src/symverscript.in 2012-11-07 09:37:05.000000000 -0500
+@@ -0,0 +1,4 @@
++mozjs187 {
++ global: *;
++};
++
+diff -Naur js/src/Makefile.in js.new/src/Makefile.in
+--- a/js/src/Makefile.in 2012-11-07 09:36:16.000000000 -0500
++++ b/js/src/Makefile.in 2012-11-07 09:37:09.000000000 -0500
+@@ -837,7 +837,10 @@
+ mozjs185.pc \
+ $(NULL)
+
+-GARBAGE += $(pkg_config_files)
++symverscript: symverscript.in
++ cat $< > $@
++
++GARBAGE += $(pkg_config_files) symverscript
+
+ %.pc: $(srcdir)/%.pc.in Makefile
+ cat $< | sed \
+@@ -872,6 +875,8 @@
+ SHLIB_ABI_VER := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY).$(SRCREL_ABI_VERSION)
+ SHLIB_EXACT_VER := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY).$(SRCREL_VERSION)
+ $(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -Wl,-soname,$(notdir $(SHLIB_ABI_VER))
++$(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
++$(SHARED_LIBRARY): symverscript
+ endif
+ endif
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.8.7-x32.patch b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-x32.patch
new file mode 100644
index 000000000000..f14a269ee3fc
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.8.7-x32.patch
@@ -0,0 +1,25 @@
+--- a/js/src/jslock.cpp 2012-04-06 16:24:51.000000000 -0500
++++ b/js/src/jslock.cpp 2012-06-21 20:57:00.877937542 -0500
+@@ -150,17 +150,22 @@
+
+ static JS_ALWAYS_INLINE int
+ NativeCompareAndSwap(volatile jsword *w, jsword ov, jsword nv)
+ {
+ unsigned int res;
+
+ __asm__ __volatile__ (
+ "lock\n"
++/* GCC's x32 abi support */
++#if defined(__LP64__)
+ "cmpxchgq %2, (%1)\n"
++#else
++ "cmpxchg %2, (%1)\n"
++#endif
+ "sete %%al\n"
+ "movzbl %%al, %%eax\n"
+ : "=a" (res)
+ : "r" (w), "r" (nv), "a" (ov)
+ : "cc", "memory");
+ return (int)res;
+ }
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-1.9.2.13-as-needed.patch b/dev-lang/spidermonkey/files/spidermonkey-1.9.2.13-as-needed.patch
new file mode 100644
index 000000000000..847bf792c5b2
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-1.9.2.13-as-needed.patch
@@ -0,0 +1,22 @@
+diff --git a/js/src/jsapi-tests/Makefile.in b/js/src/jsapi-tests/Makefile.in
+--- a/js/src/jsapi-tests/Makefile.in
++++ b/js/src/jsapi-tests/Makefile.in
+@@ -55,17 +55,17 @@ CPPSRCS = \
+ testSameValue.cpp \
+ testDebugger.cpp \
+ testDefineGetterSetterNonEnumerable.cpp \
+ testExtendedEq.cpp \
+ $(NULL)
+
+ DEFINES += -DEXPORT_JS_API
+
+-LIBS = $(NSPR_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
++LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS)
+
+ LOCAL_INCLUDES += -I$(topsrcdir) -I..
+
+ ifdef _MSC_VER
+ ifdef WINCE
+ WIN32_EXE_LDFLAGS += -ENTRY:mainACRTStartup
+ endif
+ endif
diff --git a/dev-lang/spidermonkey/files/spidermonkey-17-ia64-mmap.patch b/dev-lang/spidermonkey/files/spidermonkey-17-ia64-mmap.patch
new file mode 100644
index 000000000000..7adbd118d408
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-17-ia64-mmap.patch
@@ -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;
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-17-js-config-shebang.patch b/dev-lang/spidermonkey/files/spidermonkey-17-js-config-shebang.patch
new file mode 100644
index 000000000000..ec77b2368289
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-17-js-config-shebang.patch
@@ -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)
diff --git a/dev-lang/spidermonkey/files/spidermonkey-17.0.0-fix-file-permissions.patch b/dev-lang/spidermonkey/files/spidermonkey-17.0.0-fix-file-permissions.patch
new file mode 100644
index 000000000000..f4eee9305425
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-17.0.0-fix-file-permissions.patch
@@ -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
diff --git a/dev-lang/spidermonkey/files/spidermonkey-24-system-icu.patch b/dev-lang/spidermonkey/files/spidermonkey-24-system-icu.patch
new file mode 100644
index 000000000000..59ba0c958ea3
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-24-system-icu.patch
@@ -0,0 +1,199 @@
+diff --git a/js/src/Makefile.in b/js/src/Makefile.in
+index 4944d31..4176e14 100644
+--- a/js/src/Makefile.in
++++ b/js/src/Makefile.in
+@@ -237,12 +237,17 @@ endif
+ # ICU headers need to be available whether we build with the complete
+ # Internationalization API or not - ICU stubs rely on them.
+
++ifdef MOZ_NATIVE_ICU
++LOCAL_INCLUDES += $(MOZ_ICU_CFLAGS)
++else
+ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/../../intl/icu/source/common \
+ -I$(topsrcdir)/../../intl/icu/source/i18n \
+ $(NULL)
++endif
+
+ ifdef ENABLE_INTL_API
++ifndef MOZ_NATIVE_ICU
+
+ ifeq ($(OS_ARCH),WINNT)
+ # Parallel gmake is buggy on Windows
+@@ -271,6 +276,7 @@ distclean clean::
+ $(call SUBMAKE,$@,intl/icu)
+
+ endif
++endif
+
+ #
+ # END ECMAScript Internationalization API
+@@ -403,7 +409,11 @@ ifneq (,$(MOZ_ZLIB_LIBS)$(MOZ_GLUE_LDFLAGS))
+ DEFINES += -DUSE_ZLIB
+ endif
+
+-SHARED_LIBRARY_LIBS += $(ICU_LIBS)
++ifdef MOZ_NATIVE_ICU
++EXTRA_DSO_LDOPTS += $(MOZ_ICU_LIBS)
++else
++SHARED_LIBRARY_LIBS += $(MOZ_ICU_LIBS)
++endif
+
+ # Prevent floating point errors caused by VC++ optimizations
+ ifdef _MSC_VER
+diff --git a/js/src/config/Makefile.in b/js/src/config/Makefile.in
+index 5f60d15..e1fe1f8 100644
+--- a/js/src/config/Makefile.in
++++ b/js/src/config/Makefile.in
+@@ -59,6 +59,7 @@ export:: \
+ $(call mkdir_deps,system_wrappers_js) \
+ $(NULL)
+ $(PYTHON) $(srcdir)/Preprocessor.py $(DEFINES) $(ACDEFINES) \
++ -DMOZ_NATIVE_ICU=$(MOZ_NATIVE_ICU) \
+ $(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers_js
+ $(INSTALL) system_wrappers_js $(DIST)
+
+diff --git a/js/src/config/system-headers b/js/src/config/system-headers
+index b52aed6..1ca7420 100644
+--- a/js/src/config/system-headers
++++ b/js/src/config/system-headers
+@@ -1132,3 +1132,14 @@ kvm.h
+ spawn.h
+ err.h
+ xlocale.h
++#if MOZ_NATIVE_ICU==1
++unicode/locid.h
++unicode/numsys.h
++unicode/ucal.h
++unicode/ucol.h
++unicode/udat.h
++unicode/udatpg.h
++unicode/uenum.h
++unicode/unum.h
++unicode/ustring.h
++#endif
+diff --git a/js/src/configure.in b/js/src/configure.in
+index 4bccbe3..d535491 100644
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -4409,6 +4409,16 @@ fi
+ dnl ========================================================
+ dnl ECMAScript Internationalization API Support (uses ICU)
+ dnl ========================================================
++ICU_LIB_NAMES=
++MOZ_NATIVE_ICU=
++MOZ_ARG_WITH_BOOL(system-icu,
++[ --with-system-icu
++ Use system icu (located with pkgconfig)],
++ MOZ_NATIVE_ICU=1)
++
++if test -n "$MOZ_NATIVE_ICU"; then
++ PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
++fi
+
+ if test -n "$JS_STANDALONE"; then
+ ENABLE_INTL_API=1
+@@ -4421,37 +4431,34 @@ MOZ_ARG_ENABLE_BOOL(intl-api,
+ dnl Settings for the implementation of the ECMAScript Internationalization API
+ if test -n "$ENABLE_INTL_API"; then
+ AC_DEFINE(ENABLE_INTL_API)
+- # We build ICU as a static library.
+- AC_DEFINE(U_STATIC_IMPLEMENTATION)
+-
+- case "$OS_TARGET" in
+- WINNT)
+- ICU_LIB_NAMES="icuin icuuc icudt"
+- ;;
+- Darwin|Linux)
+- ICU_LIB_NAMES="icui18n icuuc icudata"
+- ;;
+- *)
+- AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
+- esac
+-
+- ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
+-else
+- ICU_LIB_NAMES=
+- ICU_LIBS=
++ if test -z "$MOZ_NATIVE_ICU"; then
++ case "$OS_TARGET" in
++ WINNT)
++ ICU_LIB_NAMES="icuin icuuc icudt"
++ ;;
++ Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
++ ICU_LIB_NAMES="icui18n icuuc icudata"
++ ;;
++ *)
++ AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
++ esac
++ MOZ_ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
++ fi
+ fi
+
+ AC_SUBST(ENABLE_INTL_API)
+ AC_SUBST(ICU_LIB_NAMES)
+-AC_SUBST(ICU_LIBS)
+-
+-dnl Source files that use ICU should have control over which parts of the ICU
+-dnl namespace they want to use.
+-AC_DEFINE(U_USING_ICU_NAMESPACE,0)
+-
++AC_SUBST(MOZ_ICU_LIBS)
++AC_SUBST(MOZ_NATIVE_ICU)
+
+ dnl Settings for ICU
+-if test -n "$ENABLE_INTL_API" ; then
++if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
++ dnl We build ICU as a static library.
++ AC_DEFINE(U_STATIC_IMPLEMENTATION)
++
++ dnl Source files that use ICU should have control over which parts of the ICU
++ dnl namespace they want to use.
++ AC_DEFINE(U_USING_ICU_NAMESPACE,0)
+ # Set ICU compile options
+ ICU_CPPFLAGS=""
+ # don't use icu namespace automatically in client code
+diff --git a/js/src/gdb/Makefile.in b/js/src/gdb/Makefile.in
+index 288934a..a582dfe 100644
+--- a/js/src/gdb/Makefile.in
++++ b/js/src/gdb/Makefile.in
+@@ -19,6 +19,10 @@ LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIB
+
+ LOCAL_INCLUDES += -I$(topsrcdir) -I..
+
++ifdef MOZ_NATIVE_ICU
++EXTRA_LIBS += $(MOZ_ICU_LIBS)
++endif
++
+ EXTRA_LIBS += $(MOZ_FFI_LIBS)
+
+ # Place a GDB Python auto-load file next to the gdb-tests executable, both
+diff --git a/js/src/jsapi-tests/Makefile.in b/js/src/jsapi-tests/Makefile.in
+index 5f7d594..10d7054 100644
+--- a/js/src/jsapi-tests/Makefile.in
++++ b/js/src/jsapi-tests/Makefile.in
+@@ -20,6 +20,10 @@ LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLI
+
+ LOCAL_INCLUDES += -I$(topsrcdir) -I..
+
++ifdef MOZ_NATIVE_ICU
++EXTRA_LIBS += $(MOZ_ICU_LIBS)
++endif
++
+ EXTRA_LIBS += $(MOZ_FFI_LIBS)
+
+ ifdef QEMU_EXE
+diff --git a/js/src/shell/Makefile.in b/js/src/shell/Makefile.in
+index 2e1df09..db66c69 100644
+--- a/js/src/shell/Makefile.in
++++ b/js/src/shell/Makefile.in
+@@ -27,6 +27,9 @@ LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_
+ ifdef MOZ_NATIVE_FFI
+ EXTRA_LIBS += $(MOZ_FFI_LIBS)
+ endif
++ifdef MOZ_NATIVE_ICU
++EXTRA_LIBS += $(MOZ_ICU_LIBS)
++endif
+
+ LOCAL_INCLUDES += -I$(topsrcdir) -I..
+
diff --git a/dev-lang/spidermonkey/files/spidermonkey-24-upward-growing-stack.patch b/dev-lang/spidermonkey/files/spidermonkey-24-upward-growing-stack.patch
new file mode 100644
index 000000000000..70963627bcc5
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-24-upward-growing-stack.patch
@@ -0,0 +1,41 @@
+diff -Naur mozjs-24.2.0/js/src/gc/RootMarking.cpp mozjs-24.2.0.new/js/src/gc/RootMarking.cpp
+--- mozjs-24.2.0/js/src/gc/RootMarking.cpp 2013-10-29 16:40:26.000000000 -0400
++++ mozjs-24.2.0.new/js/src/gc/RootMarking.cpp 2014-05-05 16:16:15.570098309 -0400
+@@ -320,7 +320,7 @@
+
+ uintptr_t *stackMin, *stackEnd;
+ #if JS_STACK_GROWTH_DIRECTION > 0
+- stackMin = rt->nativeStackBase;
++ stackMin = reinterpret_cast<uintptr_t *>(rt->nativeStackBase);
+ stackEnd = cgcd->nativeStackTop;
+ #else
+ stackMin = cgcd->nativeStackTop + 1;
+diff -Naur mozjs-24.2.0/js/src/jsapi.cpp mozjs-24.2.0.new/js/src/jsapi.cpp
+--- mozjs-24.2.0/js/src/jsapi.cpp 2013-12-06 17:52:35.000000000 -0500
++++ mozjs-24.2.0.new/js/src/jsapi.cpp 2014-05-05 16:17:01.330099145 -0400
+@@ -863,10 +863,6 @@
+
+ PodZero(&debugHooks);
+ PodZero(&atomState);
+-
+-#if JS_STACK_GROWTH_DIRECTION > 0
+- nativeStackLimit = UINTPTR_MAX;
+-#endif
+ }
+
+ bool
+diff -Naur mozjs-24.2.0/js/src/jsfriendapi.cpp mozjs-24.2.0.new/js/src/jsfriendapi.cpp
+--- mozjs-24.2.0/js/src/jsfriendapi.cpp 2013-10-29 16:40:20.000000000 -0400
++++ mozjs-24.2.0.new/js/src/jsfriendapi.cpp 2014-05-05 16:18:30.350100769 -0400
+@@ -32,7 +32,11 @@
+ PerThreadDataFriendFields::RuntimeMainThreadOffset);
+
+ PerThreadDataFriendFields::PerThreadDataFriendFields()
++#if JS_STACK_GROWTH_DIRECTION > 0
++ : nativeStackLimit(UINTPTR_MAX)
++#else
+ : nativeStackLimit(0)
++#endif
+ {
+ #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
+ PodArrayZero(thingGCRooters);
diff --git a/dev-lang/spidermonkey/files/spidermonkey-24.2.0-fix-file-permissions.patch b/dev-lang/spidermonkey/files/spidermonkey-24.2.0-fix-file-permissions.patch
new file mode 100644
index 000000000000..a2247164111a
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-24.2.0-fix-file-permissions.patch
@@ -0,0 +1,29 @@
+diff -urN a/js/src/Makefile.in b/js/src/Makefile.in
+--- a/js/src/Makefile.in 2013-11-19 13:42:43.000000000 -0600
++++ b/js/src/Makefile.in 2014-03-08 08:07:28.331006149 -0600
+@@ -542,7 +542,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
+@@ -569,13 +569,13 @@
+ #
+
+ install:: $(EXPORTS)
+- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)
++ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)
+
+ install:: $(EXPORTS_js)
+- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)/js
++ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)/js
+
+ install:: $(EXPORTS_mozilla)
+- $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)/mozilla
++ $(SYSINSTALL) -m 0644 $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)/mozilla
+
+ #
+ # END SpiderMonkey header installation
diff --git a/dev-lang/spidermonkey/files/spidermonkey-perl-defined-array-check.patch b/dev-lang/spidermonkey/files/spidermonkey-perl-defined-array-check.patch
new file mode 100644
index 000000000000..c3996ae82bb3
--- /dev/null
+++ b/dev-lang/spidermonkey/files/spidermonkey-perl-defined-array-check.patch
@@ -0,0 +1,11 @@
+--- a/js/src/config/milestone.pl 2013-02-11 17:33:22.000000000 -0500
++++ b/js/src/config/milestone.pl 2015-07-15 10:44:31.676153600 -0400
+@@ -55,7 +55,7 @@
+ #
+ my $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE);
+
+-if (defined(@TEMPLATE_FILE)) {
++if (@TEMPLATE_FILE) {
+ my $TFILE;
+
+ foreach $TFILE (@TEMPLATE_FILE) {
diff --git a/dev-lang/spidermonkey/metadata.xml b/dev-lang/spidermonkey/metadata.xml
new file mode 100644
index 000000000000..ec0cd3c674e0
--- /dev/null
+++ b/dev-lang/spidermonkey/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>mozilla</herd>
+ <longdescription lang="en">
+ Stand-alone JavaScript C library
+ </longdescription>
+ <use>
+ <flag name='debug'>Enable assertions to allow for easier debugging of programs that link to spidermonkey -- note this will often crash software on regular end-user systems</flag>
+ <flag name='threadsafe'>Build a threadsafe version of spidermonkey</flag>
+ <flag name='system-icu'>Use the system-wide <pkg>dev-libs/icu</pkg> instead of bundled -- note, only takes effect when icu flag is enabled</flag>
+ </use>
+</pkgmetadata>
+
diff --git a/dev-lang/spidermonkey/spidermonkey-1.7.0-r1.ebuild b/dev-lang/spidermonkey/spidermonkey-1.7.0-r1.ebuild
new file mode 100644
index 000000000000..b38ada4235d2
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-1.7.0-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+MY_P="js-${PV}"
+DESCRIPTION="Stand-alone JavaScript C library"
+HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
+SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/js/${MY_P}.tar.gz"
+
+LICENSE="NPL-1.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="threadsafe unicode"
+
+S="${WORKDIR}/js/src"
+
+RDEPEND="threadsafe? ( dev-libs/nspr )"
+
+DEPEND="${RDEPEND}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${PN}-1.5-build.patch"
+ epatch "${FILESDIR}/${PN}-1.6-header.patch"
+ epatch "${FILESDIR}/${P}-threadsafe.diff"
+ if [[ ${CHOST} == *-freebsd* ]]; then
+ # Don't try to be smart, this does not work in cross-compile anyway
+ ln -s "${S}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk"
+ fi
+}
+
+src_compile() {
+ use unicode && append-flags "-DJS_C_STRINGS_ARE_UTF8"
+ tc-export CC LD AR
+ if use threadsafe; then
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" JS_THREADSAFE=1 \
+ || die "emake with threadsafe enabled failed";
+ else
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" \
+ || die "emake without threadsafe enabled failed";
+ fi
+}
+
+src_install() {
+ emake -f Makefile.ref install DESTDIR="${D}" LIBDIR="$(get_libdir)" || die
+ dodoc ../jsd/README
+ dohtml README.html
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-1.7.0-r2.ebuild b/dev-lang/spidermonkey/spidermonkey-1.7.0-r2.ebuild
new file mode 100644
index 000000000000..9fc66714efa4
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-1.7.0-r2.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+MY_P="js-${PV}"
+DESCRIPTION="Stand-alone JavaScript C library"
+HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
+SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/js/${MY_P}.tar.gz"
+
+LICENSE="NPL-1.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="threadsafe unicode"
+
+S="${WORKDIR}/js/src"
+
+RDEPEND="threadsafe? ( dev-libs/nspr )"
+DEPEND="${RDEPEND}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${PN}-1.5-build.patch"
+ epatch "${FILESDIR}/${PN}-1.6-header.patch"
+ epatch "${FILESDIR}/${P}-threadsafe.diff" \
+ "${FILESDIR}"/${P}-ldflags.patch
+ if [[ ${CHOST} == *-freebsd* ]]; then
+ # Don't try to be smart, this does not work in cross-compile anyway
+ ln -s "${S}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk"
+ fi
+}
+
+src_compile() {
+ use unicode && append-flags "-DJS_C_STRINGS_ARE_UTF8"
+ tc-export CC LD AR
+ if use threadsafe; then
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" JS_THREADSAFE=1 \
+ XLDFLAGS="$(raw-ldflags)" HOST_LDFLAGS="${LDFLAGS}" \
+ || die "emake with threadsafe enabled failed";
+ else
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" XLDFLAGS="$(raw-ldflags)" \
+ HOST_LDFLAGS="${LDFLAGS}" || die "emake without threadsafe enabled failed";
+ fi
+}
+
+src_install() {
+ emake -f Makefile.ref install DESTDIR="${D}" LIBDIR="$(get_libdir)" || die
+ dodoc ../jsd/README
+ dohtml README.html
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-1.7.0-r3.ebuild b/dev-lang/spidermonkey/spidermonkey-1.7.0-r3.ebuild
new file mode 100644
index 000000000000..354fadc8ca4d
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-1.7.0-r3.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+MY_P="js-${PV}"
+DESCRIPTION="Stand-alone JavaScript C library"
+HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
+SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/js/${MY_P}.tar.gz"
+
+LICENSE="NPL-1.1"
+SLOT="0/js"
+KEYWORDS="alpha amd64 ~arm ppc ~ppc64 sparc x86 ~x86-fbsd"
+IUSE="threadsafe unicode"
+
+S="${WORKDIR}/js/src"
+
+RDEPEND="threadsafe? ( dev-libs/nspr )"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.5-build.patch"
+ epatch "${FILESDIR}/${PN}-1.6-header.patch"
+ epatch "${FILESDIR}/${P}-threadsafe.diff" \
+ "${FILESDIR}"/${P}-ldflags.patch
+
+ # don't force owner for Prefix
+ sed -i -e '/^INSTALL :=/s/-g 0 -o root//' Makefile.ref || die
+
+ if [[ ${CHOST} == *-freebsd* ]]; then
+ # Don't try to be smart, this does not work in cross-compile anyway
+ ln -s "${S}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk"
+ fi
+}
+
+src_compile() {
+ use unicode && append-flags "-DJS_C_STRINGS_ARE_UTF8"
+ tc-export CC LD AR RANLIB
+ local threadsafe=""
+ use threadsafe && threadsafe="JS_THREADSAFE=1"
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" ${threadsafe} \
+ XLDFLAGS="$(raw-ldflags)" HOST_LDFLAGS="${LDFLAGS}"
+}
+
+src_install() {
+ emake -f Makefile.ref install DESTDIR="${ED}" LIBDIR="$(get_libdir)"
+ dodoc ../jsd/README
+ dohtml README.html
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-1.7.0.ebuild b/dev-lang/spidermonkey/spidermonkey-1.7.0.ebuild
new file mode 100644
index 000000000000..2a130bc464c7
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-1.7.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs multilib
+
+MY_P="js-${PV}"
+DESCRIPTION="Stand-alone JavaScript C library"
+HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
+SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/js/${MY_P}.tar.gz"
+
+LICENSE="NPL-1.1"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="threadsafe"
+
+S="${WORKDIR}/js/src"
+
+RDEPEND="threadsafe? ( dev-libs/nspr )"
+
+DEPEND="${RDEPEND}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${PN}-1.5-build.patch"
+ epatch "${FILESDIR}/${PN}-1.6-header.patch"
+ epatch "${FILESDIR}/${P}-threadsafe.diff"
+ if [[ ${CHOST} == *-freebsd* ]]; then
+ # Don't try to be smart, this does not work in cross-compile anyway
+ ln -s "${S}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk"
+ fi
+}
+
+src_compile() {
+ tc-export CC LD AR
+ if use threadsafe; then
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" JS_THREADSAFE=1 \
+ || die "emake with threadsafe enabled failed";
+ else
+ emake -j1 -f Makefile.ref LIBDIR="$(get_libdir)" \
+ || die "emake without threadsafe enabled failed";
+ fi
+}
+
+src_install() {
+ emake -f Makefile.ref install DESTDIR="${D}" LIBDIR="$(get_libdir)" || die
+ dodoc ../jsd/README
+ dohtml README.html
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-1.8.2.15-r2.ebuild b/dev-lang/spidermonkey/spidermonkey-1.8.2.15-r2.ebuild
new file mode 100644
index 000000000000..da38130333a6
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-1.8.2.15-r2.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+inherit eutils toolchain-funcs multilib python-any-r1
+
+MY_PV="${PV}"
+MY_PV="${MY_PV/1.8.2/3.6}"
+DESCRIPTION="Stand-alone JavaScript C library"
+HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
+REL_URI="http://releases.mozilla.org/pub/mozilla.org/firefox/releases"
+SRC_URI="${REL_URI}/${MY_PV}/source/firefox-${MY_PV}.source.tar.bz2"
+
+LICENSE="NPL-1.1"
+SLOT="0/mozjs"
+KEYWORDS="alpha amd64 arm ppc ppc64 sparc x86 ~x86-fbsd ~x64-macos ~x86-macos"
+IUSE="threadsafe"
+
+S="${WORKDIR}/mozilla-1.9.2"
+BUILDDIR="${S}/js/src"
+
+RDEPEND="threadsafe? ( >=dev-libs/nspr-4.8.6 )"
+
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/zip
+ virtual/pkgconfig"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.9.2.13-as-needed.patch"
+
+ epatch_user
+
+ if [[ ${CHOST} == *-freebsd* ]]; then
+ # Don't try to be smart, this does not work in cross-compile anyway
+ ln -s "${BUILDDIR}/config/Linux_All.mk" "${S}/config/$(uname -s)$(uname -r).mk"
+ fi
+}
+
+src_configure() {
+ cd "${BUILDDIR}" || die
+
+ local myconf
+
+ use threadsafe && myconf="${myconf} \
+ --with-system-nspr --enable-threadsafe"
+
+ # Disable no-print-directory
+ MAKEOPTS=${MAKEOPTS/--no-print-directory/}
+
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
+ LD="$(tc-getLD)" econf \
+ ${myconf}
+}
+
+src_compile() {
+ cd "${BUILDDIR}" || die
+ emake -j1
+}
+
+src_install() {
+ cd "${BUILDDIR}" || die
+ emake install DESTDIR="${D}"
+ dobin shell/js
+ dodoc ../jsd/README
+ dohtml README.html
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fixup install_name
+ install_name_tool -id "${EPREFIX}"/usr/$(get_libdir)/libmozjs.dylib \
+ "${ED}"/usr/$(get_libdir)/libmozjs.dylib || die
+ fi
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild b/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild
new file mode 100644
index 000000000000..45eca06fd066
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-1.8.5-r4.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+WANT_AUTOCONF="2.1"
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+inherit autotools eutils toolchain-funcs multilib python-any-r1 versionator pax-utils
+
+MY_PN="js"
+TARBALL_PV="$(replace_all_version_separators '' $(get_version_component_range 1-3))"
+MY_P="${MY_PN}-${PV}"
+TARBALL_P="${MY_PN}${TARBALL_PV}-1.0.0"
+DESCRIPTION="Stand-alone JavaScript C library"
+HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
+SRC_URI="https://ftp.mozilla.org/pub/mozilla.org/js/${TARBALL_P}.tar.gz"
+
+LICENSE="NPL-1.1"
+SLOT="0/mozjs185"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x64-macos"
+IUSE="debug minimal static-libs test"
+
+S="${WORKDIR}/${MY_P}"
+BUILDDIR="${S}/js/src"
+
+RDEPEND=">=dev-libs/nspr-4.7.0
+ x64-macos? ( dev-libs/jemalloc )"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/zip
+ virtual/pkgconfig"
+
+pkg_setup(){
+ if [[ ${MERGE_TYPE} != "binary" ]]; then
+ export LC_ALL="C"
+ fi
+}
+
+src_prepare() {
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=628723#c43
+ epatch "${FILESDIR}/${P}-fix-install-symlinks.patch"
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=638056#c9
+ epatch "${FILESDIR}/${P}-fix-ppc64.patch"
+ # https://bugs.gentoo.org/show_bug.cgi?id=400727
+ # https://bugs.gentoo.org/show_bug.cgi?id=420471
+ epatch "${FILESDIR}/${P}-arm_respect_cflags-3.patch"
+ # https://bugs.gentoo.org/show_bug.cgi?id=438746
+ epatch "${FILESDIR}"/${PN}-1.8.7-freebsd-pthreads.patch
+ # https://bugs.gentoo.org/show_bug.cgi?id=441928
+ epatch "${FILESDIR}"/${PN}-1.8.5-perf_event-check.patch
+ # https://bugs.gentoo.org/show_bug.cgi?id=439260
+ epatch "${FILESDIR}"/${P}-symbol-versions.patch
+ # https://bugs.gentoo.org/show_bug.cgi?id=441934
+ epatch "${FILESDIR}"/${PN}-1.8.5-ia64-fix.patch
+ epatch "${FILESDIR}"/${PN}-1.8.5-ia64-static-strings.patch
+ # https://bugs.gentoo.org/show_bug.cgi?id=431560
+ epatch "${FILESDIR}"/${PN}-1.8.5-isfinite.patch
+ # https://bugs.gentoo.org/show_bug.cgi?id=552786
+ epatch "${FILESDIR}"/${PN}-perl-defined-array-check.patch
+
+ epatch_user
+
+ cd "${BUILDDIR}" || die
+ eautoconf
+}
+
+src_configure() {
+ cd "${BUILDDIR}" || die
+
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
+ LD="$(tc-getLD)" \
+ econf \
+ ${myopts} \
+ --enable-jemalloc \
+ --enable-readline \
+ --enable-threadsafe \
+ --with-system-nspr \
+ $(use_enable debug) \
+ $(use_enable static-libs static) \
+ $(use_enable test tests)
+}
+
+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
+}
+
+src_test() {
+ cd "${BUILDDIR}/jsapi-tests" || die
+ # for bug 415791
+ pax-mark mr jsapi-tests
+ emake check
+}
+
+src_install() {
+ cd "${BUILDDIR}" || die
+ emake DESTDIR="${D}" install
+ # bug 437520 , exclude js shell for small systems
+ if ! use minimal ; then
+ dobin shell/js
+ pax-mark m "${ED}/usr/bin/js"
+ fi
+ dodoc ../../README
+ dohtml README.html
+
+ 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
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild b/dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild
new file mode 100644
index 000000000000..1237f594b14d
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-17.0.0-r4.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+WANT_AUTOCONF="2.1"
+PYTHON_COMPAT=( python2_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
+ # https://bugs.gentoo.org/show_bug.cgi?id=552786
+ epatch "${FILESDIR}"/${PN}-perl-defined-array-check.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
+
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
+ LD="$(tc-getLD)" \
+ econf \
+ ${myopts} \
+ --enable-jemalloc \
+ --enable-readline \
+ --enable-threadsafe \
+ --with-system-nspr \
+ --enable-system-ffi \
+ --enable-jemalloc \
+ $(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
+ 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
+}
+
+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
+}
diff --git a/dev-lang/spidermonkey/spidermonkey-24.2.0-r3.ebuild b/dev-lang/spidermonkey/spidermonkey-24.2.0-r3.ebuild
new file mode 100644
index 000000000000..2e862bd39563
--- /dev/null
+++ b/dev-lang/spidermonkey/spidermonkey-24.2.0-r3.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+WANT_AUTOCONF="2.1"
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+inherit autotools 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="https://ftp.mozilla.org/pub/mozilla.org/js/${MY_P}.tar.bz2"
+
+LICENSE="NPL-1.1"
+SLOT="24"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd"
+IUSE="debug icu jit minimal static-libs +system-icu test"
+
+RESTRICT="ia64? ( test )"
+
+S="${WORKDIR}/${MY_P%.rc*}"
+BUILDDIR="${S}/js/src"
+
+RDEPEND=">=dev-libs/nspr-4.9.4
+ virtual/libffi
+ >=sys-libs/zlib-1.1.4
+ system-icu? ( >=dev-libs/icu-1.51:= )"
+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}-system-icu.patch
+ epatch "${FILESDIR}"/${PN}-24.2.0-fix-file-permissions.patch
+ epatch "${FILESDIR}"/${PN}-${SLOT}-upward-growing-stack.patch
+ # https://bugs.gentoo.org/show_bug.cgi?id=552786
+ epatch "${FILESDIR}"/${PN}-perl-defined-array-check.patch
+ 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
+
+ cd "${BUILDDIR}" || die
+ eautoconf
+}
+
+src_configure() {
+ export SHELL=/bin/sh
+ cd "${BUILDDIR}" || die
+
+ local myopts=""
+ if use icu; then # make sure system-icu flag only affects icu-enabled build
+ myopts+="$(use_with system-icu)"
+ else
+ myopts+="--without-system-icu"
+ fi
+
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
+ LD="$(tc-getLD)" \
+ econf \
+ ${myopts} \
+ --enable-jemalloc \
+ --enable-readline \
+ --enable-threadsafe \
+ --with-system-nspr \
+ --enable-system-ffi \
+ --disable-optimize \
+ $(use_enable icu intl-api) \
+ $(use_enable debug) \
+ $(use_enable jit yarr-jit) \
+ $(use_enable jit ion) \
+ $(use_enable static-libs static) \
+ $(use_enable test tests)
+}
+
+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) \
+ MOZ_OPTIMIZE_FLAGS="" MOZ_DEBUG_FLAGS="" \
+ HOST_OPTIMIZE_FLAGS="" MODULE_OPTIMIZE_FLAGS="" \
+ MOZ_PGO_OPTIMIZE_FLAGS="" \
+ 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) \
+ MOZ_OPTIMIZE_FLAGS="" MOZ_DEBUG_FLAGS="" HOST_OPTIMIZE_FLAGS="" \
+ -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 \
+ MOZ_OPTIMIZE_FLAGS="" MOZ_DEBUG_FLAGS="" \
+ HOST_OPTIMIZE_FLAGS="" MODULE_OPTIMIZE_FLAGS="" \
+ MOZ_PGO_OPTIMIZE_FLAGS=""
+}
+
+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
+}