From dae72dd72c5cd17e02b717117db6a6dfc2641059 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:01:06 -0600 Subject: [PATCH] Create Makefile for installation of helper-script --- Makefile | 41 ++++++++++++++++++++++++++++ shellfox.json => shellfox.sh.json.in | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Makefile rename shellfox.json => shellfox.sh.json.in (73%) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d50d5bb --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +ifneq ($(USER),1) + PREFIX ?= /usr/local + MOZILLA_PREFIX ?= /usr + LIBDIR ?= /usr/lib64 + MOZILLA_NATIVE ?= $(LIBDIR)/mozilla/native-messaging-hosts +else + PREFIX ?= $(HOME)/.local + MOZILLA_NATIVE ?= $(HOME)/.mozilla/native-messaging-hosts +endif + +LIBEXEC ?= $(PREFIX)/libexec + +.PHONY: all +all: + @echo "No build step. Available targets:" + @echo "native-install install native app" + @echo "native-uninstall uninstall native app" + @echo "xpi create XPI webex archive" + @echo + @echo "Set USER=1 to target user directories instead." + +# make phony and don't depend on .in file in case $USER changes +.PHONY: shellfox.sh.json +shellfox.sh.json: + sed -e 's|@@NATIVE_PATH@@|$(LIBEXEC)/shellfox/shellfox.sh|' $@.in > $@ + +.PHONY: native-install +native-install: shellfox.sh.json + mkdir -p $(DESTDIR)$(MOZILLA_NATIVE) + cp -f shellfox.sh.json $(DESTDIR)$(MOZILLA_NATIVE)/shellfox.json + mkdir -p $(DESTDIR)$(LIBEXEC)/shellfox + cp -rf shellfox.sh $(DESTDIR)$(LIBEXEC)/shellfox + +.PHONY: native-uninstall +native-uninstall: + rm -f $(DESTDIR)$(MOZILLA_NATIVE)/shellfox.json + rm -rf $(DESTDIR)$(LIBEXEC)/shellfox + +.PHONY: xpi +xpi: + @rm -f shellfox.xpi && zip -r shellfox.xpi background.js _locales/ manifest.json options.* res/*.png diff --git a/shellfox.json b/shellfox.sh.json.in similarity index 73% rename from shellfox.json rename to shellfox.sh.json.in index 893a9d9..f90b67a 100644 --- a/shellfox.json +++ b/shellfox.sh.json.in @@ -1,7 +1,7 @@ { "name": "shellfox", "description": "Edit text with an external editor.", - "path": "/usr/local/libexec/shellfox/shellfox.sh", + "path": "@@NATIVE_PATH@@", "type": "stdio", "allowed_extensions": [ "shellfox@xwx.moe" ] }