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-07 23:24:21 +00:00
|
|
|
[ -d "out/$PLATFORM" ] || mkdir "out/"
|
|
|
|
[ -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-16 12:42:59 +00:00
|
|
|
echo "NOTICE: postwoman-proxy is untested and currently unsupported on Windows."
|
2019-12-07 23:24:21 +00:00
|
|
|
GOOS="windows" go build -o "out/windows/postwoman-proxy.exe"
|
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
|