From ca0837cc70d5b4d3fce83b34c31b3378f60f4498 Mon Sep 17 00:00:00 2001 From: Pierre Langlois Date: Mon, 17 Jan 2022 18:54:50 +0000 Subject: 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 --- nongnu/packages/mozilla.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'nongnu') diff --git a/nongnu/packages/mozilla.scm b/nongnu/packages/mozilla.scm index 19a682d..8c378cb 100644 --- a/nongnu/packages/mozilla.scm +++ b/nongnu/packages/mozilla.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2021 pineapples ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021 John Kehayias +;;; Copyright © 2022 Pierre Langlois ;;; ;;; This file is not part of GNU Guix. ;;; @@ -78,6 +79,7 @@ #:use-module (gnu packages rust-apps) #:use-module (gnu packages sqlite) #:use-module (gnu packages video) + #:use-module (nongnu packages wasm) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg)) @@ -99,7 +101,9 @@ (build-system gnu-build-system) (arguments `(#: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" ;; Configuration @@ -119,6 +123,7 @@ clang "/bin/clang") ,(string-append "--with-libclang-path=" clang "/lib") + ,(string-append "--with-wasi-sysroot=" wasi-sysroot "/wasm32-wasi") ;; Distribution "--with-distribution-id=org.nonguix" @@ -129,8 +134,6 @@ "--disable-updater" "--enable-pulseaudio" "--disable-crashreporter" - ;; TODO: requires some work - "--without-wasm-sandboxed-libraries" ;; Build details "--disable-debug" @@ -230,6 +233,14 @@ (setenv "NM" "llvm-nm") (setenv "CC" "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") ;; Firefox will write the timestamp to output, which is harmful for @@ -396,6 +407,7 @@ ("cargo" ,rust "cargo") ("clang" ,clang-10) ("llvm" ,llvm-10) + ("wasm32-wasi-clang-toolchain" ,wasm32-wasi-clang-toolchain) ("m4" ,m4) ("nasm" ,nasm) ("node" ,node) -- cgit v1.2.3