2019-12-07 19:25:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]; then
|
2019-12-07 23:24:21 +00:00
|
|
|
echo "Usage: $0 <darwin|linux|windows>"
|
2019-12-07 19:25:39 +00:00
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Collect parameters.
|
|
|
|
PLATFORM="$1"
|
|
|
|
|
|
|
|
# Remove all legacy icons.
|
|
|
|
[ -f icons/icon_unix.go ] && rm icons/icon_unix.go
|
|
|
|
[ -f icons/icon_win.go ] && rm icons/icon_win.go
|
|
|
|
|
|
|
|
# Build the icon for the appropriate platform.
|
2019-12-07 23:24:21 +00:00
|
|
|
if [ "$PLATFORM" == "darwin" ] || [ "$PLATFORM" == "linux" ]; then
|
2019-12-07 19:25:39 +00:00
|
|
|
cat "icons/icon.png" | go run github.com/cratonica/2goarray Data icon >> icons/icon_unix.go
|
2019-12-07 23:24:21 +00:00
|
|
|
elif [ "$PLATFORM" == "windows" ]; then
|
2019-12-07 19:25:39 +00:00
|
|
|
cat "icons/icon.ico" | go run github.com/cratonica/2goarray Data icon >> icons/icon_win.go
|
|
|
|
else
|
|
|
|
echo "Unknown platform: $1"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
2019-12-18 18:04:25 +00:00
|
|
|
[ -d "out/" ] || mkdir "out/"
|
2019-12-07 23:24:21 +00:00
|
|
|
[ -d "out/$PLATFORM" ] && rm -r "out/$PLATFORM"
|
|
|
|
mkdir "out/$PLATFORM"
|
|
|
|
cp -r "resources/$PLATFORM" "out"
|
2019-12-07 19:25:39 +00:00
|
|
|
|
2019-12-07 23:24:21 +00:00
|
|
|
if [ "$PLATFORM" == "darwin" ]; then
|
|
|
|
mkdir -p "out/darwin/PostwomanProxy.app/Contents/MacOS"
|
|
|
|
mkdir -p "out/darwin/PostwomanProxy.app/Contents/MacOS/icons"
|
|
|
|
cp icons/icon.png out/darwin/PostwomanProxy.app/Contents/MacOS/icons/
|
|
|
|
GOOS="darwin" go build -o "out/darwin/PostwomanProxy.app/Contents/MacOS/postwoman-proxy"
|
|
|
|
elif [ "$PLATFORM" == "windows" ]; then
|
2019-12-18 18:04:25 +00:00
|
|
|
[ -f "rsrc.syso" ] && rm rsrc.syso
|
|
|
|
go get github.com/akavel/rsrc
|
|
|
|
|
|
|
|
rsrc -manifest="out/windows/postwoman-proxy.manifest" -ico="icons/icon.ico" -o rsrc.syso
|
|
|
|
GOOS="windows" go build -ldflags -H=windowsgui -o "out/windows/postwoman-proxy.exe"
|
|
|
|
|
|
|
|
mkdir out/windows/icons
|
|
|
|
cp icons/icon.png "out/windows/icons/icon.png"
|
|
|
|
|
|
|
|
mkdir out/windows/data
|
|
|
|
|
|
|
|
rm out/windows/postwoman-proxy.manifest
|
|
|
|
rm rsrc.syso
|
2019-12-16 12:42:59 +00:00
|
|
|
elif [ "$PLATFORM" == "linux" ]; then
|
|
|
|
echo "NOTICE: postwoman-proxy is untested and currently unsupported on Linux."
|
|
|
|
GOOS="linux" go build -o "out/linux/postwoman"
|
|
|
|
fi
|