GNU bug report logs -
#77653
[PATCH 0/4] Add WASM toolchain, wasi-libc, and browser WASM sandbox support
Previous Next
Full log
Message #17 received at 77653 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/gnuzilla.scm (wasm-sandboxed): New variable.
Change-Id: I568e6cb9aca43122a06f46fd3a8d9a462754c36a
---
gnu/packages/gnuzilla.scm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index f4a912d8d5..32b2d13de5 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -99,8 +99,38 @@ (define-module (gnu packages gnuzilla)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages readline)
#:use-module (gnu packages sqlite)
+ #:use-module (gnu packages wasm)
#:autoload (json parser) (json->scm))
+(define-public (wasm-sandboxed orig-package)
+ "Given a Firefox or Firefox-derived package ORIG-PACKAGE, return a
+variant package which enables WASM sandboxing."
+ (package
+ (inherit orig-package)
+ (name (string-append (package-name orig-package) "-wasm-sandboxed"))
+ (arguments
+ (substitute-keyword-arguments (package-arguments orig-package)
+ ((#:configure-flags flags)
+ #~(let ((wasi-sysroot #$(this-package-native-input "wasm32-wasi-clang-toolchain")))
+ (append (delq "--without-wasm-sandboxed-libraries" #$flags)
+ (list
+ (string-append "--with-wasi-sysroot=" wasi-sysroot "/wasm32-wasi")))))
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (add-before 'configure 'set-wasm-env
+ (lambda* (#:key inputs #:allow-other-keys)
+ (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++"))))))))
+ (native-inputs
+ (modify-inputs (package-native-inputs orig-package)
+ (append wasm32-wasi-clang-toolchain)))))
+
(define-public mozjs
(package
(name "mozjs")
--
2.49.0
This bug report was last modified 43 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.