From 8d8e9166ab759d1639bcd80e98dd5f2a04519914 Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Thu, 6 Dec 2018 12:54:17 +0000 Subject: [PATCH] homebrew preparation --- .circleci/config.yml | 3 ++- Makefile | 5 ++--- build.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100755 build.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bd9efe..33a1a90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,4 +102,5 @@ workflows: tags: only: /^v.*/ branches: - ignore: /.*/ \ No newline at end of file + ignore: /.*/ + diff --git a/Makefile b/Makefile index f750af1..6762aea 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,7 @@ FONTPATH := ./gui/packed-fonts .PHONY: build build: test install-tools - packr -v - go build -ldflags "-X github.com/liamg/aminal/version.Version=`git describe --tags`" + ./build.sh `git describe --tags` .PHONY: test test: @@ -34,4 +33,4 @@ build-darwin: .PHONY: package-debian package-debian: build-linux - ./scripts/package-debian.sh "${CIRCLE_TAG}" bin/linux/${BINARY}-linux-amd64 \ No newline at end of file + ./scripts/package-debian.sh "${CIRCLE_TAG}" bin/linux/${BINARY}-linux-amd64 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..823b974 --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -eux + +version="$1" + +if [[ "$version" == "" ]]; then + version=`git describe --tags` +fi + +if [[ "$version" == "" ]]; then + echo "Error: Cannot determine version" + exit 1 +fi + +export GOPATH="/tmp/.gobuild" +SRCDIR="${GOPATH}/src/github.com/liamg/aminal" + +[ -d ${GOPATH} ] && rm -rf ${GOPATH} +mkdir -p ${GOPATH}/{src,pkg,bin} +mkdir -p ${SRCDIR} +cp -r . ${SRCDIR} +( + echo ${GOPATH} + cd ${SRCDIR} + go install -ldflags "-X github.com/liamg/aminal/version.Version=$version" +) +