emscripten: 3.1.24 -> 3.1.39

This commit is contained in:
Will Cohen 2023-05-19 13:13:17 -04:00
parent fc3db34b51
commit 39d2924769
3 changed files with 21 additions and 28 deletions

View file

@ -1,4 +1,4 @@
From 67f54fde2b1683aae3800f7a86a4e507c1125be8 Mon Sep 17 00:00:00 2001
From 4bbbb640934aa653bcfec0335798b77a8935b815 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
@ -20,23 +20,23 @@ but it doesn't appear to work
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/emcc.py b/emcc.py
index 999314afc..0e23c066c 100755
index ba8d1b556..7d89644c5 100755
--- a/emcc.py
+++ b/emcc.py
@@ -759,7 +759,12 @@ def emsdk_ldflags(user_args):
@@ -883,7 +883,12 @@ def parse_s_args(args):
def emsdk_cflags(user_args):
- cflags = ['--sysroot=' + shared.Cache.get_sysroot(absolute=True)]
- cflags = ['--sysroot=' + cache.get_sysroot(absolute=True)]
+ cflags = [
+ '--sysroot=' + shared.Cache.get_sysroot(absolute=True),
+ '--sysroot=' + cache.get_sysroot(absolute=True),
+ '-resource-dir=@resourceDir@',
+ '-idirafter' + shared.Cache.get_sysroot(absolute=True) + os.path.join('/include'),
+ '-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:
--
2.32.0
2.40.0

View file

@ -8,7 +8,7 @@
stdenv.mkDerivation rec {
pname = "emscripten";
version = "3.1.24";
version = "3.1.39";
llvmEnv = symlinkJoin {
name = "emscripten-llvm-${version}";
@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
name = "emscripten-node-modules-${version}";
inherit pname version src;
npmDepsHash = "sha256-ejuHR2BpAUStWjuvQuGE6ko4byF4GBl6FJBshxlknQk=";
npmDepsHash = "sha256-NSpVXssXwx+94E1qhM3tt2fN2G0EuvPZSN+Xep2IRs8=";
dontBuild = true;
@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "emscripten-core";
repo = "emscripten";
sha256 = "sha256-1jW6ThxK6dThOO90l4Mc5yehVF3tI4HWipBWZAOztrk=";
sha256 = "sha256-hgndNMx+hvXyLzn6ip8Fhs+LAw98P3cqL8dJ+92jJmU=";
rev = version;
};
@ -42,17 +42,7 @@ stdenv.mkDerivation rec {
patches = [
(substituteAll {
src = ./0001-emulate-clang-sysroot-include-logic.patch;
resourceDir = "${llvmEnv}/lib/clang/${llvmPackages.release_version}/";
})
# https://github.com/emscripten-core/emscripten/pull/18219
(fetchpatch {
url = "https://github.com/emscripten-core/emscripten/commit/afbc14950f021513c59cbeaced8807ef8253530a.patch";
sha256 = "sha256-+gJNTQJng9rWcGN3GAcMBB0YopKPnRp/r8CN9RSTClU=";
})
# https://github.com/emscripten-core/emscripten/pull/18220
(fetchpatch {
url = "https://github.com/emscripten-core/emscripten/commit/852982318f9fb692ba1dd1173f62e1eb21ae61ca.patch";
sha256 = "sha256-hmIOtpRx3PD3sDAahUcreSydydqcdSqArYvyLGgUgd8=";
resourceDir = "${llvmEnv}/lib/clang/16/";
})
];
@ -108,17 +98,20 @@ stdenv.mkDerivation rec {
# precompile libc (etc.) in all variants:
pushd $TMPDIR
echo 'int __main_argc_argv() { return 42; }' >test.c
echo 'int __main_argc_argv( int a, int b ) { return 42; }' >test.c
for LTO in -flto ""; do
# wasm2c doesn't work with PIC
$out/bin/emcc -s WASM2C -s STANDALONE_WASM $LTO test.c
for BIND in "" "--bind"; do
for MT in "" "-s USE_PTHREADS"; do
for RELOCATABLE in "" "-s RELOCATABLE"; do
$out/bin/emcc $RELOCATABLE $BIND $MT $LTO test.c
done
done
# starting with emscripten 3.1.32+,
# if pthreads and relocatable are both used,
# _emscripten_thread_exit_joinable must be exported
# (see https://github.com/emscripten-core/emscripten/pull/18376)
# 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
done
done
popd

View file

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