diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fd68e8..580da89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ permissions: contents: write env: - version: m132-9b3c42e2f9-1 + version: m132-9b3c42e2f9-2 jobs: macos: diff --git a/README.md b/README.md index 0532a5b..a16c7d8 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,7 @@ python3 script/checkout.py --version m126-6fd3120c1b python3 script/build.py --build-type Debug python3 script/archive.py --version m126-6fd3120c1b --build-type Debug ``` + +### Windows-specific + +On Windows, skia-pack requires Clang-cl to be installed. Clang-cl is a part of LLVM and can be downloaded from the [LLVM project's website](https://releases.llvm.org/). Please also make sure that Clang-cl.exe is available on %PATH%. diff --git a/script/build.py b/script/build.py index 44a3852..94f14a6 100755 --- a/script/build.py +++ b/script/build.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 -import common, os, subprocess, sys +import common, os, shutil, subprocess, sys def main(): os.chdir(os.path.join(os.path.dirname(__file__), os.pardir, 'skia')) @@ -86,6 +86,14 @@ def main(): 'skia_use_direct3d=true', 'extra_cflags=["-DSK_FONT_HOST_USE_SYSTEM_SETTINGS"]', ] + if 'windows' == host: + clang_path = shutil.which('clang-cl.exe') + if not clang_path: + raise Exception("Please install LLVM from https://releases.llvm.org/, and make sure that clang-cl.exe is available in PATH") + args += [ + 'clang_win="' + os.path.dirname(os.path.dirname(clang_path)) + '"', + 'is_trivial_abi=false', + ] elif 'android' == target: args += [ 'ndk="'+ ndk + '"' diff --git a/script/checkout.py b/script/checkout.py index f0e8357..6566313 100755 --- a/script/checkout.py +++ b/script/checkout.py @@ -51,6 +51,23 @@ def main(): print("> Fetching ninja") subprocess.check_call(["python3", "bin/fetch-ninja"]) + # Patch an issue in Windows toolchain: + # Enable delayed environment variable expansion for CMD to make GitHub Actions happy + # https://issues.skia.org/issues/393402169 + with open("gn/toolchain/BUILD.gn", "r") as toolchain_file: + toolchain_file_contents = toolchain_file.read() + + toolchain_file_contents = toolchain_file_contents.replace( + 'shell = "cmd.exe /c', + 'shell = "cmd.exe /v:on /c', + ).replace( + r'env_setup = "$shell set \"PATH=%PATH%', + r'env_setup = "$shell set \"PATH=!PATH!', + ) + + with open("gn/toolchain/BUILD.gn", "w") as toolchain_file: + toolchain_file.write(toolchain_file_contents) + return 0 if __name__ == '__main__':