forked from FuriLabs/furios-firefox-tweaks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (77 loc) · 3.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 2023 Oliver Smith
# Copyright 2024 Bardia Moshiri
# SPDX-License-Identifier: MPL-2.0
HEADER_FILE := src/common/header.css
USERCHROME_FILES := $(HEADER_FILE) $(sort $(wildcard src/userChrome/*.css))
USERCONTENT_FILES := $(HEADER_FILE) $(sort $(wildcard src/userContent/*.css))
USERCHROME_FILES += src/firefox-gnome-theme/userChrome.css
USERCONTENT_FILES += src/firefox-gnome-theme/userContent.css
PREFIX ?= /usr
DESTDIR :=
FIREFOX_DIR := $(PREFIX)/lib/firefox
FIREFOX_CONFIG_DIR := /etc/firefox
FIREFOX_MOBILE_CONFIG_DIR := $(PREFIX)/share/furios-firefox-tweaks
all: out/userChrome.files out/userContent.files
clean:
rm -rf out
out:
mkdir out
out/userChrome.files: $(USERCHROME_FILES) out
for i in $(USERCHROME_FILES); do \
echo "$$i" | cut -d/ -f 2-; \
done > $@
out/userContent.files: $(USERCONTENT_FILES) out
for i in $(USERCONTENT_FILES); do \
echo "$$i" | cut -d/ -f 2-; \
done > $@
install: all
src/prepare_install.sh "$(FIREFOX_DIR)" "$(DESTDIR)"
install -Dm644 src/policies.json \
"$(DESTDIR)/$(FIREFOX_CONFIG_DIR)/policies/policies.json"
install -Dm644 src/mobile-config-prefs.js \
"$(DESTDIR)/$(FIREFOX_DIR)/defaults/pref/mobile-config-prefs.js"
install -Dm644 src/mobile-config-autoconfig.js \
"$(DESTDIR)/$(FIREFOX_DIR)/mobile-config-autoconfig.js"
install -Dm644 "out/userChrome.files" \
-t "$(DESTDIR)/$(FIREFOX_MOBILE_CONFIG_DIR)"
install -Dm644 "out/userContent.files" \
-t "$(DESTDIR)/$(FIREFOX_MOBILE_CONFIG_DIR)"
install -Dm644 "src/userChrome.js" \
-t "$(DESTDIR)/$(FIREFOX_MOBILE_CONFIG_DIR)"
# Disable crash reporter by writing src/99-firefox-crash-reporter.sh to /etc/profile.d
install -Dm755 src/99-firefox-crash-reporter.sh \
"$(DESTDIR)/etc/profile.d/99-firefox-crash-reporter.sh"
# Disable glxtest
install -Dm755 src/99-firefox-disable-glxtest.sh \
"$(DESTDIR)/etc/profile.d/99-firefox-disable-glxtest.sh"
# Ensure DESTDIR is an absolute path \
DESTDIR=$$(realpath "$(DESTDIR)"); \
walk_dir() { \
echo "1 = $$1" ; \
for i in "$$1"/*; do \
echo "i = $$i"; \
if [ -d "$$i" ]; then \
echo "Installing directory: $$i"; \
walk_dir "$$i"; \
else \
install_path="furios-firefox-tweaks/$$(realpath --relative-to=src $$i)"; \
echo "Installing file: $$i to $$DESTDIR/$(FIREFOX_MOBILE_CONFIG_DIR)/$$install_path"; \
install -Dm644 "$$i" -t "$$DESTDIR/$(FIREFOX_MOBILE_CONFIG_DIR)/$$(dirname "$$install_path")"; \
fi; \
done; \
}; \
cd src; \
for dir in common userChrome userContent firefox-gnome-theme overrides; do \
walk_dir "$$dir"; \
done; \
cd ..
install -Dm644 io.furios.furios_firefox_tweaks.metainfo.xml \
"$(DESTDIR)/$(PREFIX)/share/metainfo/io.furios.furios_firefox_tweaks.metainfo.xml"
uninstall:
src/prepare_uninstall.sh "$(FIREFOX_DIR)" "$(DESTDIR)"
rm -fv "$(DESTDIR)/$(FIREFOX_CONFIG_DIR)/policies/policies.json"
rm -fv "$(DESTDIR)/$(FIREFOX_DIR)/defaults/pref/mobile-config-prefs.js"
rm -fv "$(DESTDIR)/$(FIREFOX_DIR)/mobile-config-autoconfig.js"
rm -rfv "$(DESTDIR)/$(FIREFOX_MOBILE_CONFIG_DIR)"
rm -fv "$(DESTDIR)/$(PREFIX)/share/metainfo/io.furios.furios_firefox_tweaks.metainfo.xml"
.PHONY: all clean install uninstall