scripts: build script

This commit is contained in:
Mitchell Hashimoto 2014-07-28 10:53:36 -07:00
parent ab411a1952
commit b569a5d8b6
3 changed files with 23 additions and 1 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ terraform.tfstate
bin/
config/y.go
config/y.output
pkg/
vendor/
website/.vagrant
website/build

View File

@ -16,9 +16,12 @@ export CGO_CFLAGS CGO_LDFLAGS PATH
default: test
dev: config/y.go libucl
bin: config/y.go libucl
@sh -c "$(CURDIR)/scripts/build.sh"
dev: config/y.go libucl
@TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"
libucl: vendor/libucl/$(LIBUCL_NAME)
test: config/y.go libucl

View File

@ -30,6 +30,10 @@ fi
echo "--> Getting dependencies..."
go get ./...
# Delete the old dir
echo "--> Removing old directory..."
rm -f bin/*
# Build!
echo "--> Building..."
gox \
@ -41,6 +45,20 @@ gox \
mv bin/terraform-terraform${EXTENSION} bin/terraform${EXTENSION}
cp bin/terraform* ${GOPATHSINGLE}/bin
# If we're on Windows, get the DLL in there
if [ "$(go env GOOS)" = "windows" ]; then
cp libucl.dll bin/
fi
if [ "${TF_DEV}x" = "x" ]; then
# Zip and copy to the dist dir
echo "--> Packaging..."
mkdir -p pkg
cd bin/
zip ../pkg/$(go env GOOS)_$(go env GOARCH).zip ./*
cd $DIR
fi
# Done!
echo
echo "--> Results:"