Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions build/app/apple_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
),
]

Expand Down
9 changes: 3 additions & 6 deletions readme/README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down