Skip to content

Commit

Permalink
Fix vimperator#566: Extend makefile for signing (vimperator#567)
Browse files Browse the repository at this point in the history
* Fix vimperator#566: Extend makefile for signing

Still experimental, but I tested it successfully.

* Add optional updateURL to XPI and Make

* Create update.rdf file
  • Loading branch information
SammysHP authored and maxauthority committed Oct 20, 2016
1 parent 0c8d13a commit b3bd807
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ downloads/
## Generated by StGit
patches-*
.stgit-*.txt

## Local configuration
private.properties
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DIRS = muttator vimperator
TARGETS = clean help info xpi
TARGETS = clean help info xpi sign
.SILENT:

all: xpi ;
Expand Down
32 changes: 29 additions & 3 deletions common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ COMMON_CHROME_DIRS = content skin modules
XPI_NAME = $(NAME)-$(VERSION)
XPI_PATH = ../downloads/$(XPI_NAME)
XPI = $(XPI_PATH).xpi
XPI_SIGNED = $(XPI_PATH)-signed.xpi
UPD_RDF_PATH = ../downloads/$(NAME)-update.rdf

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

#### rules

TARGETS = all help info xpi clean
TARGETS = all help info xpi clean sign
$(TARGETS:%=\%.%):
@echo MAKE $* $(@:$*.%=%)
$(MAKE) -C $* $(@:$*.%=%)
Expand All @@ -54,6 +56,7 @@ help:
@echo " make info - show some info about the system"
@echo " make xpi - build an XPI ($(XPI_NAME))"
@echo " make clean - clean up"
@echo " make sign - sign XPI (requires private.properties)"

info:
@echo "version $(VERSION)"
Expand All @@ -72,6 +75,9 @@ xpi:
mkdir -p $(XPI_PATH)/common/locale
mkdir -p $(XPI_PATH)/locale

# Copy updateURL.rdf template
cp -Lf ../common/updateURL.rdf.in $(UPD_RDF_PATH)

# Copy top level files
cp -L $(XPI_FILES) $(XPI_PATH)

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

@echo "Replacing ###VERSION### and ###DATE### tags"
for file in `grep -rl -e "###VERSION###" -e "###DATE###" $(XPI_PATH)`; do \
@echo "Replacing UUID, VERSION, DATE and UPDATEURL tags"
for file in `grep -rl -e "###UUID###" -e "###VERSION###" -e "###DATE###" $(XPI_PATH)` $(UPD_RDF_PATH); do \
sed -i -e "s,###UUID###,$(UUID),g" $${file}; \
sed -i -e "s,###VERSION###,$(VERSION),g" $${file}; \
sed -i -e "s,###MINVERSION###,$(MIN_VERSION),g" $${file}; \
sed -i -e "s,###MAXVERSION###,$(MAX_VERSION),g" $${file}; \
sed -i -e "s,###DATE###,$(BUILD_DATE),g" $${file}; \
sed -i -e "s,###UPDATEXPI###,$(UPDATE_URL_XPI),g" $${file}; \
if [ -n "$(UPDATE_URL)" ]; then \
sed -i -e "s,###UPDATEURL###,$(UPDATE_URL),g" $${file}; \
else \
sed -i "/###UPDATEURL###/d" $${file}; \
fi; \
done

# Delete unknown file types
Expand Down Expand Up @@ -150,3 +165,14 @@ xpi:
rm -rf ../downloads/common

@echo "SUCCESS: $(XPI_FILE)"

sign: xpi
@echo "Signing XPI"
jpm sign --api-key $(AMO_API_KEY) --api-secret $(AMO_API_SECRET) --xpi $(XPI)

# Move downloaded file, see https://github.com/mozilla-jetpack/jpm/pull/544
if [ `ls *-fx.xpi 2>/dev/null | wc -l` -eq 1 ]; then \
mv *-fx.xpi $(XPI_SIGNED); \
else \
exit 1; \
fi
22 changes: 22 additions & 0 deletions common/updateURL.rdf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<RDF:Description about="urn:mozilla:extension:###UUID###">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>###VERSION###</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>38.0</em:minVersion>
<em:maxVersion>50.0</em:maxVersion>
<em:updateLink>###UPDATEXPI###</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
</RDF:RDF>
9 changes: 7 additions & 2 deletions vimperator/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#### configuration

VERSION = 3.15.0
NAME = vimperator
VERSION = 3.15.0
NAME = vimperator
UUID = [email protected]
MIN_VERSION = 38.0
MAX_VERSION = 50.0

-include private.properties

include ../common/Makefile
7 changes: 4 additions & 3 deletions vimperator/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:id>###UUID###</em:id>
<em:name>Vimperator</em:name>
<em:version>###VERSION###</em:version>
<em:type>2</em:type> <!-- extension -->
Expand All @@ -13,11 +13,12 @@
<em:homepageURL>http://vimperator.org</em:homepageURL>
<em:iconURL>chrome://vimperator/skin/icon.png</em:iconURL>
<em:optionsURL>chrome://liberator/content/preferences.xul</em:optionsURL>
<em:updateURL>###UPDATEURL###</em:updateURL>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>38.0</em:minVersion>
<em:maxVersion>50.0</em:maxVersion>
<em:minVersion>###MINVERSION###</em:minVersion>
<em:maxVersion>###MAXVERSION###</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
Expand Down
17 changes: 17 additions & 0 deletions vimperator/private.properties.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#### private configuration

################################################################################
# 1. Register at AMO (addons.mozilla.org)
# 2. Create your API key
# (https://addons.mozilla.org/de/developers/addon/api/key/)
# 3. Manually add your add-on as "unlisted" at AMO
# 4. Copy this file to private.properties
# 5. Edit at least UUID, AMO_API_KEY and AMO_API_SECRET.
################################################################################

VERSION := $(VERSION).$(shell date '+%Y%m%d%H%M%S')
UUID = <your UUID>
AMO_API_KEY = <your API key>
AMO_API_SECRET = <your API secret>
UPDATE_URL = <your updateURL if available>
UPDATE_URL_XPI = <link to update XPI>

0 comments on commit b3bd807

Please sign in to comment.