emscripten: 3.1.24 -> 3.1.41

This commit is contained in:
Will Cohen 2023-06-02 12:28:40 -04:00
parent 1850284e03
commit 0761348e91
3 changed files with 22 additions and 35 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

@ -1,14 +1,14 @@
{ lib, stdenv, fetchFromGitHub, python3, nodejs, closurecompiler
, jre, binaryen
, llvmPackages
, symlinkJoin, makeWrapper, substituteAll, fetchpatch
, symlinkJoin, makeWrapper, substituteAll
, buildNpmPackage
, emscripten
}:
stdenv.mkDerivation rec {
pname = "emscripten";
version = "3.1.24";
version = "3.1.41";
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-QlKm6UvPUa7+VJ9ZvXdxYZzK+U96Ju/oAHPhZ/hyv/I=";
dontBuild = true;
@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "emscripten-core";
repo = "emscripten";
sha256 = "sha256-1jW6ThxK6dThOO90l4Mc5yehVF3tI4HWipBWZAOztrk=";
sha256 = "sha256-yQZrAQfNZZd65a14AFObrLrBzePBDnK0J87oTEB1Dcw=";
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/";
})
];
@ -68,9 +58,6 @@ stdenv.mkDerivation rec {
sed -i '/^def/!s/root_is_writable()/True/' tools/config.py
sed -i "/^def check_sanity/a\\ return" tools/shared.py
# required for wasm2c
ln -s ${nodeModules} node_modules
echo "EMSCRIPTEN_ROOT = '$out/share/emscripten'" > .emscripten
echo "LLVM_ROOT = '${llvmEnv}/bin'" >> .emscripten
echo "NODE_JS = '${nodejs}/bin/node'" >> .emscripten
@ -108,17 +95,17 @@ 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

@ -7385,7 +7385,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 { });