diff options
-rw-r--r--[-rwxr-xr-x] | Makefile | 81 |
1 files changed, 38 insertions, 43 deletions
@@ -1,61 +1,48 @@ EXTNAME := bitmask-thunderbird +XPINAME := bitmask.xpi # debian package will use this name PREFIX := . FILES_TO_PACKAGE := chrome,chrome.manifest,install.rdf RSA_FILE := META-INF/zigbert.rsa # the following variables are updated automatically COMMIT := $(shell git --no-pager log -1 --format=format:%h) -VERSION = $(shell head -n1 CHANGELOG | cut -d" " -f1) +VERSION := $(shell head -n1 CHANGELOG | cut -d" " -f1) PKGNAME := $(EXTNAME)-$(VERSION)-$(COMMIT).xpi TARGET := $(CURDIR)/build/$(PKGNAME) TEMPDIR := $(shell mktemp -d -u) -# make sure CERTDIR and CERTNAME are defined for signing -USAGE := "Usage: make CERTDIR=<certificate directory> CERTNAME=<certificate name> DEFAULTKEY=<key id>" -ifeq ($(MAKECMDGOALS),signed) -ifndef CERTDIR - $(error $(USAGE)) -endif -ifndef CERTNAME - $(error $(USAGE)) -endif -ifndef DEFAULTKEY - $(error $(USAGE)) -endif -endif - -# make sure DEFAULTKEY was given to sign the calculated hashes -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),upload) -ifndef DEFAULTKEY - $(error "Usage: make DEFAULTKEY=<key id>") -endif -endif -endif - - -# main rule -all: clean $(TARGET) +XPI_CONTENTS := $(shell find chrome -name "*.html" -o -name "*.xhtml" -o -name "*.css" -o -name "*.png" -o -name "*.gif" -o -name "*.js" -o -name "*.jsm" -o -name "*.dtd" -o -name "*.xul" -o -name "messages" -o -name "*.properties") chrome.manifest install.rdf COPYING #----------------------------------------------------------------------------- # debhelper targets #----------------------------------------------------------------------------- -XPI_CONTENTS:=$(shell find chrome -name "*.html" -o -name "*.xhtml" -o -name "*.css" -o -name "*.png" -o -name "*.gif" -o -name "*.js" -o -name "*.jsm" -o -name "*.dtd" -o -name "*.xul" -o -name "messages" -o -name "*.properties") chrome.manifest install.rdf COPYING - -bitmask.xpi: $(XPI_CONTENTS) +$(XPINAME): $(XPI_CONTENTS) zip $@ $(XPI_CONTENTS) +install.rdf: install.rdf.template Changelog + sed 's/__VERSION__/$(VERSION)/' < $< > $@ + xpi_release: ln -s $(XPINAME) $(PKGNAME) +debian-package: + git buildpackage -us -uc + #----------------------------------------------------------------------------- # unsigned XPI file #----------------------------------------------------------------------------- -$(TARGET): clean install.rdf +# make sure DEFAULTKEY is defined to sign the calculated hashes +ifeq ($(MAKECMDGOALS),unsigned) +ifndef DEFAULTKEY + $(error "Usage: make DEFAULTKEY=<key id>") +endif +endif + +unsigned: clean install.rdf mkdir -p $(TEMPDIR) mkdir -p `dirname $@` cp -r $(PREFIX)/{$(FILES_TO_PACKAGE)} $(TEMPDIR)/ @@ -69,29 +56,37 @@ $(TARGET): clean install.rdf # signed XPI file #----------------------------------------------------------------------------- +# make sure CERTDIR, CERTNAME and DEFAULTKEY are defined for signing +ifeq ($(MAKECMDGOALS),signed) +USAGE := "Usage: make CERTDIR=<certificate directory> CERTNAME=<certificate name> DEFAULTKEY=<key id>" +ifndef CERTDIR + $(error $(USAGE)) +endif +ifndef CERTNAME + $(error $(USAGE)) +endif +ifndef DEFAULTKEY + $(error $(USAGE)) +endif +endif + signed: clean install.rdf mkdir -p $(TEMPDIR) mkdir -p `dirname $@` cp -r $(PREFIX)/{$(FILES_TO_PACKAGE)} $(TEMPDIR)/ rm -rf $(TEMPDIR)/.gitignore signtool -d $(CERTDIR) -k $(CERTNAME) $(TEMPDIR)/ - (cd $(TEMPDIR) && zip $(TARGET) ./$(RSA_FILE) && zip -r -D $(TARGET) ./ -x ./$(RSA_FILE)) + (cd $(TEMPDIR) && zip $(TARGET) ./$(RSA_FILE) && zip -D $@ $(XPI_CONTENTS) -x ./$(RSA_FILE)) rm -rf $(TEMPDIR) (cd build/ && sha512sum $(PKGNAME) > SHA512SUMS && gpg -a --default-key $(DEFAULTKEY) --detach-sign SHA512SUMS) -clean: - rm -f $(TARGET) build/* - rm -f install.rdf - upload: ssh downloads.leap.se rm -rf /var/www/leap-downloads/public/thunderbird_extension/* scp build/* downloads.leap.se:/var/www/leap-downloads/public/thunderbird_extension/ -debian-package: - git buildpackage -us -uc - -install.rdf: install.rdf.template Changelog - sed 's/__VERSION__/$(VERSION)/' < $< > $@ - +clean: + rm -f $(TARGET) build/* + rm -f *.xpi + rm -f install.rdf -.PHONY: all clean signed +.PHONY: all clean xpi_release unsigned signed upload debian-package |