From c49fedd2a328b09c088353146d8fae351c342522 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Tue, 19 Mar 2019 22:51:15 +0100 Subject: [PATCH] Makefile: add dist goal --- .gitignore | 5 +++++ Makefile | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 443e877..076f233 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,11 @@ /chromium /firefox +/dist + /src/node_modules /src/css /src/js /src/*.log + +*.pem +*.crx diff --git a/Makefile b/Makefile index e4faf91..6cd01cc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,11 @@ -CLEAN_FILES := chromium firefox +VERSION ?= undefined + +CLEAN_FILES := chromium firefox dist +CHROME := $(shell which chromium 2>/dev/null || which chromium-browser 2>/dev/null || which chrome 2>/dev/null || which google-chrome 2>/dev/null || which google-chrome-stable 2>/dev/null) +PEM := $(shell find . -maxdepth 1 -name "*.pem") + +####################### +# For local development .PHONY: all all: extension chromium firefox @@ -46,7 +53,33 @@ firefox/manifest.json : src/manifest-firefox.json [ -d $(dir $@) ] || mkdir -p $(dir $@) cp $< $@ +####################### +# For official releases + .PHONY: clean clean: rm -rf $(CLEAN_FILES) $(MAKE) -C src clean + +.PHONY: crx +crx: +ifneq ($(PEM),) + "$(CHROME)" --disable-gpu --pack-extension=./chromium --pack-extension-key=$(PEM) +else + "$(CHROME)" --disable-gpu --pack-extension=./chromium + rm chromium.pem +endif + mv chromium.crx browserpass.crx + +.PHONY: dist +dist: clean extension chromium firefox crx + mkdir -p dist + + git archive -o dist/$(VERSION).tar.gz --format tar.gz --prefix=browserpass-extension-$(VERSION)/ $(VERSION) + mv browserpass.crx dist/ + + for file in dist/*; do \ + gpg --detach-sign "$$file"; \ + done + + rm -f dist/$(VERSION).tar.gz