46 lines
1.5 KiB
Bash
Executable file
46 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Dots in the output basename break runtime discovery: the webview launcher
|
|
# strips the suffix after the last dot (e.g. thornhill-os.v4 -> thornhill-os.so).
|
|
app="thornhill-os"
|
|
preload=(--preload ./src/preload.js)
|
|
linux_target="x86_64-unknown-linux-gnu"
|
|
macos_target="x86_64-apple-darwin"
|
|
windows_target="x86_64-pc-windows-msvc"
|
|
|
|
build_linux() {
|
|
deno desktop "${preload[@]}" --target "$linux_target" --output "./out/linux/${app}" .
|
|
deno desktop "${preload[@]}" --target "$linux_target" --output "./out/linux/${app}.AppImage" .
|
|
deno desktop "${preload[@]}" --target "$linux_target" --output "./out/linux/${app}.deb" .
|
|
}
|
|
|
|
build_macos() {
|
|
deno desktop "${preload[@]}" --target "$macos_target" --output "./out/macos/${app}.app" .
|
|
(cd out/macos && zip -r "${app}.app.zip" "${app}.app")
|
|
if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
deno desktop "${preload[@]}" --target "$macos_target" --output "./out/macos/${app}.dmg" .
|
|
else
|
|
echo "Skipping .dmg (requires a macOS build host with hdiutil)"
|
|
fi
|
|
}
|
|
|
|
build_windows() {
|
|
deno desktop "${preload[@]}" --target "$windows_target" --output "./out/windows/${app}" .
|
|
deno desktop "${preload[@]}" --target "$windows_target" --output "./out/windows/${app}.msi" .
|
|
}
|
|
|
|
case "${1:-all}" in
|
|
linux) build_linux ;;
|
|
macos) build_macos ;;
|
|
windows) build_windows ;;
|
|
all)
|
|
build_linux
|
|
build_macos
|
|
build_windows
|
|
;;
|
|
*)
|
|
echo "Usage: $0 [all|linux|macos|windows]" >&2
|
|
exit 1
|
|
;;
|
|
esac
|