From 9fa0360ca4668c5f17ad8b770c8d83a29ac09c3b Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 6 Jan 2010 17:21:10 +0100 Subject: - drop support for deprecated MOZ_EXT_NAME and MOZ_XPI_MOZILLA_DIRS variable - update src/xpi.mk * install-xpi: - Split xpi installation from xpi.mk into new install-xpi script. - add src/install-xpi - update src/Makefile - update src/xpi.mk - update debian/control --- src/xpi.mk | 114 +++++++++++-------------------------------------------------- 1 file changed, 19 insertions(+), 95 deletions(-) (limited to 'src/xpi.mk') diff --git a/src/xpi.mk b/src/xpi.mk index dbf01a3..a5eebe9 100644 --- a/src/xpi.mk +++ b/src/xpi.mk @@ -33,12 +33,6 @@ # if defined the given .xpi file is used; otherwise we try to # guess one using wildcard (*.xpi) # -# MOZ_XPI_EMID (OPTIONAL): -# if defined the given id is used to determine the link name -# in the Firefox extensions directory. if not defined we try -# our best to extract the em:id from the install.rdf file shipped -# by any xpi -# # MOZ_XPI_BUILD_COMMAND (OPTIONAL): # if defined the given command will be run _before_ the extension # gets packaged up the standard .xpi way. Thus, the build command @@ -48,7 +42,6 @@ # build from source, you have to set this variable to nothing. # # MOZ_XPI_MOZILLA_EXTRA_DIRS (OPTIONAL): -# TODO: implement this! # defines extra directories to link the extension in. Usually # xpi.mk creates the right links based on targetApplication # parsed in install.rdf; if you need more directories, use this. @@ -72,59 +65,36 @@ # permission of the files will be set to 644 and the permissions # of scripts (files containing a shebang) will be set to 755. # -# Deprecated variables: -# -# MOZ_XPI_MOZILLA_DIRS /deprecated/ (OPTIONAL/NODEFAULT - see "Note:"): -# defines in which directories to create links for this -# extension. The default is "firefox-addons", which means that -# the extension will be linked appropriately to the -# /usr/lib/firefox-addons/extensions directory. -# '''Note''': this variable is deprecated and will go away; the -# default is already empty; if you still need this variable, -# migrate your code to MOZ_XPI_MOZILLA_EXTRA_DIRS -# -# MOZ_EXT_NAME /deprecated/ (OPTIONAL): -# this variable is deprecated and will go away; it was renamed -# to MOZ_XPI_EXT_NAME +# Unused variables (can be removed): # +# MOZ_XPI_EMID (OPTIONAL): +# if defined the given id is used to determine the link name +# in the Firefox extensions directory. if not defined we try +# our best to extract the em:id from the install.rdf file shipped +# by any xpi +# '''Note''': this variable is not used any more MOZ_EXTENSION_PKG ?= $(strip $(shell grep ^Package: debian/control | head -n 1 | sed "s/^Package://")) -MOZ_XPI_ARCH := $(strip $(shell egrep '^Package:|^Architecture:' debian/control | grep -A1 '^Package:[ \t]*$(MOZ_EXTENSION_PKG)[ \t]*$$' | grep ^Architecture: | sed -e 's/Architecture://')) - MOZ_XPI_BUILD_COMMAND ?= xpi-pack $(CURDIR) $(MOZ_EXTENSION_PKG).xpi ifneq (,$(MOZ_XPI_FILE)) -XPI_FILE = $(wildcard $(MOZ_XPI_FILE)) -else -XPI_FILE = $(wildcard *.xpi) -endif - -XPI_BASE_FILE = $(notdir $(XPI_FILE)) - -ifneq (,$(MOZ_XPI_EMID)) -XPI_EMID = $(MOZ_XPI_EMID) +xpi_file = $(wildcard $(MOZ_XPI_FILE)) else -XPI_EMID = $(shell xpath -q -e '/node()/Description/em:id/text() | /node()/Description/@em:id | //RDF:Description[@RDF:about="urn:mozilla:install-manifest"]/em:id/text() | //RDF:Description[@RDF:about="urn:mozilla:install-manifest"]/@em:id' $(install_dir)/install.rdf 2>/dev/null | sed -e 's/.*"\(.*\)"/\1/') +xpi_file = $(wildcard *.xpi) endif -ifeq (,$(MOZ_XPI_DISABLE_AUTOLINKS)) -RDF_RESOURCES = $(shell xpath -q -e '//em:targetApplication/@RDF:resource' $(install_dir)/install.rdf 2>/dev/null | sed -e 's/.*="\(.*\)"/\1/') - -XPI_TARGET_EMIDs = \ - $(shell xpath -q -e '//em:targetApplication//em:id/text() | //em:targetApplication//@em:id' $(install_dir)/install.rdf 2>/dev/null | sed -e 's/.*"\(.*\)"/\1/') \ - $(foreach resource,$(RDF_RESOURCES),$(shell xpath -q -e '//RDF:Description[@RDF:about="$(resource)"]/@em:id' $(install_dir)/install.rdf 2>/dev/null | sed -e 's/.*"\(.*\)"/\1/')) +ifneq (,$(MOZ_XPI_PRESERVE_PERMISSIONS)) +install_xpi_extra_parameter += --preserve-permissions endif -# local vars -# + lib_share_dir - for arch all this is "share"; otherwise "lib" -ifeq (all, $(MOZ_XPI_ARCH)) -lib_share_dir := share +ifeq ($(origin MOZ_XPI_DOCUMENTED_LICENSE_FILES),undefined) +install_xpi_extra_parameter += --remove-license-files else -lib_share_dir := lib +install_xpi_extra_parameter += $(foreach exclude,$(MOZ_XPI_DOCUMENTED_LICENSE_FILES),-x $(exclude)) endif -install_dir := debian/$(MOZ_EXTENSION_PKG)/usr/$(lib_share_dir)/$(MOZ_EXTENSION_PKG) +install_xpi_extra_parameter += $(foreach dir,$(MOZ_XPI_MOZILLA_EXTRA_DIRS),-l $dir) # ### cdbs hooks # build xpi using MOZ_XPI_BUILD_COMMAND if defined @@ -135,44 +105,8 @@ endif install/$(MOZ_EXTENSION_PKG):: xpi-install -# ### general helper targets -install-%-stamp: $(XPI_FILE) - @if test ! -f "$^" -a -f "$<"; then \ - echo "xpi.mk: Failed to extract the xpi file, there are multiple: $^"; \ - echo "xpi.mk: Either create only one xpi file or specify MOZ_XPI_FILE!"; \ - exit 1; \ - fi - mkdir -p $(install_dir) -ifneq (,$(MOZ_XPI_DOCUMENTED_LICENSE_FILES)) - unzip -o -d $(install_dir) $^ -x $(MOZ_XPI_DOCUMENTED_LICENSE_FILES) -else - unzip -o -d $(install_dir) $^ -ifeq ($(origin MOZ_XPI_DOCUMENTED_LICENSE_FILES),undefined) - cd $(install_dir) && find \( -iname copying -o -iname gpl.txt -o -iname licen[cs]e -o -iname licen[cs]e.txt \) -printf "xpi.mk: deleted %p\n" -delete -endif -endif -ifeq (,$(MOZ_XPI_PRESERVE_PERMISSIONS)) - find $(install_dir) -type d -exec chmod 755 {} \; - cd $(install_dir) && find * -type f | while read fn; do head -n1 "$$fn" | grep -q "^\#\!" && echo "xpi.mk: Made $$fn executable." && chmod 755 "$$fn" || chmod 644 "$$fn"; done -endif - touch $@ - -installlinks-%-stamp: $(patsubst %,install-%-stamp,$(XPI_BASE_FILE)) - dh_link -p$(MOZ_EXTENSION_PKG) /usr/$(lib_share_dir)/$(MOZ_EXTENSION_PKG) /usr/lib/$*/extensions/$(XPI_EMID) - touch $@ - -autolinks-stamp: $(patsubst %,install-%-stamp,$(XPI_BASE_FILE)) $(foreach mozilla,$(MOZ_XPI_MOZILLA_DIRS),installlinks-$(mozilla)-stamp) - $(if $(XPI_FILE),,@echo "xpi.mk: No xpi file found. Did you create one?"; \ - echo "xpi.mk: Please check MOZ_XPI_BUILD_COMMAND and maybe MOZ_XPI_FILE!"; \ - exit 2) - $(if $(XPI_EMID),,@echo "xpi.mk: Detecting the extension manager ID failed."; \ - echo "xpi.mk: This is either a bug in the install.rdf file or in mozilla-devscripts."; \ - echo "xpi.mk: Patch the install.rdf file or use MOZ_XPI_EMID as workaround."; \ - exit 3) - $(foreach id,$(XPI_TARGET_EMIDs),dh_link -p$(MOZ_EXTENSION_PKG) /usr/$(lib_share_dir)/$(MOZ_EXTENSION_PKG) /usr/lib/mozilla/extensions/$(id)/$(XPI_EMID);) - touch $@ - -xpi-install: $(patsubst %,install-%-stamp,$(XPI_BASE_FILE)) autolinks-stamp +xpi-install: + install-xpi -p$(MOZ_EXTENSION_PKG) $(xpi_file) $(install_xpi_extra_parameter) dh_xul-ext -p$(MOZ_EXTENSION_PKG) ifneq ($(shell grep '$${xpi:Depends}' debian/control),) @echo 'xpi.mk: $${xpi:Depends} is deprecated, please use $${xpi:Recommends} instead.' @@ -181,21 +115,11 @@ ifneq ($(shell grep '$${xpi:Depends}' debian/control),) endif # clean build and remove all .xpi in top-level if a MOZ_XPI_BUILD_COMMAND is defined +ifneq (,$(MOZ_XPI_BUILD_COMMAND)) clean:: dh_testdir dh_clean -ifeq ($(shell expr $(shell cat debian/compat) '<' 7),1) - rm -f *-stamp -endif -ifneq (,$(MOZ_XPI_BUILD_COMMAND)) rm -f *.xpi endif -# debug target -print-vars: - @echo "install_dir: $(install_dir)" - @echo "XPI_EMID: $(XPI_EMID)" - @echo "RDF_RESOURCES: $(RDF_RESOURCES)" - @echo "XPI_TARGET_EMIDs: $(XPI_TARGET_EMIDs)" - -.PHONY: clean xpi-install print-vars +.PHONY: clean xpi-install -- cgit v1.2.3