Skip to content

Commit 8e66ca0

Browse files
authored
Build arm64e for macosx and unify build system. (#115)
* Only build release and debug * Rewrite xmake build config to use pack plugin
1 parent 652de3c commit 8e66ca0

4 files changed

Lines changed: 152 additions & 246 deletions

File tree

‎.github/workflows/build-be.yml‎

Lines changed: 39 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,27 @@ jobs:
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v7
12-
- name: Configure paths
13-
run: |
14-
New-Item -ItemType Directory -Force -Path ./artifacts/release/x64
15-
New-Item -ItemType Directory -Force -Path ./artifacts/release/x86
16-
New-Item -ItemType Directory -Force -Path ./artifacts/verbose/x64
17-
New-Item -ItemType Directory -Force -Path ./artifacts/verbose/x86
12+
- name: Setup xmake
13+
uses: xmake-io/github-action-setup-xmake@v1
14+
with:
15+
xmake-version: 3.1.1
1816
- name: Build Release
1917
run: |
20-
./build.ps1
21-
Copy-Item -Path ./build/windows/x64/release/doorstop.dll -Destination ./artifacts/release/x64/winhttp.dll
22-
Copy-Item -Path ./build/windows/x64/release/.doorstop_version -Destination ./artifacts/release/x64/.doorstop_version
23-
Copy-Item -Path ./build/windows/x86/release/doorstop.dll -Destination ./artifacts/release/x86/winhttp.dll
24-
Copy-Item -Path ./build/windows/x86/release/.doorstop_version -Destination ./artifacts/release/x86/.doorstop_version
25-
Copy-Item -Path ./assets/windows/doorstop_config.ini -Destination ./artifacts/release/x64/doorstop_config.ini
26-
Copy-Item -Path ./assets/windows/doorstop_config.ini -Destination ./artifacts/release/x86/doorstop_config.ini
27-
Copy-Item -Path ./LICENSE -Destination ./artifacts/release/LICENSE
28-
- name: Build Verbose
18+
xmake pack
19+
- name: Build Debug
2920
run: |
30-
./build.ps1 -with_logging
31-
Copy-Item -Path ./build/windows/x64/release/doorstop.dll -Destination ./artifacts/verbose/x64/winhttp.dll
32-
Copy-Item -Path ./build/windows/x64/release/.doorstop_version -Destination ./artifacts/verbose/x64/.doorstop_version
33-
Copy-Item -Path ./build/windows/x86/release/doorstop.dll -Destination ./artifacts/verbose/x86/winhttp.dll
34-
Copy-Item -Path ./build/windows/x86/release/.doorstop_version -Destination ./artifacts/verbose/x86/.doorstop_version
35-
Copy-Item -Path ./assets/windows/doorstop_config.ini -Destination ./artifacts/verbose/x64/doorstop_config.ini
36-
Copy-Item -Path ./assets/windows/doorstop_config.ini -Destination ./artifacts/verbose/x86/doorstop_config.ini
37-
Copy-Item -Path ./LICENSE -Destination ./artifacts/verbose/LICENSE
21+
xmake f -m debug
22+
xmake pack
3823
- name: Upload Release
3924
uses: actions/upload-artifact@v7
4025
with:
41-
name: doorstop_win_release
42-
path: artifacts/release
43-
include-hidden-files: true
44-
- name: Upload Verbose
26+
path: build/xpack/doorstop/doorstop_windows_release.zip
27+
archive: false
28+
- name: Upload Debug
4529
uses: actions/upload-artifact@v7
4630
with:
47-
name: doorstop_win_verbose
48-
path: artifacts/verbose
49-
include-hidden-files: true
31+
path: build/xpack/doorstop/doorstop_windows_debug.zip
32+
archive: false
5033

5134
build-linux:
5235
runs-on: ubuntu-latest
@@ -58,108 +41,57 @@ jobs:
5841
steps:
5942
- name: Checkout
6043
uses: actions/checkout@v7
61-
- name: Configure paths
62-
run: |
63-
bash -c "mkdir -p artifacts/{verbose,release,debug}/{x86,x64}"
6444
- name: Install dependencies
65-
run: apt-get update && apt-get install -y git build-essential libreadline-dev ccache gcc-multilib g++-multilib clang curl
45+
run: apt-get update && apt-get install -y git build-essential libreadline-dev ccache gcc-multilib g++-multilib clang curl zip
46+
- name: Setup xmake
47+
uses: xmake-io/github-action-setup-xmake@v1
48+
with:
49+
xmake-version: 3.1.1
6650
- name: Build Release
6751
run: |
68-
./build.sh
69-
cp build/linux/x86/release/libdoorstop.so artifacts/release/x86/libdoorstop.so
70-
cp build/linux/x64/release/libdoorstop.so artifacts/release/x64/libdoorstop.so
71-
cp build/linux/x86/release/.doorstop_version artifacts/release/x86/.doorstop_version
72-
cp build/linux/x64/release/.doorstop_version artifacts/release/x64/.doorstop_version
73-
cp assets/nix/run.sh artifacts/release/x86/run.sh
74-
cp assets/nix/run.sh artifacts/release/x64/run.sh
75-
cp LICENSE artifacts/release/LICENSE
76-
- name: Build Verbose
77-
run: |
78-
./build.sh -with_logging
79-
cp build/linux/x86/release/libdoorstop.so artifacts/verbose/x86/libdoorstop.so
80-
cp build/linux/x64/release/libdoorstop.so artifacts/verbose/x64/libdoorstop.so
81-
cp build/linux/x64/release/.doorstop_version artifacts/verbose/x86/.doorstop_version
82-
cp build/linux/x86/release/.doorstop_version artifacts/verbose/x64/.doorstop_version
83-
cp assets/nix/run.sh artifacts/verbose/x86/run.sh
84-
cp assets/nix/run.sh artifacts/verbose/x64/run.sh
85-
cp LICENSE artifacts/verbose/LICENSE
52+
xmake pack
8653
- name: Build Debug
8754
run: |
88-
./build.sh -with_logging -debug
89-
cp build/linux/x86/debug/libdoorstop.so artifacts/debug/x86/libdoorstop.so
90-
cp build/linux/x64/debug/libdoorstop.so artifacts/debug/x64/libdoorstop.so
91-
cp build/linux/x86/debug/.doorstop_version artifacts/debug/x86/.doorstop_version
92-
cp build/linux/x64/debug/.doorstop_version artifacts/debug/x64/.doorstop_version
93-
cp assets/nix/run.sh artifacts/debug/x86/run.sh
94-
cp assets/nix/run.sh artifacts/debug/x64/run.sh
95-
cp LICENSE artifacts/debug/LICENSE
55+
xmake f -m debug
56+
xmake pack
9657
- name: Upload Release
9758
uses: actions/upload-artifact@v7
9859
with:
99-
name: doorstop_linux_release
100-
path: artifacts/release
101-
include-hidden-files: true
102-
- name: Upload Verbose
103-
uses: actions/upload-artifact@v4
104-
with:
105-
name: doorstop_linux_verbose
106-
path: artifacts/verbose
107-
include-hidden-files: true
60+
path: build/xpack/doorstop/doorstop_linux_release.zip
61+
archive: false
10862
- name: Upload Debug
10963
uses: actions/upload-artifact@v7
11064
with:
111-
name: doorstop_linux_debug
112-
path: artifacts/debug
113-
include-hidden-files: true
65+
path: build/xpack/doorstop/doorstop_linux_debug.zip
66+
archive: false
11467

11568
build-macos:
11669
runs-on: macos-latest
11770

11871
steps:
11972
- name: Checkout
12073
uses: actions/checkout@v7
121-
- name: Configure paths
122-
run: |
123-
mkdir -p artifacts/{verbose,release,debug}/universal
74+
- name: Setup xmake
75+
uses: xmake-io/github-action-setup-xmake@v1
76+
with:
77+
xmake-version: 3.1.1
12478
- name: Build Release
12579
run: |
126-
./build.sh
127-
cp build/macosx/universal/release/libdoorstop.dylib artifacts/release/universal/libdoorstop.dylib
128-
cp build/macosx/universal/release/.doorstop_version artifacts/release/universal/.doorstop_version
129-
cp assets/nix/run.sh artifacts/release/universal/run.sh
130-
cp LICENSE artifacts/release/LICENSE
131-
- name: Build Verbose
132-
run: |
133-
./build.sh -with_logging
134-
cp build/macosx/universal/release/libdoorstop.dylib artifacts/verbose/universal/libdoorstop.dylib
135-
cp build/macosx/universal/release/.doorstop_version artifacts/verbose/universal/.doorstop_version
136-
cp assets/nix/run.sh artifacts/verbose/universal/run.sh
137-
cp LICENSE artifacts/verbose/LICENSE
80+
xmake pack
13881
- name: Build Debug
13982
run: |
140-
./build.sh -with_logging -debug
141-
cp build/macosx/universal/debug/libdoorstop.dylib artifacts/debug/universal/libdoorstop.dylib
142-
cp build/macosx/universal/debug/.doorstop_version artifacts/debug/universal/.doorstop_version
143-
cp assets/nix/run.sh artifacts/debug/universal/run.sh
144-
cp LICENSE artifacts/debug/LICENSE
83+
xmake f -m debug
84+
xmake pack
14585
- name: Upload Release
14686
uses: actions/upload-artifact@v7
14787
with:
148-
name: doorstop_macos_release
149-
path: artifacts/release
150-
include-hidden-files: true
151-
- name: Upload Verbose
152-
uses: actions/upload-artifact@v4
153-
with:
154-
name: doorstop_macos_verbose
155-
path: artifacts/verbose
156-
include-hidden-files: true
88+
path: build/xpack/doorstop/doorstop_macosx_release.zip
89+
archive: false
15790
- name: Upload Debug
15891
uses: actions/upload-artifact@v7
15992
with:
160-
name: doorstop_macos_debug
161-
path: artifacts/debug
162-
include-hidden-files: true
93+
path: build/xpack/doorstop/doorstop_macosx_debug.zip
94+
archive: false
16395

16496
collect:
16597
runs-on: ubuntu-latest
@@ -176,6 +108,9 @@ jobs:
176108
path: artifacts
177109
- name: Grab version
178110
run: |
111+
for k in artifacts/*.zip; do mv "${k}" "${k%.zip}"; done
112+
for k in artifacts/doorstop_windows_*; do mv "${k}" "artifacts/doorstop_win_${k##*_}"; done
113+
for k in artifacts/doorstop_macosx_*; do mv "${k}" "artifacts/doorstop_macos_${k##*_}"; done
179114
VERSION=$(cat artifacts/doorstop_win_release/x86/.doorstop_version)
180115
echo "doorstop_version=$VERSION" >> $GITHUB_ENV
181116
- name: Create zips

‎build.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if (!(Test-Path $XMAKE_DIR)) {
5454

5555
$XMAKE_EXE = Join-Path $XMAKE_DIR "xmake.exe"
5656
foreach ($a in $Arch) {
57-
$verbose_opt = if ($with_logging) { "--include_logging=y" } else { "--include_logging=n" }
58-
Invoke-Expression "& $XMAKE_EXE f -a $a $verbose_opt"
57+
$m = if ($with_logging) { "-m debug" } else { "-m release" }
58+
Invoke-Expression "& $XMAKE_EXE f -a $a $m"
5959
Invoke-Expression "& $XMAKE_EXE $($ScriptArgs -join " ")"
6060
}

‎build.sh‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ commands_exist () {
6868

6969
help () {
7070
echo "
71-
./build.sh [-with_logging] [-debug] [-arch=<arch>] [--help|-h] [...]
71+
./build.sh [-debug] [-arch=<arch>] [--help|-h] [...]
7272
Script that downloads xmake if it's missing and builds the project
7373
Parameters
74-
-with_logging : enable logging
7574
-debug : enable debug
7675
-arch=<arch> : comma-separated list of architectures to build for
7776
-h, --help: show this help message
@@ -80,7 +79,6 @@ help () {
8079
}
8180

8281
# Parse parameters into variables
83-
WITH_LOGGING="n"
8482
PROFILE="release"
8583
# Bash list of architectures to build for
8684
ARCHS=("x86" "x64")
@@ -90,10 +88,6 @@ fi
9088
while [[ $# -gt 0 ]]; do
9189
key="$1"
9290
case $key in
93-
-with_logging)
94-
WITH_LOGGING="y"
95-
shift
96-
;;
9791
-debug)
9892
PROFILE="debug"
9993
shift
@@ -258,14 +252,14 @@ fi
258252

259253
if [[ "$(uname)" == "Darwin" ]]; then
260254
log-8601-local "Building for macOS universal binary..."
261-
"$xmake" f -m $PROFILE --include_logging=$WITH_LOGGING
255+
"$xmake" f -m $PROFILE
262256
"$xmake" "$@"
263257
else
264258
# Build projects for each arch
265259
for arch in "${ARCHS[@]}"
266260
do
267261
log-8601-local "Building for $arch..."
268-
"$xmake" f -a "$arch" -m $PROFILE --include_logging=$WITH_LOGGING
262+
"$xmake" f -a "$arch" -m $PROFILE
269263
"$xmake" "$@"
270264
done
271265
fi

0 commit comments

Comments
 (0)