Browse Source

Build artefacts in build dir

Jakob Borg 12 years ago
parent
commit
001a6724ec
2 changed files with 9 additions and 5 deletions
  1. 1 0
      .gitignore
  2. 8 5
      build.sh

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 syncthing
 *.tar.gz
+build

+ 8 - 5
build.sh

@@ -3,17 +3,20 @@
 version=$(git describe --always)
 
 go test ./... || exit 1
+mkdir -p build || exit 1
 
 for goos in darwin linux freebsd ; do
 	for goarch in amd64 386 ; do
 		echo "$goos-$goarch"
 		export GOOS="$goos"
 		export GOARCH="$goarch"
+		export name="syncthing-$goos-$goarch"
 		go build -ldflags "-X main.Version $version" \
-		&& mkdir -p "syncthing-$goos-$goarch" \
-		&& mv syncthing "syncthing-$goos-$goarch" \
-		&& cp syncthing.ini "syncthing-$goos-$goarch" \
-		&& tar zcf "syncthing-$goos-$goarch.tar.gz" "syncthing-$goos-$goarch" \
-		&& rm -r  "syncthing-$goos-$goarch"
+		&& mkdir -p "$name" \
+		&& mv syncthing "$name" \
+		&& cp syncthing.ini "$name" \
+		&& tar zcf "$name.tar.gz" "$name" \
+		&& rm -r  "$name" \
+		&& mv "$name.tar.gz" build
 	done
 done