summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher 'Chief' Najewicz <chief@beefdisciple.com>2018-10-12 11:24:27 -0400
committerChristopher 'Chief' Najewicz <chief@beefdisciple.com>2018-10-12 11:24:27 -0400
commitd05e6b04ebd42d96885a29eb484a3220742ecbde (patch)
tree479119b770c3d47454aea383c74390d073045e6d
parent16c469d714ee8b38f605afd353e4e95d0be87085 (diff)
Create Makefile to target rpm/dep w/ nfpm
-rw-r--r--.gitignore3
-rw-r--r--Makefile29
-rw-r--r--build/gotop-nfpm.yaml (renamed from build/nfpm.yaml)11
3 files changed, 28 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index 8a9b7d9..0e27b06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-gotop*
dist/
+build/gotop
+pkg/ \ No newline at end of file
diff --git a/Makefile b/Makefile
index 7eec9d0..7ddce40 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,34 @@
VERSION=$(shell awk '/([0-9]{1}.?){3}/ {print $$4;}' main.go)
+.PHONY: all
+all: pkg/gotop.rpm pkg/gotop.deb
+
build/gotop:
- @go build
+ @GOOS=linux GOARCH=amd64 go build -o $@
+
+pkg:
+ @mkdir $@
+
+pkg/gotop.rpm: pkg build/gotop
+ @docker run --rm \
+ -v "$(PWD)/build:/tmp/pkg" \
+ -e "VERSION=$(VERSION)" \
+ goreleaser/nfpm pkg \
+ --config /tmp/pkg/gotop-nfpm.yaml \
+ --target /tmp/pkg/gotop.rpm \
+ && mv ./build/gotop.rpm $@
-build/nfpm.rpm:
+pkg/gotop.deb: pkg build/gotop
@docker run --rm \
-v "$(PWD)/build:/tmp/pkg" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
- --config /tmp/pkg/nfpm.yaml \
- --target /tmp/pkg/nfpm.rpm
+ --config /tmp/pkg/gotop-nfpm.yaml \
+ --target /tmp/pkg/gotop.deb \
+ && mv ./build/gotop.deb $@
+
+.PHONY: clean
+clean:
+ @-rm -f build/gotop
+ @-rm -rf pkg \ No newline at end of file
diff --git a/build/nfpm.yaml b/build/gotop-nfpm.yaml
index 1480108..a15824a 100644
--- a/build/nfpm.yaml
+++ b/build/gotop-nfpm.yaml
@@ -12,13 +12,4 @@ homepage: "https://github.com/cjbassi/gotop"
license: "GNU Affero General Public License v3.0"
bindir: "/usr/local/bin"
files:
- ./gotop: "/usr/local/bin/gotop"
-overrides:
- rpm:
- scripts:
- preinstall: ./scripts/preinstall.sh
- postremove: ./scripts/postremove.sh
- deb:
- scripts:
- postinstall: ./scripts/postinstall.sh
- preremove: ./scripts/preremove.sh
+ /tmp/pkg/gotop: "/usr/local/bin/gotop"