-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·56 lines (49 loc) · 1.78 KB
/
build.sh
File metadata and controls
executable file
·56 lines (49 loc) · 1.78 KB
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
#!/bin/bash
# build.sh
# Builds 3270Connect for Windows and Linux (with icon embedding for Windows)
set -euo pipefail
echo "======================================"
echo " Building 3270Connect binaries"
echo "======================================"
echo ""
# Create output folder
mkdir -p dist
# Build Windows icon resource to avoid a blank exe icon
WIN_ARCH="${WIN_ARCH:-amd64}"
RSRC_BIN="${RSRC_BIN:-rsrc}"
if ! command -v "$RSRC_BIN" >/dev/null 2>&1; then
GOPATH_BIN="$(go env GOPATH)/bin"
for cand in "$GOPATH_BIN/rsrc" "$GOPATH_BIN/rsrc.exe"; do
if [ -x "$cand" ]; then
RSRC_BIN="$cand"
break
fi
done
fi
if ! command -v "$RSRC_BIN" >/dev/null 2>&1 && [ ! -x "$RSRC_BIN" ]; then
echo "Installing rsrc for icon embedding..."
go install github.com/akavel/rsrc@latest
RSRC_BIN="$(go env GOPATH)/bin/rsrc"
[ -x "${RSRC_BIN}.exe" ] && RSRC_BIN="${RSRC_BIN}.exe"
fi
if command -v "$RSRC_BIN" >/dev/null 2>&1 || [ -x "$RSRC_BIN" ]; then
echo "Embedding Windows icon (arch=$WIN_ARCH)..."
"$RSRC_BIN" -arch "$WIN_ARCH" -ico logo.ico -o resource.syso
else
echo "WARNING: rsrc not available; Windows binary will not have an icon."
fi
# Build Windows terminal version
echo "Building Windows terminal version..."
CGO_ENABLED=0 GOOS=windows GOARCH="$WIN_ARCH" go build -o dist/3270Connect.exe .
echo "Windows build complete."
# Build Linux version
echo "Building Linux version..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o dist/3270Connect_linux .
echo "Linux build complete."
echo ""
echo "✔ Build complete!"
echo "--------------------------------------"
echo " dist/3270Connect.exe ← Windows terminal version"
echo " dist/3270Connect_linux ← Linux (amd64, static)"
echo "--------------------------------------"
echo ""