From 5b2e42a8d57037b33964fe59022829e466ab0987 Mon Sep 17 00:00:00 2001 From: db Date: Wed, 7 Jan 2015 16:16:31 -0200 Subject: Update Makefile with changes for debian packaging. --- Makefile | 81 ++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 38 insertions(+), 43 deletions(-) mode change 100755 => 100644 Makefile diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 10d667a..3dcda0e --- a/Makefile +++ b/Makefile @@ -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= CERTNAME= DEFAULTKEY=" -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=") -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=") +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= CERTNAME= DEFAULTKEY=" +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 -- cgit v1.2.3