From c72d0b64effc215890b723cdd198ab400f0ae2cd Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Wed, 30 Nov 2016 21:42:23 +0000 Subject: [PATCH] build: Support building on Windows --- make-go.bash | 12 ++++++++++-- make-syncthing.bash | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/make-go.bash b/make-go.bash index f85702c5..79c80d14 100755 --- a/make-go.bash +++ b/make-go.bash @@ -70,12 +70,20 @@ if [ ! -e ../VERSION ]; then echo "$(git describe --tags)" > ../VERSION fi -./make.bash --no-banner +BUILDER_EXT=bash +case "$(uname)" in + *MINGW* | *WIN32* | *CYGWIN*) + BUILDER_EXT=bat + ;; +esac + +./make.${BUILDER_EXT} --no-banner + cp -a ../bin "${GOROOT_FINAL}"/ cp -a ../pkg "${GOROOT_FINAL}"/ cp -a ../src "${GOROOT_FINAL}"/ -if [[ -e ./make.bash ]]; then +if [[ -e ./make.${BUILDER_EXT} ]]; then pushd ../ git clean -f popd diff --git a/make-syncthing.bash b/make-syncthing.bash index 267ac602..d4b50188 100755 --- a/make-syncthing.bash +++ b/make-syncthing.bash @@ -35,6 +35,12 @@ unset GOPATH #Set by build.go export GOROOT=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH} export PATH=${GOROOT}/bin:${PATH} +case "$(uname)" in + *CYGWIN*) + export GOROOT=`cygpath -w $GOROOT` + ;; +esac + pushd ext/syncthing/src/github.com/syncthing/syncthing _GOOS=$GOOS