guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] gnu: Add mozjs-38.


From: ng0
Subject: [PATCH 1/3] gnu: Add mozjs-38.
Date: Fri, 30 Dec 2016 18:04:48 +0000

From: ng0 <address@hidden>

* gnu/packages/gnuzilla.scm (mozjs-38): New variable.
---
 gnu/packages/gnuzilla.scm | 123 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 07ed2af0b..4ad4218eb 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2015 Sou Bunnbu <address@hidden>
 ;;; Copyright © 2016 Efraim Flashner <address@hidden>
 ;;; Copyright © 2016 Alex Griffin <address@hidden>
+;;; Copyright © 2016 ng0 <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,6 +41,7 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages readline)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages libevent)
@@ -149,6 +151,127 @@ in C/C++.")
      `(("libffi" ,libffi)
        ("zlib" ,zlib)))))
 
+(define-public mozjs-38
+  (package (inherit mozjs)
+    (name "mozjs")
+    (version "38.2.1.rc0")
+    (source (origin
+              (method url-fetch)
+              (uri (list
+                    ;; The upstream server at people.mozilla.org produces
+                    ;; a tls handshake error, the file at people.freebsd.org
+                    ;; is identical and produces no such error.
+                    (string-append
+                     "https://people.freebsd.org/~sunpoet/distfiles/";
+                     name "-" version ".tar.bz2")
+                    ;; XXX: The upstream server at people.mozilla.org
+                    ;; TODO: Use revision control system checkout?
+                    (string-append
+                     "https://people.mozilla.org/~sstangl/";
+                     name "-" version ".tar.bz2")))
+              ;; TODO: Unbundle icu ("intl" dir)
+              (sha256
+               (base32
+                "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))))
+    (arguments
+     `(;; XXX: parallel build fails, lacking:
+       ;;   mkdir -p "system_wrapper_js/"
+       ;; #:parallel-build? #f
+       ;; Tests fail due to missing module 'xpt':
+       ;; ImportError: No module named xpt
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (chdir "js/src")
+               ;; configure fails if it is followed by SHELL and CONFIG_SHELL
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+               (setenv "LIBXUL_DIST" (assoc-ref %outputs "out"))
+               ;; TODO: Use exact version, if we leave this empty it
+               ;; will be empty in the .pc file.
+               ;; (setenv "MOZILLA_VERSION" "38.2.1")
+               ;; (setenv "MOZJS_MAJOR_VERSION" "38")
+               ;; (setenv "MOZJS_MINOR_VERSION" "2")
+               ;; (setenv "MOZJS_PATCH_VERSION" "1")
+               ;;
+               ;; (substitute* "js.pc.in"
+               ;;   ;;(("@MOZILLA_VERSION@") "38.2.1"))
+               ;;   (("@MOZILLA_VERSION@") "38.0.0"))
+               (zero? (system* "./configure"
+                               (string-append "--prefix=" out)
+                               "--with-system-nspr"
+                               "--enable-system-ffi"
+                               "--enable-threadsafe"
+                               "--with-system-icu"
+                               "--with-system-zlib"
+                               "--enable-readline"
+
+                               ;; These are required by 0ad and they may
+                               ;; or may not be good defaults for other
+                               ;; uses.
+                               "--enable-gcgenerational"
+                               "--enable-shared-js")))))
+         (add-after 'install 'fix-header-symlinks
+           ;; The headers are symlinks to a directory that does not
+           ;; get put into the store location, so they end up broken.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (inc (string-append out "/include/mozjs-"))
+                    (incjs (string-append inc "/js"))
+                    (moz (string-append inc "/mozilla")))
+               ;; TODO: for-each
+               (chdir "../..") ; Change to root of build directory
+               (delete-file-recursively incjs)
+               (copy-recursively "js/public/" incjs)
+               ;; Remove stuff we don't need:
+               (delete-file-recursively moz)
+               (copy-recursively "mfbt" moz)
+               (delete-file (string-append inc "/jsalloc.h"))
+               (delete-file (string-append inc "/jsapi.h"))
+               (delete-file (string-append inc "/jsbytecode.h"))
+               (delete-file (string-append inc "/jsclist.h"))
+               (delete-file (string-append inc "/jscpucfg.h"))
+               (delete-file (string-append inc "/jsfriendapi.h"))
+               (delete-file (string-append inc "/js.msg"))
+               (delete-file (string-append inc "/jsperf.h"))
+               (delete-file (string-append inc "/jsprf.h"))
+               (delete-file (string-append inc "/jsprototypes.h"))
+               (delete-file (string-append inc "/jspubtd.h"))
+               (delete-file (string-append inc "/jstypes.h"))
+               (delete-file (string-append inc "/jsversion.h"))
+               (delete-file (string-append inc "/jswrapper.h"))
+               (install-file "js/src/jsalloc.h" inc)
+               (install-file "js/src/jsapi.h" inc)
+               (install-file "js/src/jsbytecode.h" inc)
+               (install-file "js/src/jsclist.h" inc)
+               (install-file "js/src/jscpucfg.h" inc)
+               (install-file "js/src/jsfriendapi.h" inc)
+               (install-file "js/src/js.msg" inc)
+               (install-file "js/src/perf/jsperf.h" inc)
+               (install-file "js/src/jsprf.h" inc)
+               (install-file "js/src/jsprototypes.h" inc)
+               (install-file "js/src/jspubtd.h" inc)
+               (install-file "js/src/jstypes.h" inc)
+               (install-file "js/src/jsversion.h" inc)
+               (install-file "js/src/jswrapper.h" inc)
+               (delete-file-recursively (string-append moz "/decimal"))
+               (delete-file-recursively (string-append moz "/tests"))
+               (delete-file-recursively (string-append moz 
"/double-conversion"))))))))
+    (native-inputs
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python-2" ,python-2)))
+    (propagated-inputs
+     `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-24.pc
+    (inputs
+     `(("libffi" ,libffi)
+       ("readline" ,readline)
+       ("icu4c" ,icu4c)
+       ("zlib" ,zlib)))))
+
 (define-public nspr
   (package
     (name "nspr")
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]