summaryrefslogtreecommitdiffstats
path: root/pkgs/development/compilers/emscripten
diff options
context:
space:
mode:
authorWill Cohen <willcohen@users.noreply.github.com>2023-11-25 09:11:57 -0500
committerWill Cohen <willcohen@users.noreply.github.com>2023-12-11 11:48:50 -0500
commitc4a686bcb7952c76e1c0b7d0e4f5317b7db2814d (patch)
tree605721bb9c132842e844fb1fb39e142cc9e71eea /pkgs/development/compilers/emscripten
parenta4daad0caa880988d181f9af214699fd4f2f3dad (diff)
emscripten: 3.1.47 -> 3.1.50
Diffstat (limited to 'pkgs/development/compilers/emscripten')
-rw-r--r--pkgs/development/compilers/emscripten/0001-emulate-clang-sysroot-include-logic.patch32
-rw-r--r--pkgs/development/compilers/emscripten/default.nix15
2 files changed, 25 insertions, 22 deletions
diff --git a/pkgs/development/compilers/emscripten/0001-emulate-clang-sysroot-include-logic.patch b/pkgs/development/compilers/emscripten/0001-emulate-clang-sysroot-include-logic.patch
index 6a57e423bd72..4171906d5e36 100644
--- a/pkgs/development/compilers/emscripten/0001-emulate-clang-sysroot-include-logic.patch
+++ b/pkgs/development/compilers/emscripten/0001-emulate-clang-sysroot-include-logic.patch
@@ -1,4 +1,4 @@
-From 4bbbb640934aa653bcfec0335798b77a8935b815 Mon Sep 17 00:00:00 2001
+From 86fc9ce2b381748813b372f7e86909be6f955cbd Mon Sep 17 00:00:00 2001
From: Yureka <yuka@yuka.dev>
Date: Sat, 7 Aug 2021 09:16:46 +0200
Subject: [PATCH] emulate clang 'sysroot + /include' logic
@@ -16,27 +16,23 @@ in the include search order, right after the resource root.
Hence usage of -idirafter. Clang also documents an -isystem-after flag
but it doesn't appear to work
---
- emcc.py | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
+ emcc.py | 3 +++
+ 1 file changed, 3 insertions(+)
diff --git a/emcc.py b/emcc.py
-index ba8d1b556..7d89644c5 100755
+index 279f6d4d9..26e20e2cc 100644
--- a/emcc.py
+++ b/emcc.py
-@@ -883,7 +883,12 @@ def parse_s_args(args):
+@@ -400,6 +400,9 @@ def get_cflags(user_args, is_cxx):
+ # We add these to the user's flags (newargs), but not when building .s or .S assembly files
+ cflags = get_clang_flags(user_args)
+ cflags.append('--sysroot=' + cache.get_sysroot(absolute=True))
++ cflags.append('-resource-dir=@resourceDir@')
++ cflags.append('-idirafter' + cache.get_sysroot(absolute=True) + os.path.join('/include'))
++ cflags.append('-iwithsysroot' + os.path.join('/include','c++','v1'))
-
- def emsdk_cflags(user_args):
-- cflags = ['--sysroot=' + cache.get_sysroot(absolute=True)]
-+ cflags = [
-+ '--sysroot=' + cache.get_sysroot(absolute=True),
-+ '-resource-dir=@resourceDir@',
-+ '-idirafter' + cache.get_sysroot(absolute=True) + os.path.join('/include'),
-+ '-iwithsysroot' + os.path.join('/include','c++','v1')
-+ ]
-
- def array_contains_any_of(hay, needles):
- for n in needles:
+ if settings.EMSCRIPTEN_TRACING:
+ cflags.append('-D__EMSCRIPTEN_TRACING__=1')
--
-2.40.0
+2.42.0
diff --git a/pkgs/development/compilers/emscripten/default.nix b/pkgs/development/compilers/emscripten/default.nix
index 01fa67520593..1f8d2f55da34 100644
--- a/pkgs/development/compilers/emscripten/default.nix
+++ b/pkgs/development/compilers/emscripten/default.nix
@@ -8,7 +8,7 @@
stdenv.mkDerivation rec {
pname = "emscripten";
- version = "3.1.47";
+ version = "3.1.50";
llvmEnv = symlinkJoin {
name = "emscripten-llvm-${version}";
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "emscripten-core";
repo = "emscripten";
- hash = "sha256-cRNkQ+7vUqJLNlf5dieeDcyT1jlBUeVxO8avoUvOPHI=";
+ hash = "sha256-iFZF+DxGaq279QPPugoLhYmoXmyLPkmn1x4rBCkdW+I=";
rev = version;
};
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
patches = [
(substituteAll {
src = ./0001-emulate-clang-sysroot-include-logic.patch;
- resourceDir = "${llvmEnv}/lib/clang/16/";
+ resourceDir = "${llvmEnv}/lib/clang/17/";
})
];
@@ -51,6 +51,9 @@ stdenv.mkDerivation rec {
patchShebangs .
+ # emscripten 3.1.50 requires LLVM tip-of-tree instead of LLVM 17
+ sed -i -e "s/EXPECTED_LLVM_VERSION = 18/EXPECTED_LLVM_VERSION = 17.0/g" tools/shared.py
+
# fixes cmake support
sed -i -e "s/print \('emcc (Emscript.*\)/sys.stderr.write(\1); sys.stderr.flush()/g" emcc.py
@@ -106,7 +109,11 @@ stdenv.mkDerivation rec {
# TODO: get library cache to build with both enabled and function exported
$out/bin/emcc $LTO $BIND test.c
$out/bin/emcc $LTO $BIND -s RELOCATABLE test.c
- $out/bin/emcc $LTO $BIND -s USE_PTHREADS test.c
+ # starting with emscripten 3.1.48+,
+ # to use pthreads, _emscripten_check_mailbox must be exported
+ # (see https://github.com/emscripten-core/emscripten/pull/20604)
+ # TODO: get library cache to build with pthreads at all
+ # $out/bin/emcc $LTO $BIND -s USE_PTHREADS test.c
done
done
popd