-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (133 loc) · 5.58 KB
/
precompile.yml
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
152
153
154
155
156
157
158
name: nsis-windows
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
windows:
runs-on: ${{ matrix.pair.runner }}
env:
ZLIB_VERSION: "1.3.1"
strategy:
fail-fast: false
matrix:
include:
- pair:
arch: aarch64
target_arch: arm64
vcvarsall: arm64
cmake_arch: arm64
cmake_generator: "Visual Studio 17 2022"
vsversion: "2022"
runner: self-hosted-aarch64-windows-msvc
- pair:
arch: x86_64
target_arch: amd64
vcvarsall: x64
cmake_arch: x64
cmake_generator: "Visual Studio 16 2019"
vsversion: "2019"
runner: windows-2019
name: ${{ matrix.pair.arch }}-windows-msvc
steps:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.pair.vcvarsall }}
vsversion: ${{ matrix.pair.vsversion }}
- name: Setup Python
uses: actions/setup-python@v4
if: startsWith(matrix.pair.arch, 'x86_64')
with:
python-version: '3.x'
- name: Cache zlib source code
id: cache-zlib-src
uses: actions/cache@v4
with:
key: zlib-src-${{ env.ZLIB_VERSION }}
path: |
./zlib-${{ env.ZLIB_VERSION}}.tar.gz
- name: Download latest zlib source code
if: steps.cache-zlib-src.outputs.cache-hit != 'true'
run: |
$TARBALL_NAME="zlib-${{ env.ZLIB_VERSION}}.tar.gz"
if (!(Test-Path $TARBALL_NAME -PathType Leaf)) {
Invoke-WebRequest -Uri "https://www.zlib.net/$TARBALL_NAME" -OutFile "$TARBALL_NAME"
}
- name: Compile zlib
run: |
Remove-Item -LiteralPath "zlib-${{ env.ZLIB_VERSION}}" -Force -Recurse -ErrorAction SilentlyContinue
tar -xzf "zlib-${{ env.ZLIB_VERSION}}.tar.gz"
cd "zlib-${{ env.ZLIB_VERSION}}"
cmake -S . -B build -G "${{ matrix.pair.cmake_generator}}" -A "${{ matrix.pair.cmake_arch }}" -DCMAKE_INSTALL_PREFIX="C:\zlib-${{ env.ZLIB_VERSION}}" -DZLIB_BUILD_EXAMPLES=OFF
cmake --build build --config Release
cmake --install build --config Release
$STATIC_LIB="zlibstatic.lib"
cd "C:\zlib-${{ env.ZLIB_VERSION}}\lib"
if (Test-Path $STATIC_LIB -PathType Leaf) {
Copy-Item -Path $STATIC_LIB -Destination z.lib -Force
}
- name: Cache nsis source code
id: cache-nsis-src
uses: actions/cache@v4
with:
key: nsis-src-${{ env.ZLIB_VERSION }}
path: |
./nsis-${{ env.ZLIB_VERSION}}.tar.bz2
- name: Download latest nsis source code
if: steps.cache-nsis-src.outputs.cache-hit != 'true'
run: |
$ref = $env:GITHUB_REF
$NSIS_VERSION=$ref.Replace('refs/tags/v','')
$TARBALL_NAME="nsis-${NSIS_VERSION}-src.tar.bz2"
Invoke-WebRequest -Uri "https://nchc.dl.sourceforge.net/project/nsis/NSIS%203/${NSIS_VERSION}/$TARBALL_NAME" -OutFile "$TARBALL_NAME"
- name: Unarchive nsis source code
if: startsWith(matrix.pair.arch, 'aarch64')
run: |
$ref = $env:GITHUB_REF
$NSIS_VERSION=$ref.Replace('refs/tags/v','')
$TARBALL_NAME="nsis-${NSIS_VERSION}-src.tar.bz2"
tar -xf "$TARBALL_NAME"
- name: Unarchive nsis source code
if: startsWith(matrix.pair.arch, 'x86_64')
shell: bash
run: |
NSIS_VERSION=${GITHUB_REF##*/v}
TARBALL_NAME="nsis-${NSIS_VERSION}-src.tar.bz2"
tar -xf "$TARBALL_NAME"
- name: Install Dependencies
run: |
pip install scons
echo "${Env:ProgramFiles(x86)}\HTML Help Workshop" >> $Env:GITHUB_PATH
- name: Compile NSIS
run: |
$ref = $env:GITHUB_REF
$NSIS_VERSION=$ref.Replace('refs/tags/v','')
$TARBALL_NAME="nsis-${NSIS_VERSION}-src.tar.bz2"
cd "nsis-${NSIS_VERSION}-src"
if ("${{ matrix.pair.arch }}" -eq "x86_64") {
$ml64_exe = (get-command ml64.exe).Path
$ml_exe = $ml64_exe -replace "ml64.exe", "ml.exe"
Copy-Item -Path $ml64_exe -Destination $ml_exe
$system_sconscript = "Contrib\System\SConscript"
$patched = (Get-Content $system_sconscript) -replace "Source/System.c", "Source/System.c`n`tSource/Call-amd64.S"
Set-Content -Path $system_sconscript -Value $patched
((Get-Content $system_sconscript) -join "`n") + "`n" | Set-Content -NoNewline $system_sconscript
}
echo "run scons"
scons VERSION=${NSIS_VERSION} ZLIB_W32=C:\zlib-${{ env.ZLIB_VERSION }} APPEND_LIBPATH=C:\zlib-${{ env.ZLIB_VERSION }}\lib SKIPUTILS="NSIS Menu" TARGET_ARCH=${{ matrix.pair.target_arch }} dist-zip
- name: Create tarball
run: |
$ref = $env:GITHUB_REF
$NSIS_VERSION=$ref.Replace('refs/tags/v','')
$ZIPFILE=(Get-ChildItem -Path "nsis-${NSIS_VERSION}-src" -Filter "nsis*.zip" -File).FullName
Expand-Archive -Path $ZIPFILE -Force
$UNARCHIVED_DIR=(Get-ChildItem -Path . -Filter "nsis-${NSIS_VERSION}${{ matrix.pair.target_arch }}" -Depth 0 -Directory).FullName
Remove-Item -LiteralPath artifacts -Force -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path artifacts -Force
tar -czf "./artifacts/nsis-${{ matrix.pair.arch }}-windows-msvc.tar.gz" -C "$UNARCHIVED_DIR" .
- uses: softprops/action-gh-release@v1
with:
files: |
artifacts/nsis-*.tar.gz