diff --git a/build-windows-amd64.sh b/build-windows-amd64.sh new file mode 100755 index 0000000000000000000000000000000000000000..2102348e4a1815813063eb0b6082a460129d5847 --- /dev/null +++ b/build-windows-amd64.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# for windows and Mac check the README +# +BIN_NAME=acme-downloader +PATH=$PATH:$(go env GOPATH)/bin +GOPATH=$(go env GOPATH) +PROG_VERSION="1.0" +BUILDTIME=$(date -u '+%Y-%m-%d_%H:%M:%S') +export BIN_NAME PATH GOPATH PROG_VERSION BUILDTIME + +REPO_DIR=$(dirname $0) +if [ "$REPO_DIR" = '.' ]; then + REPO_DIR=`pwd` +fi +ln -sf "$REPO_DIR" "${GOPATH}/src/" +REPO_NAME=$(basename "$REPO_DIR") +cd $REPO_NAME + +# env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" . +env GOOS=windows GOARCH=amd64 go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" . +if [ $? -gt 0 ]; then + echo -e "\nthere was an error while compiling the code\n" + exit +fi +echo "" + + +#run_upx() { +# if ! which upx &>/dev/null; then +# echo "please download upx here https://github.com/upx/upx/releases" +# echo "and store the executable within your \$PATH" +# exit +# fi +# upx --brute ${GOPATH}/bin/${BIN_NAME} +#} + +#while true; do +# read -p "Do you wish to run upx against ${BIN_NAME}? (y/n) " yn +# case $yn in +# [Yy]*) +# echo "" +# run_upx +# break +# ;; +# [Nn]*) break ;; +# *) echo "Please answer yes or no." ;; +# esac +#done + +#echo -e "\nthe binary was compiled and it is avilable as:\n - ${GOPATH}/bin/${BIN_NAME}\n" diff --git a/build.sh b/build.sh index 74c6d616117c79f4eaff4f50522f7749f85eb96f..aaa3820bdc98a099fee6ade93d47a05c10ccf07f 100755 --- a/build.sh +++ b/build.sh @@ -5,12 +5,20 @@ BIN_NAME=acme-downloader PATH=$PATH:$(go env GOPATH)/bin GOPATH=$(go env GOPATH) -export BIN_NAME PATH GOPATH +PROG_VERSION="1.0" +BUILDTIME=$(date -u '+%Y-%m-%d_%H:%M:%S') +export BIN_NAME PATH GOPATH PROG_VERSION BUILDTIME + +REPO_DIR=$(dirname $0) +if [ "$REPO_DIR" = '.' ]; then + REPO_DIR=`pwd` +fi +ln -sf "$REPO_DIR" "${GOPATH}/src/" +REPO_NAME=$(basename "$REPO_DIR") +cd $REPO_NAME #LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) #PROG_VERSION=$(echo $LATEST_TAG | sed -e 's/^v//') -PROG_VERSION="1.0" -BUILDTIME=$(date -u '+%Y-%m-%d_%H:%M:%S') run_upx() { if ! which upx &>/dev/null; then @@ -21,6 +29,7 @@ run_upx() { upx --brute ${GOPATH}/bin/${BIN_NAME} } + rm -rf ${GOPATH}/src/github.com/maxadamo/${BIN_NAME} ${GOPATH}/src/gitlab.geant.net/devops/${BIN_NAME} #go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" gitlab.geant.net/devops/${BIN_NAME} go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" .