-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·27 lines (17 loc) · 783 Bytes
/
build.sh
File metadata and controls
executable file
·27 lines (17 loc) · 783 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
# Usage: Set ARCH and VERSION env vars before running, e.g.:
# ARCH=arm64 VERSION=1.2.3 ./build.sh
ARCH="${ARCH:-arm64}"
VERSION="${VERSION:-dev}"
# Remove 'v' prefix if present in version
echo "Building for arch: $ARCH, version: $VERSION"
VERSION_CLEAN=${VERSION#v}
# Replace currentVersion in HTMLPopup.swift with the build version
sed "s/var currentVersion = \".*\"/var currentVersion = \"$VERSION_CLEAN\"/" HTMLPopup.swift > HTMLPopup.build.swift
# Build the binary with version info
swiftc -o htmlpopup-${ARCH} HTMLPopup.build.swift \
-framework Cocoa -framework WebKit -framework Foundation -framework AppKit
# Clean up temporary build file
rm HTMLPopup.build.swift
echo "Built htmlpopup-${ARCH} with version $VERSION_CLEAN"