Submitted By: Douglas R. Reno <renodr at linuxfromscratch dot org>
Date: 2017-04-01
Inital Package Version: 38.2.1
Upstream Status: Declined
Origin: https://git.gnome.org/browse/jhbuild/tree/patches
Description: Fixes build and functionality problems within mozjs38.


diff -Naurp mozjs-38.0.0.orig/build/autoconf/icu.m4 mozjs-38.0.0/build/autoconf/icu.m4
--- mozjs-38.0.0.orig/build/autoconf/icu.m4	2015-09-17 15:12:19.000000000 -0500
+++ mozjs-38.0.0/build/autoconf/icu.m4	2017-04-01 19:31:59.957994136 -0500
@@ -73,7 +73,8 @@ if test -n "$USE_ICU"; then
         fi
     fi
 
-    version=`sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"`
+    #version=`sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"`
+    version=57.1
     if test x"$version" = x; then
        AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno])
     fi
diff -Naurp mozjs-38.0.0.orig/js/src/configure mozjs-38.0.0/js/src/configure
--- mozjs-38.0.0.orig/js/src/configure	2015-09-17 15:38:10.000000000 -0500
+++ mozjs-38.0.0/js/src/configure	2017-04-01 19:31:59.958994141 -0500
@@ -1662,9 +1662,9 @@ esac
 
 fi
 
-MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
-MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
-MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
+MOZILLA_VERSION=`python $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
+MOZILLA_UAVERSION=`python $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
+MOZILLA_SYMBOLVERSION=`python $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
 
 cat >> confdefs.pytmp <<EOF
     (''' MOZILLA_VERSION ''', r''' "$MOZILLA_VERSION" ''')
@@ -1696,8 +1696,13 @@ MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSI
 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
 
+if test -n "$JS_STANDALONE"; then
+JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
+JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
+else
 JS_SHELL_NAME=js
 JS_CONFIG_NAME=js-config
+fi
 
 
 if test -n "$IS_ALPHA"; then
diff -Naurp mozjs-38.0.0.orig/js/src/configure.in mozjs-38.0.0/js/src/configure.in
--- mozjs-38.0.0.orig/js/src/configure.in	2015-09-17 15:12:18.000000000 -0500
+++ mozjs-38.0.0/js/src/configure.in	2017-04-01 19:31:59.959994147 -0500
@@ -236,9 +236,9 @@ fi
 dnl ==============================================================
 dnl Get mozilla version from central milestone file
 dnl ==============================================================
-MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
-MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
-MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
+MOZILLA_VERSION=`python $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
+MOZILLA_UAVERSION=`python $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
+MOZILLA_SYMBOLVERSION=`python $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
 
 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
@@ -252,16 +252,13 @@ MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSI
 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
 
-dnl XXX in a temporary bid to avoid developer anger at renaming files
-dnl XXX before "js" symlinks exist, don't change names.
-dnl
-dnl if test -n "$JS_STANDALONE"; then
-dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
-dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
-dnl else
+if test -n "$JS_STANDALONE"; then
+JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
+JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
+else
 JS_SHELL_NAME=js
 JS_CONFIG_NAME=js-config
-dnl fi
+fi
 
 changequote([,])
 if test -n "$IS_ALPHA"; then
diff -Naurp mozjs-38.0.0.orig/js/src/jit/RegisterSets.h mozjs-38.0.0/js/src/jit/RegisterSets.h
--- mozjs-38.0.0.orig/js/src/jit/RegisterSets.h	2015-09-17 15:12:22.000000000 -0500
+++ mozjs-38.0.0/js/src/jit/RegisterSets.h	2017-04-01 19:31:59.961994157 -0500
@@ -7,7 +7,6 @@
 #ifndef jit_RegisterSets_h
 #define jit_RegisterSets_h
 
-#include "mozilla/Alignment.h"
 #include "mozilla/MathAlgorithms.h"
 
 #include "jit/JitAllocPolicy.h"
@@ -26,8 +25,8 @@ struct AnyRegister {
     Code code_;
 
   public:
-    AnyRegister()
-    { }
+    AnyRegister() = default;
+
     explicit AnyRegister(Register gpr) {
         code_ = gpr.code();
     }
@@ -156,7 +155,7 @@ class ValueOperand
     }
 #endif
 
-    ValueOperand() {}
+    ValueOperand() = default;
 };
 
 // Registers to hold either either a typed or untyped value.
@@ -165,46 +164,25 @@ class TypedOrValueRegister
     // Type of value being stored.
     MIRType type_;
 
-    // Space to hold either an AnyRegister or a ValueOperand.
     union U {
-        mozilla::AlignedStorage2<AnyRegister> typed;
-        mozilla::AlignedStorage2<ValueOperand> value;
+        AnyRegister typed;
+        ValueOperand value;
     } data;
 
-    AnyRegister& dataTyped() {
-        MOZ_ASSERT(hasTyped());
-        return *data.typed.addr();
-    }
-    ValueOperand& dataValue() {
-        MOZ_ASSERT(hasValue());
-        return *data.value.addr();
-    }
-
-    AnyRegister dataTyped() const {
-        MOZ_ASSERT(hasTyped());
-        return *data.typed.addr();
-    }
-    const ValueOperand& dataValue() const {
-        MOZ_ASSERT(hasValue());
-        return *data.value.addr();
-    }
-
   public:
 
-    TypedOrValueRegister()
-      : type_(MIRType_None)
-    {}
+    TypedOrValueRegister() = default;
 
     TypedOrValueRegister(MIRType type, AnyRegister reg)
       : type_(type)
     {
-        dataTyped() = reg;
+        data.typed = reg;
     }
 
     MOZ_IMPLICIT TypedOrValueRegister(ValueOperand value)
       : type_(MIRType_Value)
     {
-        dataValue() = value;
+        data.value = value;
     }
 
     MIRType type() const {
@@ -220,11 +198,13 @@ class TypedOrValueRegister
     }
 
     AnyRegister typedReg() const {
-        return dataTyped();
+        MOZ_ASSERT(hasTyped());
+        return data.typed;
     }
 
     ValueOperand valueReg() const {
-        return dataValue();
+        MOZ_ASSERT(hasValue());
+        return data.value;
     }
 
     AnyRegister scratchReg() {
@@ -240,19 +220,18 @@ class ConstantOrRegister
     // Whether a constant value is being stored.
     bool constant_;
 
-    // Space to hold either a Value or a TypedOrValueRegister.
     union U {
-        mozilla::AlignedStorage2<Value> constant;
-        mozilla::AlignedStorage2<TypedOrValueRegister> reg;
+        Value constant;
+        TypedOrValueRegister reg;
     } data;
 
     Value& dataValue() {
         MOZ_ASSERT(constant());
-        return *data.constant.addr();
+        return data.constant;
     }
     TypedOrValueRegister& dataReg() {
         MOZ_ASSERT(!constant());
-        return *data.reg.addr();
+        return data.reg;
     }
 
   public:
diff -Naurp mozjs-38.0.0.orig/js/src/Makefile.in mozjs-38.0.0/js/src/Makefile.in
--- mozjs-38.0.0.orig/js/src/Makefile.in	2015-09-17 15:12:18.000000000 -0500
+++ mozjs-38.0.0/js/src/Makefile.in	2017-04-01 19:31:59.961994157 -0500
@@ -208,10 +208,13 @@ endif
 SCRIPTS = $(JS_CONFIG_NAME)
 SDK_BINARY = $(JS_CONFIG_NAME)
 
-$(LIBRARY_NAME).pc: js.pc
+$(JS_CONFIG_NAME): js-config
 	cp $^ $@
 
-install:: $(LIBRARY_NAME).pc
+$(JS_LIBRARY_NAME).pc: js.pc
+	cp $^ $@
+
+install:: $(JS_LIBRARY_NAME).pc
 	$(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
 
 install:: js-config.h
