FPMPackageBuilder

nicolaw 21st August 2020 at 2:14pm
Artifactory DebianPackaging JFrogCLI RPM TechnicalNotes
DESTDIR = build
PKGTYPE = deb
prefix = /usr/local
bindir = $(prefix)/bin

jfrog_getcli_url = "https://getcli.jfrog.io"
jfrog_build_bin = "$(DESTDIR)$(bindir)/jfrog"

VERSION = $(shell $(jfrog_build_bin) --version | grep -Eo '[0-9\.]+$')

.PHONY: default package build clean deb rpm

default:
	@echo "Syntax: make [deb|rpm|clean]"

deb: PKGTYPE=deb
deb: package

rpm: PKGTYPE=rpm
rpm: package

package: build
	fpm -s dir -t $(PKGTYPE) -C "$(DESTDIR)" \
		--verbose \
		--name jfrog \
		--version "$(VERSION)" \
		--iteration 1 \
		--maintainer "Nicola Worthington <nicolaw@tfb.net>" \
		--vendor "JFrog Ltd" \
		--license "Apache License v2" \
		--url "https://github.com/jfrogdev/jfrog-cli-go" \
		--category Web \
		--description "JFrog CLI" \
		.

build: jfrog
	install -m 0755 -d "$(DESTDIR)$(bindir)"
	install -m 0755 jfrog "$(DESTDIR)$(bindir)"

jfrog:
	curl -fL $(jfrog_getcli_url) | sh

clean:
	rm -Rfv build jfrog *.deb *.rpm