Skip to content

Commit b3bd807

Browse files
SammysHPmaxauthority
authored andcommitted
Fix #566: Extend makefile for signing (#567)
* Fix #566: Extend makefile for signing Still experimental, but I tested it successfully. * Add optional updateURL to XPI and Make * Create update.rdf file
1 parent 0c8d13a commit b3bd807

File tree

7 files changed

+83
-9
lines changed

7 files changed

+83
-9
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ downloads/
3131
## Generated by StGit
3232
patches-*
3333
.stgit-*.txt
34+
35+
## Local configuration
36+
private.properties

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DIRS = muttator vimperator
2-
TARGETS = clean help info xpi
2+
TARGETS = clean help info xpi sign
33
.SILENT:
44

55
all: xpi ;

common/Makefile

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ COMMON_CHROME_DIRS = content skin modules
1313
XPI_NAME = $(NAME)-$(VERSION)
1414
XPI_PATH = ../downloads/$(XPI_NAME)
1515
XPI = $(XPI_PATH).xpi
16+
XPI_SIGNED = $(XPI_PATH)-signed.xpi
17+
UPD_RDF_PATH = ../downloads/$(NAME)-update.rdf
1618

1719
ifeq ($(TOPLEVEL),)
1820
XPI_FILE = $(XPI)
@@ -39,7 +41,7 @@ LOCALE_MAP = . locale $(NAME)\n.. common/locale liberator\n
3941

4042
#### rules
4143

42-
TARGETS = all help info xpi clean
44+
TARGETS = all help info xpi clean sign
4345
$(TARGETS:%=\%.%):
4446
@echo MAKE $* $(@:$*.%=%)
4547
$(MAKE) -C $* $(@:$*.%=%)
@@ -54,6 +56,7 @@ help:
5456
@echo " make info - show some info about the system"
5557
@echo " make xpi - build an XPI ($(XPI_NAME))"
5658
@echo " make clean - clean up"
59+
@echo " make sign - sign XPI (requires private.properties)"
5760

5861
info:
5962
@echo "version $(VERSION)"
@@ -72,6 +75,9 @@ xpi:
7275
mkdir -p $(XPI_PATH)/common/locale
7376
mkdir -p $(XPI_PATH)/locale
7477

78+
# Copy updateURL.rdf template
79+
cp -Lf ../common/updateURL.rdf.in $(UPD_RDF_PATH)
80+
7581
# Copy top level files
7682
cp -L $(XPI_FILES) $(XPI_PATH)
7783

@@ -113,10 +119,19 @@ xpi:
113119
sed -i -e 's# ./locale/# locale/#' $(XPI_PATH)/chrome.manifest
114120
sed -i -e 's#../common/#common/#' $(XPI_PATH)/chrome.manifest
115121

116-
@echo "Replacing ###VERSION### and ###DATE### tags"
117-
for file in `grep -rl -e "###VERSION###" -e "###DATE###" $(XPI_PATH)`; do \
122+
@echo "Replacing UUID, VERSION, DATE and UPDATEURL tags"
123+
for file in `grep -rl -e "###UUID###" -e "###VERSION###" -e "###DATE###" $(XPI_PATH)` $(UPD_RDF_PATH); do \
124+
sed -i -e "s,###UUID###,$(UUID),g" $${file}; \
118125
sed -i -e "s,###VERSION###,$(VERSION),g" $${file}; \
126+
sed -i -e "s,###MINVERSION###,$(MIN_VERSION),g" $${file}; \
127+
sed -i -e "s,###MAXVERSION###,$(MAX_VERSION),g" $${file}; \
119128
sed -i -e "s,###DATE###,$(BUILD_DATE),g" $${file}; \
129+
sed -i -e "s,###UPDATEXPI###,$(UPDATE_URL_XPI),g" $${file}; \
130+
if [ -n "$(UPDATE_URL)" ]; then \
131+
sed -i -e "s,###UPDATEURL###,$(UPDATE_URL),g" $${file}; \
132+
else \
133+
sed -i "/###UPDATEURL###/d" $${file}; \
134+
fi; \
120135
done
121136

122137
# Delete unknown file types
@@ -150,3 +165,14 @@ xpi:
150165
rm -rf ../downloads/common
151166

152167
@echo "SUCCESS: $(XPI_FILE)"
168+
169+
sign: xpi
170+
@echo "Signing XPI"
171+
jpm sign --api-key $(AMO_API_KEY) --api-secret $(AMO_API_SECRET) --xpi $(XPI)
172+
173+
# Move downloaded file, see https://github.com/mozilla-jetpack/jpm/pull/544
174+
if [ `ls *-fx.xpi 2>/dev/null | wc -l` -eq 1 ]; then \
175+
mv *-fx.xpi $(XPI_SIGNED); \
176+
else \
177+
exit 1; \
178+
fi

common/updateURL.rdf.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
3+
<RDF:Description about="urn:mozilla:extension:###UUID###">
4+
<em:updates>
5+
<RDF:Seq>
6+
<RDF:li>
7+
<RDF:Description>
8+
<em:version>###VERSION###</em:version>
9+
<em:targetApplication>
10+
<RDF:Description>
11+
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
12+
<em:minVersion>38.0</em:minVersion>
13+
<em:maxVersion>50.0</em:maxVersion>
14+
<em:updateLink>###UPDATEXPI###</em:updateLink>
15+
</RDF:Description>
16+
</em:targetApplication>
17+
</RDF:Description>
18+
</RDF:li>
19+
</RDF:Seq>
20+
</em:updates>
21+
</RDF:Description>
22+
</RDF:RDF>

vimperator/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#### configuration
22

3-
VERSION = 3.15.0
4-
NAME = vimperator
3+
VERSION = 3.15.0
4+
NAME = vimperator
5+
6+
MIN_VERSION = 38.0
7+
MAX_VERSION = 50.0
8+
9+
-include private.properties
510

611
include ../common/Makefile

vimperator/install.rdf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
33
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
44
<Description about="urn:mozilla:install-manifest">
5-
<em:id>[email protected]</em:id>
5+
<em:id>###UUID###</em:id>
66
<em:name>Vimperator</em:name>
77
<em:version>###VERSION###</em:version>
88
<em:type>2</em:type> <!-- extension -->
@@ -13,11 +13,12 @@
1313
<em:homepageURL>http://vimperator.org</em:homepageURL>
1414
<em:iconURL>chrome://vimperator/skin/icon.png</em:iconURL>
1515
<em:optionsURL>chrome://liberator/content/preferences.xul</em:optionsURL>
16+
<em:updateURL>###UPDATEURL###</em:updateURL>
1617
<em:targetApplication>
1718
<Description>
1819
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
19-
<em:minVersion>38.0</em:minVersion>
20-
<em:maxVersion>50.0</em:maxVersion>
20+
<em:minVersion>###MINVERSION###</em:minVersion>
21+
<em:maxVersion>###MAXVERSION###</em:maxVersion>
2122
</Description>
2223
</em:targetApplication>
2324
</Description>

vimperator/private.properties.in

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#### private configuration
2+
3+
################################################################################
4+
# 1. Register at AMO (addons.mozilla.org)
5+
# 2. Create your API key
6+
# (https://addons.mozilla.org/de/developers/addon/api/key/)
7+
# 3. Manually add your add-on as "unlisted" at AMO
8+
# 4. Copy this file to private.properties
9+
# 5. Edit at least UUID, AMO_API_KEY and AMO_API_SECRET.
10+
################################################################################
11+
12+
VERSION := $(VERSION).$(shell date '+%Y%m%d%H%M%S')
13+
UUID = <your UUID>
14+
AMO_API_KEY = <your API key>
15+
AMO_API_SECRET = <your API secret>
16+
UPDATE_URL = <your updateURL if available>
17+
UPDATE_URL_XPI = <link to update XPI>

0 commit comments

Comments
 (0)