Commit 5f9599e0 authored by Will Cohen's avatar Will Cohen
Browse files

emscripten: 4.0.12 -> 4.0.21

parent f5b4ad51
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
From 86fc9ce2b381748813b372f7e86909be6f955cbd Mon Sep 17 00:00:00 2001
From 0a1c3a87ff80f8295bc60624a4e354a9ee6c181d 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,14 +16,14 @@ 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 | 3 +++
 tools/compile.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/emcc.py b/emcc.py
index 279f6d4d9..26e20e2cc 100644
--- a/emcc.py
+++ b/emcc.py
@@ -400,6 +400,9 @@ def get_cflags(user_args, is_cxx):
diff --git a/tools/compile.py b/tools/compile.py
index 0cc5d33e3..e2586db0e 100644
--- a/tools/compile.py
+++ b/tools/compile.py
@@ -86,6 +86,9 @@ def get_cflags(user_args):
   # 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))
@@ -34,5 +34,5 @@ index 279f6d4d9..26e20e2cc 100644
   if settings.EMSCRIPTEN_TRACING:
     cflags.append('-D__EMSCRIPTEN_TRACING__=1')
-- 
2.42.0
2.51.0
+17 −16
Original line number Diff line number Diff line
@@ -15,9 +15,13 @@
  emscripten,
}:

let
  pythonWithPsutil = python3.withPackages (ps: [ ps.psutil ]);
in

stdenv.mkDerivation rec {
  pname = "emscripten";
  version = "4.0.12";
  version = "4.0.21";

  llvmEnv = symlinkJoin {
    name = "emscripten-llvm-${version}";
@@ -33,7 +37,7 @@ stdenv.mkDerivation rec {
    name = "emscripten-node-modules-${version}";
    inherit pname version src;

    npmDepsHash = "sha256-Pos7pSboTIpGKtlBm56hJPYb1lDydmUwW1urHetFfeQ=";
    npmDepsHash = "sha256-IwiH+GELJzd4rDq31arhiF5miIRLDe7nrVsM7Yg9rTg=";

    dontBuild = true;

@@ -46,7 +50,7 @@ stdenv.mkDerivation rec {
  src = fetchFromGitHub {
    owner = "emscripten-core";
    repo = "emscripten";
    hash = "sha256-MwCUilfyum1yJb6nHEViYiYWufXlz2+krHZmXw2NAck=";
    hash = "sha256-8lh7ZpzVnoQXOGE/xJgHSWkYXUDOOprbSGaEkyU+vKE=";
    rev = version;
  };

@@ -116,31 +120,28 @@ stdenv.mkDerivation rec {
    export EM_CACHE=$out/share/emscripten/cache

    mkdir -p $out/bin
    for b in em++ em-config emar embuilder.py emcc emcmake emconfigure emmake emranlib emrun emscons emsize; do
    for b in em++ emcc; do
      makeWrapper $appdir/$b $out/bin/$b \
        --set NODE_PATH ${nodeModules} \
        --set EM_EXCLUSIVE_CACHE_ACCESS 1 \
        --set PYTHON ${python3}/bin/python \
        --run "source $appdir/locate_cache.sh"
    done
    for b in em-config emar embuilder emcmake emconfigure emmake emranlib emrun emscons emsize; do
      chmod +x $appdir/$b.py
      makeWrapper $appdir/$b.py $out/bin/$b \
        --set NODE_PATH ${nodeModules} \
        --set EM_EXCLUSIVE_CACHE_ACCESS 1 \
        --set PYTHON ${python3}/bin/python \
        --run "source $appdir/locate_cache.sh"
    done

    # precompile libc (etc.) in all variants:
    pushd $TMPDIR
    echo 'int __main_argc_argv( int a, int b ) { return 42; }' >test.c
    for LTO in -flto ""; do
      for BIND in "" "--bind"; do
        # 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
        # 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
@@ -148,7 +149,7 @@ stdenv.mkDerivation rec {
    export PYTHON=${python3}/bin/python
    export NODE_PATH=${nodeModules}
    pushd $appdir
    python test/runner.py test_hello_world
    ${pythonWithPsutil}/bin/python test/runner.py test_hello_world
    popd

    runHook postInstall