diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1211799a..a887d5be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,13 @@ jobs: - runner: windows-2022 target: windows arch: x64 + goarch: amd64 artifact: windows-x64 + - runner: windows-11-arm + target: windows + arch: arm64 + goarch: arm64 + artifact: windows-arm64 - runner: macos-26 target: apple artifact: apple-cgo @@ -124,9 +130,27 @@ jobs: - name: Build Windows if: matrix.target == 'windows' + env: + GOARCH: ${{ matrix.goarch }} run: | python build/main.py windows + - name: Verify Windows architecture + if: matrix.target == 'windows' + shell: pwsh + run: | + $bytes = [System.IO.File]::ReadAllBytes("windows_dll/libXray.dll") + $peOffset = [System.BitConverter]::ToInt32($bytes, 0x3c) + $machine = [System.BitConverter]::ToUInt16($bytes, $peOffset + 4) + $expected = switch ("${{ matrix.arch }}") { + "x64" { 0x8664 } + "arm64" { 0xaa64 } + default { throw "unsupported Windows architecture: ${{ matrix.arch }}" } + } + if ($machine -ne $expected) { + throw ("unexpected PE machine 0x{0:X4}; expected 0x{1:X4}" -f $machine, $expected) + } + - name: Build Apple (macOS/iOS) if: matrix.target == 'apple' run: | diff --git a/README.md b/README.md index f6c2cca0..9e13d08b 100644 --- a/README.md +++ b/README.md @@ -101,13 +101,10 @@ depend on gcc and g++. ### Windows -depend on LLVM MinGW. +Depends on gcc and g++ in `PATH`. -you can use winget to install [LLVM MinGW](https://github.com/mstorsjo/llvm-mingw). - -```shell -winget install MartinStorsjo.LLVM-MinGW.UCRT -``` +Native amd64 and arm64 builds are supported. The release workflow builds each +architecture on its matching GitHub-hosted Windows runner. ## API diff --git a/build/app/apple_go.py b/build/app/apple_go.py index 52fadb3d..38ff8c3a 100644 --- a/build/app/apple_go.py +++ b/build/app/apple_go.py @@ -54,21 +54,20 @@ def __init__(self, build_dir: str, use_local_xray_core: bool = False): ), ] - # keep same with flutter self.macos_targets = [ AppleTarget( "darwin", "amd64", "x86_64", "macosx", - "10.14", + "12.0", ), AppleTarget( "darwin", "arm64", "arm64", "macosx", - "10.14", + "12.0", ), ] diff --git a/readme/README.zh_CN.md b/readme/README.zh_CN.md index 320e0558..2209662d 100644 --- a/readme/README.zh_CN.md +++ b/readme/README.zh_CN.md @@ -69,13 +69,10 @@ python3 build/main.py windows local ### Windows -依赖 LLVM MinGW 。 +依赖 `PATH` 中的 gcc 和 g++。 -你可使用 winget 安装 [LLVM MinGW](https://github.com/mstorsjo/llvm-mingw)。 - -```shell -winget install MartinStorsjo.LLVM-MinGW.UCRT -``` +支持原生 amd64 和 arm64 构建。Release workflow 会在对应架构的 GitHub +Windows runner 上分别构建产物。 ## API