emscripten: 3.1.47 -> 3.1.50

This commit is contained in:
Will Cohen 2023-11-25 09:11:57 -05:00
parent a4daad0caa
commit c4a686bcb7
3 changed files with 26 additions and 23 deletions

View file

@ -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

View file

@ -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

View file

@ -7943,7 +7943,7 @@ with pkgs;
easeprobe = callPackage ../tools/misc/easeprobe { };
emscripten = callPackage ../development/compilers/emscripten {
llvmPackages = llvmPackages_16;
llvmPackages = llvmPackages_17;
};
emscriptenPackages = recurseIntoAttrs (callPackage ./emscripten-packages.nix { });