|
| 1 | +#!/usr/bin/make -f |
| 2 | +# |
| 3 | +# Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 4 | +# (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com> |
| 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 | +DESTDIR := |
| 27 | +ETCDIR := /etc |
| 28 | +SHAREDDIR := /usr/local/share |
| 29 | +FILES := |
| 30 | + |
| 31 | +XDG_ICON_PATH = $(DESTDIR)$(SHAREDDIR)/icons/hicolor |
| 32 | +XDG_MENU_PATH = $(DESTDIR)$(ETCDIR)/xdg/menus/applications-merged |
| 33 | +XDG_APP_PATH = $(DESTDIR)$(SHAREDDIR)/applications |
| 34 | +XDG_DIR_PATH = $(DESTDIR)$(SHAREDDIR)/desktop-directories |
| 35 | +XDG_FILE_PATH = $(foreach file,$(FILES),$(XDG_APP_PATH)/$(notdir $(file))) |
| 36 | +XDG_FILE_LIST = $(foreach file,$(FILES),\\<Filename\\>$(notdir $(file))\\<\\/Filename\\>\\n) |
| 37 | + |
| 38 | +.PHONY: all install_xdg uninstall_xdg |
| 39 | +.DEFAULT_TARGET=all |
| 40 | + |
| 41 | +all: |
| 42 | + |
| 43 | +install_xdg: |
| 44 | + mkdir -p "$(XDG_APP_PATH)" |
| 45 | + mkdir -p "$(XDG_DIR_PATH)" |
| 46 | + mkdir -p "$(XDG_MENU_PATH)" |
| 47 | + mkdir -p "$(XDG_ICON_PATH)/scalable/apps" |
| 48 | + mkdir -p "$(XDG_ICON_PATH)/16x16/apps" |
| 49 | + mkdir -p "$(XDG_ICON_PATH)/22x22/apps" |
| 50 | + mkdir -p "$(XDG_ICON_PATH)/24x24/apps" |
| 51 | + mkdir -p "$(XDG_ICON_PATH)/32x32/apps" |
| 52 | + mkdir -p "$(XDG_ICON_PATH)/48x48/apps" |
| 53 | + mkdir -p "$(XDG_ICON_PATH)/64x64/apps" |
| 54 | + mkdir -p "$(XDG_ICON_PATH)/128x128/apps" |
| 55 | + mkdir -p "$(XDG_ICON_PATH)/256x256/apps" |
| 56 | + cp -f icons/lsp-plugins/16x16.png "$(XDG_ICON_PATH)/16x16/apps/lsp-plugins.png" |
| 57 | + cp -f icons/lsp-plugins/22x22.png "$(XDG_ICON_PATH)/22x22/apps/lsp-plugins.png" |
| 58 | + cp -f icons/lsp-plugins/24x24.png "$(XDG_ICON_PATH)/24x24/apps/lsp-plugins.png" |
| 59 | + cp -f icons/lsp-plugins/32x32.png "$(XDG_ICON_PATH)/32x32/apps/lsp-plugins.png" |
| 60 | + cp -f icons/lsp-plugins/48x48.png "$(XDG_ICON_PATH)/48x48/apps/lsp-plugins.png" |
| 61 | + cp -f icons/lsp-plugins/64x64.png "$(XDG_ICON_PATH)/64x64/apps/lsp-plugins.png" |
| 62 | + cp -f icons/lsp-plugins/128x128.png "$(XDG_ICON_PATH)/128x128/apps/lsp-plugins.png" |
| 63 | + cp -f icons/lsp-plugins/256x256.png "$(XDG_ICON_PATH)/256x256/apps/lsp-plugins.png" |
| 64 | + cp -f icons/lsp-plugins/scalable.svg "$(XDG_ICON_PATH)/scalable/apps/lsp-plugins.svg" |
| 65 | + cp $(FILES) "$(XDG_APP_PATH)/" |
| 66 | + cp -f dirs/lsp-plugins.directory "$(XDG_DIR_PATH)/lsp-plugins.directory" |
| 67 | + cat menus/lsp-plugins.menu | sed -E "s/<\\?filelist\\?>/$(XDG_FILE_LIST)/g" > "$(XDG_MENU_PATH)/lsp-plugins.menu" |
| 68 | + |
| 69 | +uninstall_xdg: |
| 70 | + -rm -f $(XDG_FILE_PATH) |
| 71 | + -rm -f $(XDG_DIR_PATH)/lsp-plugins.directory |
| 72 | + -rm -f $(XDG_MENU_PATH)/lsp-plugins.menu |
| 73 | + -rm -f $(XDG_ICON_PATH)/16x16/apps/lsp-plugins.png |
| 74 | + -rm -f $(XDG_ICON_PATH)/22x22/apps/lsp-plugins.png |
| 75 | + -rm -f $(XDG_ICON_PATH)/24x24/apps/lsp-plugins.png |
| 76 | + -rm -f $(XDG_ICON_PATH)/32x32/apps/lsp-plugins.png |
| 77 | + -rm -f $(XDG_ICON_PATH)/48x48/apps/lsp-plugins.png |
| 78 | + -rm -f $(XDG_ICON_PATH)/64x64/apps/lsp-plugins.png |
| 79 | + -rm -f $(XDG_ICON_PATH)/128x128/apps/lsp-plugins.png |
| 80 | + -rm -f $(XDG_ICON_PATH)/256x256/apps/lsp-plugins.png |
| 81 | + -rm -f $(XDG_ICON_PATH)/scalable/apps/lsp-plugins.svg |
| 82 | + |
0 commit comments