-
Notifications
You must be signed in to change notification settings - Fork 15
151 lines (131 loc) · 5.3 KB
/
Copy pathbuild-natives.yaml
File metadata and controls
151 lines (131 loc) · 5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build Native Libraries
on:
workflow_call:
jobs:
build-native-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Build macOS native libraries
working-directory: src/native/macos
run: bash build.sh
env:
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
- name: Verify macOS natives
run: |
test -f build/nativeLibs/darwin-aarch64/libMacTray.dylib
test -f build/nativeLibs/darwin-x86-64/libMacTray.dylib
ls -la build/nativeLibs/darwin-aarch64/
ls -la build/nativeLibs/darwin-x86-64/
- name: Upload macOS ARM64 library
uses: actions/upload-artifact@v4
with:
name: native-darwin-aarch64
path: build/nativeLibs/darwin-aarch64/libMacTray.dylib
retention-days: 1
- name: Upload macOS x86_64 library
uses: actions/upload-artifact@v4
with:
name: native-darwin-x86-64
path: build/nativeLibs/darwin-x86-64/libMacTray.dylib
retention-days: 1
build-native-linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86-64
- os: ubuntu-24.04-arm
arch: aarch64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsystemd-dev
- name: Build Linux native library
working-directory: src/native/linux
run: bash build.sh
env:
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
- name: Verify Linux natives
run: |
test -f build/nativeLibs/linux-${{ matrix.arch }}/libLinuxTray.so
ls -la build/nativeLibs/linux-${{ matrix.arch }}/
- name: Upload Linux library
uses: actions/upload-artifact@v4
with:
name: native-linux-${{ matrix.arch }}
path: build/nativeLibs/linux-${{ matrix.arch }}/libLinuxTray.so
retention-days: 1
build-native-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Build Windows native libraries
working-directory: src/native/windows
run: cmd /c build.bat
env:
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
- name: Verify Windows natives
shell: bash
run: |
test -f build/nativeLibs/win32-x86-64/WinTray.dll
test -f build/nativeLibs/win32-arm64/WinTray.dll
ls -la build/nativeLibs/win32-x86-64/
ls -la build/nativeLibs/win32-arm64/
# Regression guard for issue #401: WinTray.dll must stay AVX-free so it does
# not crash with EXCEPTION_ILLEGAL_INSTRUCTION on pre-2011 CPUs (no AVX).
# AVX/AVX2 are VEX-encoded; their mnemonics start with 'v' (vpxor, vmovdqu,
# vzeroupper, vxorps, ...). No legacy x86-64 instruction MSVC emits for C code
# starts with 'v', so any such mnemonic in .text means AVX leaked in.
- name: Verify x64 WinTray.dll is AVX-free (issue #401)
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if (-not $vsPath) { throw "Visual Studio installation not found" }
$dumpbin = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter dumpbin.exe |
Where-Object { $_.FullName -match '\\Hostx64\\x64\\' } | Select-Object -First 1
if (-not $dumpbin) { throw "dumpbin.exe not found" }
Write-Host "Using $($dumpbin.FullName)"
$disasm = & $dumpbin.FullName /DISASM:NOBYTES "build/nativeLibs/win32-x86-64/WinTray.dll"
$avx = $disasm | Select-String -Pattern '^\s+[0-9A-Fa-f]+:\s+v[a-z]' |
Where-Object { $_.Line -notmatch '\bv(err|erw)\b' }
if ($avx) {
Write-Host "AVX instructions found in WinTray.dll (x64):"
$avx | Select-Object -First 20 | ForEach-Object { Write-Host $_.Line.Trim() }
throw "WinTray.dll (x64) contains AVX instructions; it would crash on CPUs without AVX (issue #401). Do not add /arch:AVX* to CMakeLists."
}
Write-Host "OK: no AVX instructions found in x64 WinTray.dll"
- name: Upload Windows x64 library
uses: actions/upload-artifact@v4
with:
name: native-win32-x86-64
path: build/nativeLibs/win32-x86-64/WinTray.dll
retention-days: 1
- name: Upload Windows ARM64 library
uses: actions/upload-artifact@v4
with:
name: native-win32-arm64
path: build/nativeLibs/win32-arm64/WinTray.dll
retention-days: 1