| 1 |
#!/usr/bin/make -f |
| 2 |
# |
| 3 |
# Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 4 |
# (C) 2026 Vladimir Sadovnikov <[email protected]> |
| 5 |
# |
| 6 |
# This file is part of lsp-plugins-shared |
| 7 |
# |
| 8 |
# lsp-plugins-shared is free software: you can redistribute it and/or modify |
| 9 |
# it under the terms of the GNU Lesser General Public License as published by |
| 10 |
# the Free Software Foundation, either version 3 of the License, or |
| 11 |
# any later version. |
| 12 |
# |
| 13 |
# lsp-plugins-shared is distributed in the hope that it will be useful, |
| 14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
# GNU Lesser General Public License for more details. |
| 17 |
# |
| 18 |
# You should have received a copy of the GNU Lesser General Public License |
| 19 |
# along with lsp-plugins-shared. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
# |
| 21 |
|
| 22 |
ifneq ($(VERBOSE),1) |
| 23 |
.SILENT: |
| 24 |
endif |
| 25 |
|
| 26 |
CONFIG := $(MODDIR)/.config.mk |
| 27 |
include $(CONFIG) |
| 28 |
|
| 29 |
MODDIR = $(CURDIR)/.. |
| 30 |
DESTDIR := |
| 31 |
ETCDIR := /etc |
| 32 |
SHAREDDIR := $(PREFIX)/share |
| 33 |
|
| 34 |
XDG_ICON_PATH = $(DESTDIR)$(SHAREDDIR)/icons/hicolor |
| 35 |
XDG_MENU_PATH = $(DESTDIR)$(ETCDIR)/xdg/menus/applications-merged |
| 36 |
XDG_APP_PATH = $(DESTDIR)$(SHAREDDIR)/applications |
| 37 |
XDG_DIR_PATH = $(DESTDIR)$(SHAREDDIR)/desktop-directories |
| 38 |
XDG_FILES = $(file < $(FILE_LIST)) |
| 39 |
XDG_FILE_PATH = $(foreach file,$(XDG_FILES),$$(XDG_APP_PATH)/$(notdir $(file))) |
| 40 |
|
| 41 |
# Include the script for deletion of legacy icons |
| 42 |
include $(LSP_PLUGINS_SHARED_PATH)/res/xdg/uninstall-old-xdg.mk |
| 43 |
|
| 44 |
# Form the batch file |
| 45 |
$(file > $(BATCH_FILE),) \ |
| 46 |
$(file >> $(BATCH_FILE),install_xdg: install_xdg_prepare) \ |
| 47 |
$(foreach item,$(XDG_FILES),\ |
| 48 |
$(file >> $(BATCH_FILE),$(shell printf "\t")cp "$(item)" "$$(XDG_APP_PATH)/") \ |
| 49 |
) |
| 50 |
$(file >> $(BATCH_FILE),) \ |
| 51 |
\ |
| 52 |
$(file >> $(BATCH_FILE),uninstall_xdg: uninstall_xdg_prepare) \ |
| 53 |
$(foreach item,$(XDG_FILE_PATH),\ |
| 54 |
$(file >> $(BATCH_FILE),$(shell printf "\t")-rm "$(item)") \ |
| 55 |
) |
| 56 |
$(file >> $(BATCH_FILE),) \ |
| 57 |
|
| 58 |
include $(BATCH_FILE) |
| 59 |
|
| 60 |
.PHONY: all install_xdg uninstall_xdg install_xdg_prepare uninstall_xdg_prepare |
| 61 |
.DEFAULT_TARGET=all |
| 62 |
|
| 63 |
all: |
| 64 |
|
| 65 |
install_xdg_prepare: uninstall_old_xdg_icons |
| 66 |
mkdir -p "$(XDG_APP_PATH)" |
| 67 |
mkdir -p "$(XDG_DIR_PATH)" |
| 68 |
mkdir -p "$(XDG_MENU_PATH)" |
| 69 |
mkdir -p "$(XDG_ICON_PATH)/scalable/apps" |
| 70 |
mkdir -p "$(XDG_ICON_PATH)/16x16/apps" |
| 71 |
mkdir -p "$(XDG_ICON_PATH)/22x22/apps" |
| 72 |
mkdir -p "$(XDG_ICON_PATH)/24x24/apps" |
| 73 |
mkdir -p "$(XDG_ICON_PATH)/32x32/apps" |
| 74 |
mkdir -p "$(XDG_ICON_PATH)/48x48/apps" |
| 75 |
mkdir -p "$(XDG_ICON_PATH)/64x64/apps" |
| 76 |
mkdir -p "$(XDG_ICON_PATH)/128x128/apps" |
| 77 |
mkdir -p "$(XDG_ICON_PATH)/256x256/apps" |
| 78 |
cp -f icons/lsp-plugins/16x16.png "$(XDG_ICON_PATH)/16x16/apps/lsp-plugins.png" |
| 79 |
cp -f icons/lsp-plugins/22x22.png "$(XDG_ICON_PATH)/22x22/apps/lsp-plugins.png" |
| 80 |
cp -f icons/lsp-plugins/24x24.png "$(XDG_ICON_PATH)/24x24/apps/lsp-plugins.png" |
| 81 |
cp -f icons/lsp-plugins/32x32.png "$(XDG_ICON_PATH)/32x32/apps/lsp-plugins.png" |
| 82 |
cp -f icons/lsp-plugins/48x48.png "$(XDG_ICON_PATH)/48x48/apps/lsp-plugins.png" |
| 83 |
cp -f icons/lsp-plugins/64x64.png "$(XDG_ICON_PATH)/64x64/apps/lsp-plugins.png" |
| 84 |
cp -f icons/lsp-plugins/128x128.png "$(XDG_ICON_PATH)/128x128/apps/lsp-plugins.png" |
| 85 |
cp -f icons/lsp-plugins/256x256.png "$(XDG_ICON_PATH)/256x256/apps/lsp-plugins.png" |
| 86 |
cp -f icons/lsp-plugins/scalable.svg "$(XDG_ICON_PATH)/scalable/apps/lsp-plugins.svg" |
| 87 |
|
| 88 |
uninstall_xdg_prepare: uninstall_old_xdg_icons |
| 89 |
-rm -f $(XDG_ICON_PATH)/16x16/apps/lsp-plugins.png |
| 90 |
-rm -f $(XDG_ICON_PATH)/22x22/apps/lsp-plugins.png |
| 91 |
-rm -f $(XDG_ICON_PATH)/24x24/apps/lsp-plugins.png |
| 92 |
-rm -f $(XDG_ICON_PATH)/32x32/apps/lsp-plugins.png |
| 93 |
-rm -f $(XDG_ICON_PATH)/48x48/apps/lsp-plugins.png |
| 94 |
-rm -f $(XDG_ICON_PATH)/64x64/apps/lsp-plugins.png |
| 95 |
-rm -f $(XDG_ICON_PATH)/128x128/apps/lsp-plugins.png |
| 96 |
-rm -f $(XDG_ICON_PATH)/256x256/apps/lsp-plugins.png |
| 97 |
-rm -f $(XDG_ICON_PATH)/scalable/apps/lsp-plugins.svg |
| 98 |
|