Skip to content

Commit 9713fb4

Browse files
committed
create binaries
1 parent 86ffd58 commit 9713fb4

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*.dll
55
*.so
66
*.dylib
7-
certmin
7+
certmin*
8+
binaries/
89

910
# Test binary, built with `go test -c`
1011
*.test

create_binaries.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -e
2+
set -xv
3+
APP=certmin
4+
BIN_DIR=binaries
5+
PLATFORMS=("windows/amd64" "darwin/amd64" "linux/amd64")
6+
SRC_DIR=$(pwd)
7+
#BUILD_CMD="go build -a -installsuffix cgo -ldflags -s"
8+
BUILD_CMD="go build"
9+
VERSION=$(git describe --tags)
10+
11+
function build {
12+
GOOS=$1
13+
GOARCH=$2
14+
OUTPUT="${APP}-${VERSION}-${GOOS}-${GOARCH}"
15+
if [ $GOOS = "windows" ]; then
16+
OUTPUT+='.exe'
17+
fi
18+
GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 $BUILD_CMD -o $BIN_DIR/$OUTPUT
19+
cd $BIN_DIR
20+
sha512sum $OUTPUT > $OUTPUT.sha512
21+
cat $OUTPUT.sha512
22+
cd $SRC_DIR
23+
}
24+
25+
mkdir -p $BIN_DIR
26+
for i in ${PLATFORMS[@]}; do
27+
PLATFORMS_SPLIT=(${i//\// })
28+
GOOS=${PLATFORMS_SPLIT[0]}
29+
GOARCH=${PLATFORMS_SPLIT[1]}
30+
build $GOOS $GOARCH
31+
done

0 commit comments

Comments
 (0)