summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordb <drebs@riseup.net>2015-01-07 16:16:31 -0200
committerdb <drebs@riseup.net>2015-01-07 17:53:37 -0200
commit5b2e42a8d57037b33964fe59022829e466ab0987 (patch)
tree5e06f00735ac211b9d59d930162c85665dc88f28
parent03d3427b30f7bd242d77a07c6fdca1b51a51cdc9 (diff)
Update Makefile with changes for debian packaging.
-rw-r--r--[-rwxr-xr-x]Makefile81
1 files changed, 38 insertions, 43 deletions
diff --git a/Makefile b/Makefile
index 10d667a..3dcda0e 100755..100644
--- 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=<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