Last active
August 29, 2015 14:02
-
-
Save tynn/c30e07db2fe8e41a02c8 to your computer and use it in GitHub Desktop.
Build Mozilla Add-on file from directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 2014 CC0 http://creativecommons.org/publicdomain/zero/1.0/ | |
IFS="$(printf '\n\t')" | |
[ -f .xpi-include ] && I="-d $(cat .xpi-include)" | |
[ -f .xpi-exclude ] && X=-x@.xpi-exclude | |
ls $I | zip -r "$(basename $(pwd)).xpi" -@ -x"*.xpi" $X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/make -f | |
# 2014 CC0 http://creativecommons.org/publicdomain/zero/1.0/ | |
NAME := $(notdir $(CURDIR)) | |
XPI := $(NAME).xpi | |
DEFAULT_LOCALE := en | |
LOCALE_DIR := locale | |
default_locale = $(LOCALE_DIR)/$(DEFAULT_LOCALE)/ | |
L10N := $(wildcard $(LOCALE_DIR)/*/*) | |
chrome.manifest.in = $(wildcard chrome.manifest.in) | |
CONTENT := $(wildcard bootstrap.js) $(wildcard icon.png) $(wildcard icon64.png)\ | |
install.rdf $(if $(L10N)$(chrome.manifest.in),chrome.manifest)\ | |
$(shell cat .xpi-include) $(wildcard options.xul) | |
.PHONY: clean realclean | |
$(XPI): $(CONTENT) $(L10N) | |
zip -r $@ $? | |
chrome.manifest: $(chrome.manifest.in) $(L10N) | |
@echo creating $@ ... | |
$(shell sed '/^locale[[:space:]]\+$(NAME)/d' $@.in >$@) | |
$(if $(L10N),\ | |
$(eval locales := $(dir $(L10N)))\ | |
$(foreach locale,\ | |
$(findstring $(default_locale),$(locales)) $(filter-out $(default_locale),$(locales)),\ | |
$(file >>$@,locale $(NAME) $(notdir $(locale:%/=%)) $(locale)))) | |
clean: | |
$(RM) $(XPI) | |
realclean: clean | |
$(RM) chrome.manifest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment