Skip to content

Commit

Permalink
fix: support cross compiling for wasm with make generator
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Jan 19, 2024
1 parent dd0fda5 commit 6c9a795
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,11 @@ def Write(
self.output = self.ComputeMacBundleOutput(spec)
self.output_binary = self.ComputeMacBundleBinaryOutput(spec)
else:
self.output = self.output_binary = self.ComputeOutput(spec)
if self.flavor == "win":
# prevent from generating copy targets on Windows
self.output = self.output_binary = self.ComputeOutput(spec).replace('\\', '/')

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.8)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.9)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.10)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.11)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.12)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.8)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.9)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.10)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.11)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)

Check failure on line 864 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.12)

Ruff (E501)

pylib/gyp/generator/make.py:864:89: E501 Line too long (94 > 88)
else:
self.output = self.output_binary = self.ComputeOutput(spec)

self.is_standalone_static_library = bool(
spec.get("standalone_static_library", 0)
Expand Down Expand Up @@ -2441,13 +2445,17 @@ def CalculateMakefilePath(build_file, base_name):
flock_command = "flock"
copy_archive_arguments = "-af"
makedep_arguments = "-MMD"

# some linkers don't support --start-group/--end-group (e.g. wasm-ld)
link_commands = LINK_COMMANDS_LINUX.replace(' -Wl,--start-group', '').replace(' -Wl,--end-group', '') if gyp.common.CrossCompileRequested() else LINK_COMMANDS_LINUX

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.8)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.9)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.10)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.11)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.12)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.8)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.9)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.10)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.11)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

Check failure on line 2450 in pylib/gyp/generator/make.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.12)

Ruff (E501)

pylib/gyp/generator/make.py:2450:89: E501 Line too long (168 > 88)

header_params = {
"default_target": default_target,
"builddir": builddir_name,
"default_configuration": default_configuration,
"flock": flock_command,
"flock_index": 1,
"link_commands": LINK_COMMANDS_LINUX,
"link_commands": link_commands,
"extra_commands": "",
"srcdir": srcdir,
"copy_archive_args": copy_archive_arguments,
Expand All @@ -2463,7 +2471,8 @@ def CalculateMakefilePath(build_file, base_name):
"LINK.host": GetEnvironFallback(("LINK_host", "LINK"), "$(CXX.host)"),
"PLI.host": GetEnvironFallback(("PLI_host", "PLI"), "pli"),
}
if flavor == "mac":
# If cross-compiling, reserve linux link commands and do not use gyp-mac-tool
if flavor == "mac" and not gyp.common.CrossCompileRequested():
flock_command = "./gyp-mac-tool flock"
header_params.update(
{
Expand Down

0 comments on commit 6c9a795

Please sign in to comment.