-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
53 lines (42 loc) · 1.94 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
SHELL := /bin/bash
# Replace these with the name and domain of your extension!
NAME := FileSort
DOMAIN := austin.tinius.me
ZIP_NAME := $(NAME)@$(DOMAIN).zip
# These files will be included in the extension zip. If you have additional files in your
# extension, these should be added here.
JS_FILES = $(shell find -type f -and \( -name "*.js" \))
ZIP_CONTENT = $(JS_FILES) schemas/gschemas.compiled schemas/org.gnome.shell.extensions.$(NAME).gschema.xml prefs.ui metadata.json LICENSE stylesheet.css
# These four recipes can be invoked by the user.
.PHONY: zip install uninstall clean
# The zip recipes only bundles the extension without installing it.
zip: $(ZIP_NAME)
# The install recipes creates the extension zip and installs it.
install: $(ZIP_NAME)
gnome-extensions install "$(ZIP_NAME)" --force
@echo "Extension installed successfully! Now restart the Shell ('Alt'+'F2', then 'r')."
# This uninstalls the previously installed extension.
uninstall:
gnome-extensions uninstall "$(NAME)@$(DOMAIN)"
# This removes all temporary files created with the other recipes.
clean:
rm -f $(ZIP_NAME) \
schemas/gschemas.compiled
# This bundles the extension and checks whether it is small enough to be uploaded to
# extensions.gnome.org. We do not use "gnome-extensions pack" for this, as this is not
# readily available on the GitHub runners.
$(ZIP_NAME): $(ZIP_CONTENT)
@echo "Packing zip file..."
@rm --force $(ZIP_NAME)
@zip $(ZIP_NAME) -- $(ZIP_CONTENT)
@#Check if the zip size is too big to be uploaded
@SIZE=$$(unzip -Zt $(ZIP_NAME) | awk '{print $$3}') ; \
if [[ $$SIZE -gt 5242880 ]]; then \
echo "ERROR! The extension is too big to be uploaded to" \
"the extensions website, keep it smaller than 5 MB!"; \
exit 1; \
fi
# Compiles the gschemas.compiled file from the gschema.xml file.
schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.$(NAME).gschema.xml
@echo "Compiling schemas..."
@glib-compile-schemas schemas