From 4e696259948aae90d381711df474ee66ed600f61 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Wed, 6 Mar 2019 05:38:15 +0500 Subject: [PATCH] Simple builder that builds OpenSAPS for every known OS. Some might be missing, MRs welcome :). --- .gitignore | 2 ++ builder.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 builder.sh diff --git a/.gitignore b/.gitignore index 09e1548..986e7c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *DS_Store* opensaps.yaml +dist +opensaps diff --git a/builder.sh b/builder.sh new file mode 100755 index 0000000..ff44e8d --- /dev/null +++ b/builder.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +VERSION=$1 +if [ "${VERSION}" == "" ]; then + echo "Specify version as first parameter!" + exit 1 +fi + +OS_LIST=("darwin/amd64" "dragonfly/amd64" "freebsd/386" "freebsd/amd64" "freebsd/arm" "linux/386" "linux/amd64" "linux/arm" "linux/arm64" "linux/ppc64" "linux/ppc64le" "linux/mips" "linux/mipsle" "linux/mips64" "linux/mips64le" "linux/s390x" "netbsd/386" "netbsd/amd64" "netbsd/arm" "openbsd/386" "openbsd/amd64" "openbsd/arm" "solaris/amd64" "windows/386" "windows/amd64") + +if [ ! -d ./dist ]; then + mkdir -p ./dist +fi + +for os in ${OS_LIST[@]}; do + mkdir -p ./dist/${os} + goos=$(echo ${os} | awk -F"/" '{ print $1 }') + goarch=$(echo ${os} | awk -F"/" '{ print $2 }') + echo "Building for ${goos} ${goarch}..." + GOOS=${goos} GOARCH=${goarch} go build -o ./dist/${os}/opensaps opensaps.go + cp opensaps.example.yaml ./dist/${os}/opensaps.yaml + cd ./dist/${os}/ + tar -czf opensaps-${VERSION}-${goos}-${goarch}.tar.gz opensaps opensaps.yaml + mv opensaps-${VERSION}-${goos}-${goarch}.tar.gz ../../ + cd - &>/dev/null +done \ No newline at end of file