1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-01 22:26:24 -07:00

Have build.sh fail if user tries to cross-compile to macOS

TODO: get cross-compilation properly working (Windows seems to be fine)
This commit is contained in:
Eggbertx 2019-11-02 17:28:55 -07:00
parent a53659dc28
commit 58dc6a0942
2 changed files with 19 additions and 3 deletions

View file

@ -6,6 +6,7 @@ Gochan works in a manner similar to Kusaba X, Tinyboard and others. As such, Goc
Demo installation: https://gochan.org
**Note:** Cross-compilation to macOS has been temporarily (hopefully) disabled. If you need macOS support, build gochan from a macOS system.
# Installation

View file

@ -11,6 +11,7 @@ BUILDTIME=`date +%y%m%d.%H%M`
GCFLAGS=-trimpath=$PWD
ASMFLAGS=-trimpath=$PWD
LDFLAGS="-X main.versionStr=$VERSION -w -s"
export CGO_ENABLED=1
if [ -z "$GOPATH" ]; then
@ -110,7 +111,19 @@ function build {
if [ "$1" = "macos" ]; then GCOS="darwin"; else GCOS=$1; fi
fi
if [ "$GCOS" = "windows" ]; then BIN=$BIN.exe; fi
if [ "$GCOS" = "windows" ]; then
BIN=$BIN.exe
fi
if [ "$GCOS" = "darwin" ]; then
echo "Cross-compilation to macOS has been temporarily disabled because of a cgo issue."
echo "If you really need macOS support, build gochan from a macOS system."
exit 1
fi
if [ -z "$GCOS" ]; then
GCOS=`go env GOOS`
fi
buildCmd="GOOS=$GCOS go build -v -gcflags=$GCFLAGS -asmflags=$ASMFLAGS -ldflags \"$LDFLAGS\" -o $BIN ./src"
@ -175,8 +188,10 @@ fi
while [ -n "$1" ]; do
case "$1" in
clean)
echo "Deleting $BIN(.exe)"
rm -f $BIN
rm -f $BIN.exe
echo "Deleting release builds"
rm -rf releases
;;
dependencies)
@ -295,7 +310,7 @@ while [ -n "$1" ]; do
release $2
else
release linux
release macos
#release macos
release windows
fi
;;
@ -316,4 +331,4 @@ while [ -n "$1" ]; do
;;
esac
shift
done
done