This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bash script for building binaries for various platforms
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# | ||
# Simple bash script for building binaries for all relevant platforms | ||
|
||
SCRIPT_DIR=$(dirname $0) | ||
cd ${SCRIPT_DIR} | ||
|
||
# Build | ||
declare -a TARGETS=(darwin linux solaris freebsd) | ||
for target in ${TARGETS[@]} ; do | ||
output="prometheus-zfs-${target}" | ||
echo "Building for ${target}, output bin/${output}" | ||
GOOS=${target} | ||
GOARCH=amd64 | ||
go build -o bin/${output} | ||
done | ||
|
||
# Create a tar-ball for release | ||
DIR_NAME=${PWD##*/} # name of current directory, presumably prometheus-zfs | ||
VERSION=$(git describe --abbrev=0 --tags 2> /dev/null) | ||
if [ "$?" -ne 0 ] ; then | ||
# No tag, use commit hash | ||
HASH=$(git rev-parse HEAD) | ||
VERSION=${HASH:0:7} | ||
fi | ||
|
||
cd ../ | ||
TARBALL="prometheus-zfs-${VERSION}.tar.gz" | ||
tar -cf ${TARBALL} --exclude=.git -vz ${DIR_NAME} | ||
echo "Created: ${PWD}/${TARBALL}" |