From 338a04f7fd051bb4066b5e6fa58be571b8a13e6d Mon Sep 17 00:00:00 2001 From: = <34382191+wins1ey@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:18:26 +0000 Subject: [PATCH 01/13] Use install command to make directories --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0a14e0f..f0441cf 100644 --- a/Makefile +++ b/Makefile @@ -44,21 +44,22 @@ last-gtk.h: $(SRC_DIR)/last-gtk.css xxd --include $(SRC_DIR)/last-gtk.css > $(SRC_DIR)/last-gtk.h || (rm $(SRC_DIR)/last-gtk.h; false) install: - cp $(TARGET) $(BIN_DIR)/$(BIN) - cp $(APP) $(APP_DIR) + install -Dm755 $(TARGET) $(BIN_DIR)/$(BIN) + install -Dm644 $(APP) $(APP_DIR)/$(APP) for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ - convert $(ICON).svg -resize "$$size"x"$$size" \ - $(ICON_DIR)/"$$size"x"$$size"/apps/$(ICON).png ; \ + mkdir -p $(ICON_DIR)/"$$size"x"$$size"/apps ; \ + convert $(ICON).svg -resize "$$size"x"$$size" \ + $(ICON_DIR)/"$$size"x"$$size"/apps/$(ICON).png ; \ done gtk-update-icon-cache -f -t $(ICON_DIR) - cp $(SRC_DIR)/$(SCHEMA) $(SCHEMAS_DIR) + install -Dm644 $(SRC_DIR)/$(SCHEMA) $(SCHEMAS_DIR)/$(SCHEMA) glib-compile-schemas $(SCHEMAS_DIR) uninstall: rm -f $(BIN_DIR)/$(BIN) rm -f $(APP_DIR)/$(APP) for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ - rm -f $(ICON_DIR)/"$$size"x"$$size"/apps/$(ICON).png ; \ + rm -f $(ICON_DIR)/"$$size"x"$$size"/apps/$(ICON).png ; \ done remove-schema: From f5c9f8ea3c29678ce07a96cba06ced5b260ea356 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 26 Mar 2024 01:09:33 +0000 Subject: [PATCH 02/13] Rename build target to 'all' and add 'all' dependency for 'install' --- Makefile | 6 +++--- README.md | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f0441cf..02ccceb 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ ICON_DIR := /usr/share/icons/hicolor SCHEMA := last.gschema.xml SCHEMAS_DIR := /usr/share/glib-2.0/schemas -build: last-gtk.h $(TARGET) +all: last-gtk.h $(TARGET) # Rule to link object files to create executable $(TARGET): $(OBJECTS) @@ -43,7 +43,7 @@ $(OBJ_DIR): last-gtk.h: $(SRC_DIR)/last-gtk.css xxd --include $(SRC_DIR)/last-gtk.css > $(SRC_DIR)/last-gtk.h || (rm $(SRC_DIR)/last-gtk.h; false) -install: +install: all install -Dm755 $(TARGET) $(BIN_DIR)/$(BIN) install -Dm644 $(APP) $(APP_DIR)/$(APP) for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ @@ -70,4 +70,4 @@ remove-schema: clean: rm -rf $(TARGET) $(OBJ_DIR) $(SRC_DIR)/last-gtk.h -.PHONY: build last-gtk.h install uninstall remove-schema clean +.PHONY: all last-gtk.h install uninstall remove-schema clean diff --git a/README.md b/README.md index 9494bdf..a07b5a4 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,14 @@ And to install: ## Installation ```bash -git clone https://github.com/Wins1ey/LAST +git clone https://github.com/wins1ey/LAST cd LAST -sudo make build install +make +sudo make install +``` +or +```bash +git clone https://github.com/wins1ey/LAST && cd LAST && make && sudo make install ``` ## Getting Started From 4b40f09878bf7aac22cc9edf823df392f24cfdfc Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 26 Mar 2024 02:19:47 +0000 Subject: [PATCH 03/13] Refactor Makefile for AUR package --- .gitignore | 2 +- Makefile | 43 ++++++++++++++++++++----------------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index b67f9a1..6d5c46e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Compiled files -LAST +last obj/ src/last-gtk.h diff --git a/Makefile b/Makefile index 02ccceb..b96eb05 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TARGET := LAST +BIN := last INC := `pkg-config --cflags gtk+-3.0 x11 jansson lua` CFLAGS := -std=gnu99 -O2 -pthread -Wall -Wno-unused-parameter @@ -13,19 +13,17 @@ COMPONENTS := $(wildcard $(SRC_DIR)/components/*.c) OBJECTS := $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SOURCES)) \ $(patsubst $(SRC_DIR)/components/%.c, $(OBJ_DIR)/%.o, $(COMPONENTS)) +DESTDIR := +PREFIX := /usr/local BIN := last -BIN_DIR := /usr/local/bin APP := last.desktop -APP_DIR := /usr/share/applications ICON := last -ICON_DIR := /usr/share/icons/hicolor SCHEMA := last.gschema.xml -SCHEMAS_DIR := /usr/share/glib-2.0/schemas -all: last-gtk.h $(TARGET) +all: last-gtk.h $(BIN) # Rule to link object files to create executable -$(TARGET): $(OBJECTS) +$(BIN): $(OBJECTS) gcc $(CFLAGS) $^ $(LDFLAGS) -o $@ # Rule to compile C source files to object files @@ -44,30 +42,29 @@ last-gtk.h: $(SRC_DIR)/last-gtk.css xxd --include $(SRC_DIR)/last-gtk.css > $(SRC_DIR)/last-gtk.h || (rm $(SRC_DIR)/last-gtk.h; false) install: all - install -Dm755 $(TARGET) $(BIN_DIR)/$(BIN) - install -Dm644 $(APP) $(APP_DIR)/$(APP) + install -Dm755 $(BIN) $(DESTDIR)$(PREFIX)/bin/$(BIN) + install -Dm644 $(APP) $(DESTDIR)$(PREFIX)/share/applications/$(APP) for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ - mkdir -p $(ICON_DIR)/"$$size"x"$$size"/apps ; \ - convert $(ICON).svg -resize "$$size"x"$$size" \ - $(ICON_DIR)/"$$size"x"$$size"/apps/$(ICON).png ; \ - done - gtk-update-icon-cache -f -t $(ICON_DIR) - install -Dm644 $(SRC_DIR)/$(SCHEMA) $(SCHEMAS_DIR)/$(SCHEMA) - glib-compile-schemas $(SCHEMAS_DIR) - + mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps ; \ + convert $(ICON).svg -background Transparent -resize "$$size"x"$$size" \ + $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png ; \ + done + gtk-update-icon-cache -f -t $(DESTDIR)$(PREFIX)/share/icons/hicolor + install -Dm644 $(SRC_DIR)/$(SCHEMA) $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) + glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas uninstall: - rm -f $(BIN_DIR)/$(BIN) - rm -f $(APP_DIR)/$(APP) + rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) + rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP) for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ - rm -f $(ICON_DIR)/"$$size"x"$$size"/apps/$(ICON).png ; \ + rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png ; \ done remove-schema: - rm $(SCHEMAS_DIR)/$(SCHEMA) - glib-compile-schemas $(SCHEMAS_DIR) + rm $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) + glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas # Clean target to remove object files and LAS executable clean: - rm -rf $(TARGET) $(OBJ_DIR) $(SRC_DIR)/last-gtk.h + rm -rf $(BIN) $(OBJ_DIR) $(SRC_DIR)/last-gtk.h .PHONY: all last-gtk.h install uninstall remove-schema clean From 6e147a463fbf2ac2fe46079d80dd4a290c6f3241 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 26 Mar 2024 02:22:04 +0000 Subject: [PATCH 04/13] Use rsvg-convert instead of imagemagick Imagemagicks convert was leaving a white background on the logo and is much slower. --- Makefile | 5 ++--- README.md | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b96eb05..662591f 100644 --- a/Makefile +++ b/Makefile @@ -46,9 +46,8 @@ install: all install -Dm644 $(APP) $(DESTDIR)$(PREFIX)/share/applications/$(APP) for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps ; \ - convert $(ICON).svg -background Transparent -resize "$$size"x"$$size" \ - $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png ; \ - done + rsvg-convert -w "$$size" -h "$$size" -f png -o $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png $(ICON).svg ; \ + done gtk-update-icon-cache -f -t $(DESTDIR)$(PREFIX)/share/icons/hicolor install -Dm644 $(SRC_DIR)/$(SCHEMA) $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas diff --git a/README.md b/README.md index a07b5a4..f42c7dd 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,6 @@ LAST requires the following dependencies on your system to compile: - `libjansson` - `lua` -And to install: - -- `imagemagick` - ## Installation ```bash From cabb01ea8b72ad9ea045558576947a12c994f7aa Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 26 Mar 2024 12:48:39 +0000 Subject: [PATCH 05/13] Change binary name from 'last' to 'LAST' --- .gitignore | 2 +- Makefile | 3 +-- last.desktop | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6d5c46e..b67f9a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Compiled files -last +LAST obj/ src/last-gtk.h diff --git a/Makefile b/Makefile index 662591f..2d287e4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BIN := last +BIN := LAST INC := `pkg-config --cflags gtk+-3.0 x11 jansson lua` CFLAGS := -std=gnu99 -O2 -pthread -Wall -Wno-unused-parameter @@ -15,7 +15,6 @@ OBJECTS := $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SOURCES)) \ DESTDIR := PREFIX := /usr/local -BIN := last APP := last.desktop ICON := last SCHEMA := last.gschema.xml diff --git a/last.desktop b/last.desktop index 3a64048..5e1b2b2 100644 --- a/last.desktop +++ b/last.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=LAST -Exec=/usr/local/bin/last +Exec=/usr/local/bin/LAST Icon=last Type=Application Categories=GTK;GNOME;Utility; From 49f84aa2fb239d0589e95c1236e826499bb5875e Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 26 Mar 2024 23:19:07 +0000 Subject: [PATCH 06/13] Update desktop file to use relative path for Exec field This allows the application to be launched regardless of the PREFIX set during installation, as long as it is installed within the user's path. --- last.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/last.desktop b/last.desktop index 5e1b2b2..7fec06b 100644 --- a/last.desktop +++ b/last.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=LAST -Exec=/usr/local/bin/LAST +Exec=LAST Icon=last Type=Application Categories=GTK;GNOME;Utility; From 28fc56e16f401131f4dfe9ca7fb97c6f4f346e7b Mon Sep 17 00:00:00 2001 From: wins1ey Date: Wed, 27 Mar 2024 01:11:28 +0000 Subject: [PATCH 07/13] Only update icon cache and compile schemas if DESTDIR isn't set --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2d287e4..2dcee37 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,14 @@ APP := last.desktop ICON := last SCHEMA := last.gschema.xml +ifdef DESTDIR + update_icon_cache := + compile_schemas := +else + update_icon_cache := gtk-update-icon-cache -f -t $(PREFIX)/share/icons/hicolor + compile_schemas := glib-compile-schemas $(PREFIX)/share/glib-2.0/schemas +endif + all: last-gtk.h $(BIN) # Rule to link object files to create executable @@ -47,9 +55,9 @@ install: all mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps ; \ rsvg-convert -w "$$size" -h "$$size" -f png -o $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png $(ICON).svg ; \ done - gtk-update-icon-cache -f -t $(DESTDIR)$(PREFIX)/share/icons/hicolor + $(update_icon_cache) install -Dm644 $(SRC_DIR)/$(SCHEMA) $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) - glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas + $(compile_schemas) uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP) @@ -59,7 +67,7 @@ uninstall: remove-schema: rm $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) - glib-compile-schemas $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas + $(compile_schemas) # Clean target to remove object files and LAS executable clean: From 1f81a0697a1dcaa9b1897791357086369b5929d9 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 9 Apr 2024 02:08:44 +0100 Subject: [PATCH 08/13] Update Makefile to install standard theme --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 2dcee37..4af5196 100644 --- a/Makefile +++ b/Makefile @@ -58,9 +58,11 @@ install: all $(update_icon_cache) install -Dm644 $(SRC_DIR)/$(SCHEMA) $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) $(compile_schemas) + install -Dm644 resources/themes/standard/standard.css $(DESTDIR)$(PREFIX)/share/LAST/themes/standard/standard.css uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP) + rm -rf $(DESTDIR)$(PREFIX)/share/LAST for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png ; \ done From c787e4e47bac5031c6014685990288ede9ccd8d0 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 9 Apr 2024 02:09:44 +0100 Subject: [PATCH 09/13] Fix theme directory location paths --- src/last-gtk.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/last-gtk.c b/src/last-gtk.c index 136d953..c635fdc 100644 --- a/src/last-gtk.c +++ b/src/last-gtk.c @@ -227,12 +227,17 @@ static int last_app_window_find_theme(LASTAppWindow *win, strcat(str, theme_path); if (stat(str, &st) == -1) { - strcpy(str, "/usr/share/last/themes"); + strcpy(str, "/usr/share/LAST/themes"); strcat(str, theme_path); if (stat(str, &st) == -1) { - str[0] = '\0'; - return 0; + strcpy(str, "/usr/local/share/LAST/themes"); + strcat(str, theme_path); + if (stat(str, &st) == -1) + { + str[0] = '\0'; + return 0; + } } } return 1; From 8d9e19e9df6208d0b4f6b14330e28f08f858d6a0 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 9 Apr 2024 02:26:24 +0100 Subject: [PATCH 10/13] Remove `make clean` from build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 561af64..92a49ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: sudo apt -y install libgtk-3-dev libx11-dev libjansson-dev liblua5.4-dev - name: "Run make clean and make" - run: make clean && make -j + run: make -j - name: Set Build number shell: bash From a42fb743440313aa231725bd242cdd5782dff094 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 9 Apr 2024 02:33:49 +0100 Subject: [PATCH 11/13] Use $(RM) instead of rm -f in Makefile --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 4af5196..f69210b 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ $(OBJ_DIR): mkdir -p $(OBJ_DIR) last-gtk.h: $(SRC_DIR)/last-gtk.css - xxd --include $(SRC_DIR)/last-gtk.css > $(SRC_DIR)/last-gtk.h || (rm $(SRC_DIR)/last-gtk.h; false) + xxd --include $(SRC_DIR)/last-gtk.css > $(SRC_DIR)/last-gtk.h || ($(RM) $(SRC_DIR)/last-gtk.h; false) install: all install -Dm755 $(BIN) $(DESTDIR)$(PREFIX)/bin/$(BIN) @@ -60,19 +60,19 @@ install: all $(compile_schemas) install -Dm644 resources/themes/standard/standard.css $(DESTDIR)$(PREFIX)/share/LAST/themes/standard/standard.css uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) - rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP) - rm -rf $(DESTDIR)$(PREFIX)/share/LAST + $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN) + $(RM) $(DESTDIR)$(PREFIX)/share/applications/$(APP) + $(RM) -r $(DESTDIR)$(PREFIX)/share/LAST for size in 16 22 24 32 36 48 64 72 96 128 256 512; do \ - rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png ; \ + $(RM) $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(ICON).png ; \ done remove-schema: - rm $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) + $(RM) $(DESTDIR)$(PREFIX)/share/glib-2.0/schemas/$(SCHEMA) $(compile_schemas) # Clean target to remove object files and LAS executable clean: - rm -rf $(BIN) $(OBJ_DIR) $(SRC_DIR)/last-gtk.h + $(RM) -r $(BIN) $(OBJ_DIR) $(SRC_DIR)/last-gtk.h .PHONY: all last-gtk.h install uninstall remove-schema clean From 7269aa64cfe843a839226560f4158f396e683829 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 9 Apr 2024 02:49:45 +0100 Subject: [PATCH 12/13] Update README instructions to download resources --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f42c7dd..e76fd45 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,14 @@ LAST requires the following dependencies on your system to compile: ## Installation ```bash -git clone https://github.com/wins1ey/LAST +git clone --recurse-submodules https://github.com/wins1ey/LAST cd LAST make sudo make install ``` or ```bash -git clone https://github.com/wins1ey/LAST && cd LAST && make && sudo make install +git clone --recurse-submodules https://github.com/wins1ey/LAST && cd LAST && make && sudo make install ``` ## Getting Started From 81e501fe8dbce549231b6fcaa49763dd54839573 Mon Sep 17 00:00:00 2001 From: wins1ey Date: Tue, 9 Apr 2024 14:48:29 +0100 Subject: [PATCH 13/13] Update name of make step in build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92a49ad..db43e61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: sudo apt -y update sudo apt -y install libgtk-3-dev libx11-dev libjansson-dev liblua5.4-dev - - name: "Run make clean and make" + - name: "Run make" run: make -j - name: Set Build number