nongnu: firefox: Enable WebAssembly sandboxed libraries.

* nongnu/packages/mozilla.scm (firefox)[arguments]: Pass --with-wasi-sysroot
to configure.  Set WASM_CC and WASM_CXX to wasm32-wasi-clang-toolchain.
[native-inputs]: Add wasm32-wasi-clang-toolchain.

Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
Pierre Langlois 2022-01-17 18:54:50 +00:00 committed by Jonathan Brielmaier
parent 4124d9c693
commit ca0837cc70
No known key found for this signature in database
GPG key ID: ECFC83988B4E4B9F

View file

@ -19,6 +19,7 @@
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com> ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com> ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com>
;;; ;;;
;;; This file is not part of GNU Guix. ;;; This file is not part of GNU Guix.
;;; ;;;
@ -78,6 +79,7 @@
#:use-module (gnu packages rust-apps) #:use-module (gnu packages rust-apps)
#:use-module (gnu packages sqlite) #:use-module (gnu packages sqlite)
#:use-module (gnu packages video) #:use-module (gnu packages video)
#:use-module (nongnu packages wasm)
#:use-module (gnu packages xdisorg) #:use-module (gnu packages xdisorg)
#:use-module (gnu packages xorg)) #:use-module (gnu packages xorg))
@ -99,7 +101,9 @@
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:configure-flags `(#:configure-flags
(let ((clang (assoc-ref %build-inputs "clang"))) (let ((clang (assoc-ref %build-inputs "clang"))
(wasi-sysroot (assoc-ref %build-inputs
"wasm32-wasi-clang-toolchain")))
`("--enable-application=browser" `("--enable-application=browser"
;; Configuration ;; Configuration
@ -119,6 +123,7 @@
clang "/bin/clang") clang "/bin/clang")
,(string-append "--with-libclang-path=" ,(string-append "--with-libclang-path="
clang "/lib") clang "/lib")
,(string-append "--with-wasi-sysroot=" wasi-sysroot "/wasm32-wasi")
;; Distribution ;; Distribution
"--with-distribution-id=org.nonguix" "--with-distribution-id=org.nonguix"
@ -129,8 +134,6 @@
"--disable-updater" "--disable-updater"
"--enable-pulseaudio" "--enable-pulseaudio"
"--disable-crashreporter" "--disable-crashreporter"
;; TODO: requires some work
"--without-wasm-sandboxed-libraries"
;; Build details ;; Build details
"--disable-debug" "--disable-debug"
@ -230,6 +233,14 @@
(setenv "NM" "llvm-nm") (setenv "NM" "llvm-nm")
(setenv "CC" "clang") (setenv "CC" "clang")
(setenv "CXX" "clang++") (setenv "CXX" "clang++")
(setenv "WASM_CC"
(string-append
(assoc-ref inputs "wasm32-wasi-clang-toolchain")
"/bin/clang"))
(setenv "WASM_CXX"
(string-append
(assoc-ref inputs "wasm32-wasi-clang-toolchain")
"/bin/clang++"))
(setenv "MOZ_NOSPAM" "1") (setenv "MOZ_NOSPAM" "1")
;; Firefox will write the timestamp to output, which is harmful for ;; Firefox will write the timestamp to output, which is harmful for
@ -396,6 +407,7 @@
("cargo" ,rust "cargo") ("cargo" ,rust "cargo")
("clang" ,clang-10) ("clang" ,clang-10)
("llvm" ,llvm-10) ("llvm" ,llvm-10)
("wasm32-wasi-clang-toolchain" ,wasm32-wasi-clang-toolchain)
("m4" ,m4) ("m4" ,m4)
("nasm" ,nasm) ("nasm" ,nasm)
("node" ,node) ("node" ,node)