-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·43 lines (32 loc) · 951 Bytes
/
build.sh
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
#!/bin/bash
build_macos() {
echo "Building for macOS..."
swift build -c release -Xswiftc -Osize --arch arm64
swift build -c release -Xswiftc -Osize --arch x86_64
local arm64_binary=".build/arm64-apple-macosx/release/swiftyspell"
local x86_64_binary=".build/x86_64-apple-macosx/release/swiftyspell"
local universal_binary="./swiftyspell"
lipo -create -output "$universal_binary" "$arm64_binary" "$x86_64_binary"
echo "Universal binary created at $universal_binary"
strip "$universal_binary"
lipo -info "$universal_binary"
}
build_linux() {
echo "Building for Linux..."
swift build -c release -Xswiftc -Osize --static-swift-stdlib
mv ./.build/release/swiftyspell ./swiftyspell
strip ./swiftyspell
}
OS=$(uname -s)
case "$OS" in
Darwin)
build_macos
;;
Linux)
build_linux
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac