summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2017-03-27 16:19:39 +0300
committerEfraim Flashner <efraim@flashner.co.il>2017-03-28 09:34:53 +0300
commita64b7da5133b1b0f70ba873cab9b3bebfd84a58e (patch)
tree0cc74abde1eab4cf98ef90f6e2c7f4bd6ef4b599 /gnu
parent26f38d313bd4ccece05610f762612daa0746dd44 (diff)
downloadguix-a64b7da5133b1b0f70ba873cab9b3bebfd84a58e.tar.gz
gnu: mozjs@17: Add support for aarch64-linux.
* gnu/packages/gnuzilla.scm (mozjs@17)[source]: Add patch.
[arguments]: Add phase deleting slow test, add configure argument for
building on aarch64-linux.
* gnu/packages/patches/mozjs17-aarch64-support.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/gnuzilla.scm12
-rw-r--r--gnu/packages/patches/mozjs17-aarch64-support.patch60
3 files changed, 71 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 9231870a94..44462e4f5e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -767,6 +767,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/mpc123-initialize-ao.patch		\
   %D%/packages/patches/mplayer2-theora-fix.patch		\
   %D%/packages/patches/module-init-tools-moduledir.patch	\
+  %D%/packages/patches/mozjs17-aarch64-support.patch		\
   %D%/packages/patches/mozjs24-aarch64-support.patch		\
   %D%/packages/patches/multiqc-fix-git-subprocess-error.patch	\
   %D%/packages/patches/mumps-build-parallelism.patch		\
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 5c892f197a..2586cf60f4 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -69,6 +69,7 @@
              (sha256
               (base32
                "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
+             (patches (search-patches "mozjs17-aarch64-support.patch"))
              (modules '((guix build utils)))
              (snippet
               ;; Fix incompatibility with Perl 5.22+.
@@ -83,6 +84,9 @@
         ;;   mkdir -p "system_wrapper_js/"
         #:parallel-build? #f
         #:phases
+         (alist-cons-after 'unpack 'delete-timedout-test
+           ;; This test times out on slower hardware.
+           (lambda _ (delete-file "js/src/jit-test/tests/basic/bug698584.js"))
           (alist-cons-before
            'configure 'chdir
            (lambda _
@@ -95,8 +99,12 @@
                 (setenv "SHELL" (which "sh"))
                 (setenv "CONFIG_SHELL" (which "sh"))
                 (zero? (system*
-                        "./configure" (string-append "--prefix=" out)))))
-            %standard-phases))))
+                        "./configure" (string-append "--prefix=" out)
+                                      ,@(if (string=? "aarch64-linux"
+                                                      (%current-system))
+                                          '("--host=aarch64-unknown-linux-gnu")
+                                          '())))))
+            %standard-phases)))))
     (home-page
      "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
     (synopsis "Mozilla javascript engine")
diff --git a/gnu/packages/patches/mozjs17-aarch64-support.patch b/gnu/packages/patches/mozjs17-aarch64-support.patch
new file mode 100644
index 0000000000..51e2e306d5
--- /dev/null
+++ b/gnu/packages/patches/mozjs17-aarch64-support.patch
@@ -0,0 +1,60 @@
+https://build.opensuse.org/package/view_file/openSUSE:Factory/mozjs17/mozjs-aarch64-support.patch
+
+index c071c33..90764c3 100644
+--- a/js/src/assembler/jit/ExecutableAllocator.h
++++ b/js/src/assembler/jit/ExecutableAllocator.h
+@@ -382,6 +382,12 @@ public:
+     {
+         reprotectRegion(start, size, Executable);
+     }
++#elif WTF_CPU_AARCH64 && WTF_PLATFORM_LINUX
++    static void cacheFlush(void* code, size_t size)
++    {
++        intptr_t end = reinterpret_cast<intptr_t>(code) + size;
++        __builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end));
++    }
+ #else
+     static void makeWritable(void*, size_t) {}
+     static void makeExecutable(void*, size_t) {}
+diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h
+index 0c84896..e8763a7 100644
+--- a/js/src/assembler/wtf/Platform.h
++++ b/js/src/assembler/wtf/Platform.h
+@@ -325,6 +325,10 @@
+ #define WTF_THUMB_ARCH_VERSION 0
+ #endif
+ 
++/* CPU(AArch64) - 64-bit ARM */
++#if defined(__aarch64__)
++#define WTF_CPU_AARCH64 1
++#endif
+ 
+ /* WTF_CPU_ARMV5_OR_LOWER - ARM instruction set v5 or earlier */
+ /* On ARMv5 and below the natural alignment is required. 
+diff --git a/js/src/configure.in b/js/src/configure.in
+index 15605b2..19fd704 100644
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -1121,6 +1121,10 @@ arm*)
+     CPU_ARCH=arm
+     ;;
+ 
++aarch64)
++    CPU_ARCH=aarch64
++    ;;
++
+ mips|mipsel)
+     CPU_ARCH=&quot;mips&quot;
+     ;;
+diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
+index 0eec2d9..fe26dab 100644
+--- a/mfbt/double-conversion/utils.h
++++ b/mfbt/double-conversion/utils.h
+@@ -58,6 +58,7 @@
+     defined(__mips__) || defined(__powerpc__) || \
+     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
+     defined(__SH4__) || defined(__alpha__) || \
++    defined(__aarch64__) || \
+     defined(_MIPS_ARCH_MIPS32R2)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+ #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)