aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rwxr-xr-xscripts/get-syncthing.sh23
2 files changed, 20 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index d7ad5c2..ca04632 100644
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,7 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
ROOT_SRCDIR := $(patsubst %/,%,$(dir $(mkfile_path)))
ROOT_GOPRJ := $(abspath $(ROOT_SRCDIR)/../../../..)
LOCAL_BINDIR := $(ROOT_SRCDIR)/bin
-LOCAL_TOOLSDIR := $(ROOT_SRCDIR)/tools
+LOCAL_TOOLSDIR := $(ROOT_SRCDIR)/tools/${HOST_GOOS}
PACKAGE_DIR := $(ROOT_SRCDIR)/package
export GOPATH := $(shell go env GOPATH):$(ROOT_GOPRJ)
@@ -77,7 +77,7 @@ build: vendor tools/syncthing/copytobin
@echo "### Build XDS agent (version $(VERSION), subversion $(SUB_VERSION)) - $(BUILD_MODE)";
@cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(LOCAL_BINDIR)/xds-agent$(EXT) -ldflags "$(GORELEASE) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" .
-package: clean build
+package: clean tools/syncthing build
@mkdir -p $(PACKAGE_DIR)/xds-agent
@cp agent-config.json.in $(PACKAGE_DIR)/xds-agent/agent-config.json
@cp -a $(LOCAL_BINDIR)/* $(PACKAGE_DIR)/xds-agent
@@ -89,6 +89,8 @@ package-all:
GOOS=linux GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
@echo "# Build windows amd64..."
GOOS=windows GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
+ @echo "# Build darwin amd64..."
+ GOOS=darwin GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
test: tools/glide
go test --race $(shell ./tools/glide novendor)
diff --git a/scripts/get-syncthing.sh b/scripts/get-syncthing.sh
index da06d15..368c941 100755
--- a/scripts/get-syncthing.sh
+++ b/scripts/get-syncthing.sh
@@ -10,27 +10,36 @@
[ -z "$TMPDIR" ] && TMPDIR=/tmp
[ -z "$GOOS" ] && GOOS=$(go env GOOS)
[ -z "$GOARCH" ] && GOARCH=$(go env GOARCH)
+[ -z "$CLEANUP" ] && CLEANUP=false
-TEMPDIR=$TMPDIR/.get-st.$$
+TEMPDIR=$TMPDIR/.get-syncthing.tmp
mkdir -p ${TEMPDIR} && cd ${TEMPDIR} || exit 1
trap "cleanExit" 0 1 2 15
cleanExit ()
{
- rm -rf ${TEMPDIR}
+ if [ "$CLEANUP" = "true" ]; then
+ rm -rf ${TEMPDIR}
+ fi
}
TB_EXT="tar.gz"
EXT=""
[[ "$GOOS" = "windows" ]] && { TB_EXT="zip"; EXT=".exe"; }
+GOOS_ST=${GOOS}
+GOOS_STI=${GOOS}
+[[ "$GOOS" = "darwin" ]] && GOOS_ST="macosx"
+
echo "Get Syncthing..."
+
+
## Install Syncthing + Syncthing-inotify
## gpg: key 00654A3E: public key "Syncthing Release Management <release@syncthing.net>" imported
gpg -q --keyserver pool.sks-keyservers.net --recv-keys 37C84554E7E0A261E4F76E1ED26E6ED000654A3E || exit 1
-tarball="syncthing-${GOOS}-${GOARCH}-v${SYNCTHING_VERSION}.${TB_EXT}" \
+tarball="syncthing-${GOOS_ST}-${GOARCH}-v${SYNCTHING_VERSION}.${TB_EXT}" \
&& curl -sfSL "https://github.com/syncthing/syncthing/releases/download/v${SYNCTHING_VERSION}/${tarball}" -O \
&& curl -sfSL "https://github.com/syncthing/syncthing/releases/download/v${SYNCTHING_VERSION}/sha1sum.txt.asc" -O \
&& gpg -q --verify sha1sum.txt.asc \
@@ -47,19 +56,19 @@ echo "Get Syncthing-inotify..."
if [ "$SYNCTHING_INOTIFY_VERSION" = "master" ]; then
mkdir -p ${TEMPDIR}/syncthing-inotify-build/src/github.com/syncthing || exit 1
cd ${TEMPDIR}/syncthing-inotify-build/src/github.com/syncthing
- git clone https://github.com/syncthing/syncthing || exit 1
- git clone https://github.com/syncthing/syncthing-inotify || exit 1
+ [[ ! -d ./syncthing ]] && (git clone https://github.com/syncthing/syncthing || exit 1; )
+ [[ ! -d ./syncthing-inotify ]] && (git clone https://github.com/syncthing/syncthing-inotify || exit 1; )
cd syncthing-inotify
if [ "$SYNCTHING_INOTIFY_CMID" != "" ]; then
git checkout -q $SYNCTHING_INOTIFY_CMID || exit 1
fi
git status
- export GOPATH=$(realpath `pwd`/../../../..)
+ export GOPATH=$(cd ../../../.. && pwd)
version=$(git describe --tags --always | sed 's/^v//')__patch_165
go build -v -i -ldflags "-w -X main.Version=$version" -o ${DESTDIR}/syncthing-inotify${EXT} || exit 1
else
- tarball="syncthing-inotify-${GOOS}-${GOARCH}-v${SYNCTHING_INOTIFY_VERSION}.${TB_EXT}"
+ tarball="syncthing-inotify-${GOOS_STI}-${GOARCH}-v${SYNCTHING_INOTIFY_VERSION}.${TB_EXT}"
curl -sfSL "https://github.com/syncthing/syncthing-inotify/releases/download/v${SYNCTHING_INOTIFY_VERSION}/${tarball}" -O || exit 1
if [ "${TB_EXT}" = "tar.gz" ]; then
tar -xvf "${tarball}" syncthing-inotify && mv syncthing-inotify ${DESTDIR}/syncthing-inotify || exit 1