blob: 32a424e37a5559d45f4c3af46b0317246246b091 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
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)
PKGNAME := $(EXTNAME)-$(VERSION)-$(COMMIT).xpi
TARGET := $(CURDIR)/build/$(PKGNAME)
TEMPDIR := $(shell mktemp -d -u)
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
#-----------------------------------------------------------------------------
$(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
#-----------------------------------------------------------------------------
# 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)/
rm -rf $(TEMPDIR)/.gitignore
(cd $(TEMPDIR) && zip -r $(TARGET) ./)
rm -rf $(TEMPDIR)
(cd build/ && sha512sum $(PKGNAME) > SHA512SUMS && gpg -a --default-key $(DEFAULTKEY) --detach-sign SHA512SUMS)
#-----------------------------------------------------------------------------
# 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 -D $@ $(XPI_CONTENTS) -x ./$(RSA_FILE))
rm -rf $(TEMPDIR)
(cd build/ && sha512sum $(PKGNAME) > SHA512SUMS && gpg -a --default-key $(DEFAULTKEY) --detach-sign SHA512SUMS)
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/
clean:
rm -f $(TARGET) build/*
rm -f *.xpi
rm -f install.rdf
.PHONY: all clean xpi_release unsigned signed upload debian-package
|