Regenerate //debian:emscripten_toolchain.patch
For some reason the newer bazel version fails to apply the emscripten
toolchain patch. Maybe they changed their patch tool or something.
Either way, I re-generated the patch here so that newer bazel applies
it without complaints.
The order of files within the patch is different, but it looks to be
functionally equivalent to what was there before.
Change-Id: I578ae6845b1074966cc71391fac3400102ae160f
diff --git a/WORKSPACE b/WORKSPACE
index dfe5a02..4d2f666 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -596,6 +596,7 @@
# TODO(james): Once a functioning release contains this patch, convert
# to that. See https://github.com/emscripten-core/emscripten/pull/9048
patches = ["@//debian:emscripten_toolchain.patch"],
+ patch_args = ["-p1"],
sha256 = "c87e42cb6a104094e7daf2b7e61ac835f83674ac0168f533455838a1129cc764",
strip_prefix = "emscripten-" + emscripten_version,
urls = ["https://github.com/emscripten-core/emscripten/archive/" + emscripten_version + ".tar.gz"],
diff --git a/debian/emscripten_toolchain.patch b/debian/emscripten_toolchain.patch
index cf02316..f6c6b51 100644
--- a/debian/emscripten_toolchain.patch
+++ b/debian/emscripten_toolchain.patch
@@ -1,5 +1,7 @@
---- emcc.py
-+++ emcc.py
+diff --git a/emcc.py b/emcc.py
+index bdf788ef2..7eba3e011 100755
+--- a/emcc.py
++++ b/emcc.py
@@ -206,6 +206,9 @@ class EmccOptions(object):
# Defaults to using the native EOL on each platform (\r\n on Windows, \n on
# Linux & MacOS)
@@ -7,19 +9,19 @@
+ # Whether we will expand the full path of any input files to remove any
+ # symlinks.
+ self.expand_symlinks = True
-
-
+
+
def use_source_map(options):
@@ -859,7 +862,9 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
'-current_version', '-I', '-L', '-include-pch'):
continue # ignore this gcc-style argument
-
+
- if os.path.islink(arg) and get_file_suffix(os.path.realpath(arg)) in SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS:
+ if (options.expand_symlinks
+ and os.path.islink(arg)
+ and get_file_suffix(os.path.realpath(arg)) in SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS):
arg = os.path.realpath(arg)
-
+
if not arg.startswith('-'):
@@ -2516,6 +2521,8 @@ def parse_args(newargs):
settings_changes.append('SIMD=1')
@@ -27,17 +29,36 @@
settings_changes.append('SIMD=0')
+ elif newargs[i] == '-no-canonical-prefixes':
+ options.expand_symlinks = False
-
+
if should_exit:
sys.exit(0)
---- tools/system_libs.py
-+++ tools/system_libs.py
-@@ -89,10 +89,20 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
- if os.name != 'nt' and '\r\n' in content:
- raise Exception('Windows newlines \\r\\n detected in symbols file "' + path + '"! This could happen for example when copying Emscripten checkout from Windows to Linux or macOS. Please use Unix line endings on checkouts of Emscripten on Linux and macOS!')
-
+diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py
+index f6368ecff..7af844a2b 100755
+--- a/tools/gen_struct_info.py
++++ b/tools/gen_struct_info.py
+@@ -387,6 +387,14 @@ def inspect_code(headers, cpp_opts, structs, defines):
+ info = []
+ # Compile the program.
+ show('Compiling generated code...')
++ cpp_opts += ['-isystem',
++ shared.path_from_root('system', 'include'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'libcxx'),
++ '-isystem',
++ shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'emscripten'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'libc')]
+ # -Oz optimizes enough to avoid warnings on code size/num locals
+ cmd = [shared.PYTHON, shared.EMCC] + cpp_opts + ['-o', js_file[1], src_file[1], '-s', 'BOOTSTRAPPING_STRUCT_INFO=1', '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0', '-O0', '--js-opts', '0', '--memory-init-file', '0', '-s', 'SINGLE_FILE=1', '-s', 'WASM=0', '-Wno-format']
+ if shared.Settings.WASM_OBJECT_FILES:
+diff --git a/tools/system_libs.py b/tools/system_libs.py
+index 61a17d2cf..4de22e706 100755
+--- a/tools/system_libs.py
++++ b/tools/system_libs.py
+@@ -91,7 +91,17 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+
return shared.Building.parse_symbols(content).defs
-
+
- default_opts = ['-Werror']
+ default_opts = ['-Werror',
+ '-isystem',
@@ -50,43 +71,33 @@
+ shared.path_from_root('system', 'include', 'compat'),
+ '-isystem',
+ shared.path_from_root('system', 'include', 'libc')]
-
+
# XXX We also need to add libc symbols that use malloc, for example strdup. It's very rare to use just them and not
# a normal malloc symbol (like free, after calling strdup), so we haven't hit this yet, but it is possible.
- libc_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libc.symbols'))
-@@ -426,5 +436,5 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+@@ -425,7 +435,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+ # al
def create_al(libname): # libname is ignored, this is just one .o file
o = in_temp('al.o')
- check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'al.c'), '-o', o, '-Os'] + get_cflags())
+ check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'al.c'), '-o', o, '-Os'] + get_cflags() + default_opts)
return o
-
-@@ -447,5 +455,5 @@ def create_compiler_rt(libname):
+
+ def create_html5(libname):
+@@ -444,7 +454,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+ commands = []
for src in files:
o = in_temp(os.path.basename(src) + '.o')
- commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + get_cflags())
+ commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + get_cflags() + default_opts)
o_s.append(o)
run_commands(commands)
-@@ -500,5 +506,5 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+ shared.Building.emar('cr', in_temp(libname), o_s)
+@@ -497,7 +507,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+
def create_malloc(out_name):
o = in_temp(out_name)
- cflags = ['-O2', '-fno-builtin']
+ cflags = default_opts + ['-O2', '-fno-builtin']
if shared.Settings.USE_PTHREADS:
cflags += ['-s', 'USE_PTHREADS=1']
---- tools/gen_struct_info.py
-+++ tools/gen_struct_info.py
-@@ -401,4 +401,12 @@ def inspect_code(headers, cpp_opts, structs, defines):
- # Compile the program.
- show('Compiling generated code...')
-+ cpp_opts += ['-isystem',
-+ shared.path_from_root('system', 'include'),
-+ '-isystem',
-+ shared.path_from_root('system', 'include', 'libcxx'),
-+ '-isystem',
-+ shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'emscripten'),
-+ '-isystem',
-+ shared.path_from_root('system', 'include', 'libc')]
- # -Oz optimizes enough to avoid warnings on code size/num locals
- cmd = [shared.PYTHON, shared.EMCC] + cpp_opts + ['-o', js_file[1], src_file[1], '-s', 'BOOTSTRAPPING_STRUCT_INFO=1', '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0', '-O0', '--js-opts', '0', '--memory-init-file', '0', '-s', 'SINGLE_FILE=1', '-Wno-format']
+ if shared.Settings.EMSCRIPTEN_TRACING: