Skip to content

Instantly share code, notes, and snippets.

@satori99
Created June 5, 2021 03:10
Show Gist options
  • Save satori99/167928e4029a47fb2eea29a3fd6735cc to your computer and use it in GitHub Desktop.
Save satori99/167928e4029a47fb2eea29a3fd6735cc to your computer and use it in GitHub Desktop.

Revisions

  1. satori99 created this gist Jun 5, 2021.
    26 changes: 26 additions & 0 deletions meson-emscripten.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
    From: Kleis Auke Wolthuizen <[email protected]>
    Date: Sat, 31 Oct 2020 13:40:00 +0100
    Subject: [PATCH 1/1] Prefer -pthread over -s USE_PTHREADS=1

    See https://github.com/emscripten-core/emscripten/issues/12346

    Upstream-Status: Pending

    diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py
    index 1111111..2222222 100644
    --- a/mesonbuild/compilers/mixins/emscripten.py
    +++ b/mesonbuild/compilers/mixins/emscripten.py
    @@ -47,10 +47,10 @@ class EmscriptenMixin(Compiler):
    return os.path.join(dirname, 'output.' + suffix)

    def thread_flags(self, env: 'Environment') -> T.List[str]:
    - return ['-s', 'USE_PTHREADS=1']
    + return ['-pthread']

    def thread_link_flags(self, env: 'Environment') -> T.List[str]:
    - args = ['-s', 'USE_PTHREADS=1']
    + args = ['-pthread']
    count: int = env.coredata.options[OptionKey('thread_count', lang=self.language, machine=self.for_machine)].value
    if count:
    args.extend(['-s', f'PTHREAD_POOL_SIZE={count}'])