From 4f3ed5c70edd8b75dee4cba5c426c4be0d1f0119 Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Sat, 18 Nov 2017 21:51:32 +0100 Subject: [PATCH] Execute gbm with mono and abstract installer more --- gbm.desktop | 2 +- makefile | 80 ++++++++++++++++++++++------------------------------- 2 files changed, 34 insertions(+), 48 deletions(-) diff --git a/gbm.desktop b/gbm.desktop index 2230c12..c43ac81 100644 --- a/gbm.desktop +++ b/gbm.desktop @@ -8,7 +8,7 @@ Comment[de]=Beobachtet Spiele und sichert ihre Spielstände Path=/usr/local/bin TryExec=mono -Exec=gbm +Exec=mono gbm Terminal=false Icon=gbm diff --git a/makefile b/makefile index 91e2902..4532580 100644 --- a/makefile +++ b/makefile @@ -1,50 +1,36 @@ -install: GBM.exe gbm_16x16.png gbm_24x24.png gbm_32x32.png gbm_48x48.png gbm_64x64.png gbm_72x72.png gbm_96x96.png gbm_128x128.png gbm_256x256.png - #This needs xdg-utils - chmod +x GBM.exe - cp GBM.exe /usr/local/bin/gbm - for i in {16,24,32,48,64,72,96,128,256};do xdg-icon-resource install --mode system --novendor --noupdate --size $${i} gbm_$${i}x$${i}.png gbm; done - xdg-icon-resource forceupdate --mode system - xdg-desktop-menu install --mode system --novendor gbm.desktop +ICONSIZES := 16 24 32 48 64 72 96 128 256 +IMGMAGICK := $(shell command -v convert 2> /dev/null) +XDGUTILS := $(shell command -v xdg-desktop-menu 2> /dev/null) +define \n + + +endef + +install: GBM.exe $(foreach size,$(ICONSIZES),gbm_$(size)x$(size).png) +ifndef XDGUTILS + $(error "xdg-desktop-menu is not available, please install xdg-utils") +endif +#rename it in a way, it can easily started from terminal + install GBM.exe /usr/local/bin/gbm; +#install icon in different sizes + $(foreach size,$(ICONSIZES),xdg-icon-resource install --mode system --novendor --noupdate --size $(size) gbm_$(size)x$(size).png gbm;$(\n)) + xdg-icon-resource forceupdate --mode system; +#install .desktop file, which is used for running gbm from desktop and menus + xdg-desktop-menu install --mode system --novendor gbm.desktop; uninstall: /usr/local/bin/gbm - #This needs xdg-utils - rm /usr/local/bin/gbm - for i in {16,24,32,48,64,72,96,128,256};do xdg-icon-resource uninstall --mode system --novendor --noupdate --size $${i} gbm; done - xdg-icon-resource forceupdate --mode system - xdg-desktop-menu uninstall --mode system --novendor gbm.desktop +ifndef XDGUTILS + $(error "xdg-desktop-menu is not available, please install xdg-utils") +endif + rm /usr/local/bin/gbm; + $(foreach size,$(ICONSIZES),xdg-icon-resource uninstall --mode system --novendor --noupdate --size $(size) gbm;$(\n)) + xdg-icon-resource forceupdate --mode system; + xdg-desktop-menu uninstall --mode system --novendor gbm.desktop; -gbm_256x256.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[0]' '$@' - -gbm_128x128.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[1]' '$@' - -gbm_96x96.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[2]' '$@' - -gbm_72x72.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[3]' '$@' - -gbm_64x64.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[4]' '$@' - -gbm_48x48.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[5]' '$@' - -gbm_32x32.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[6]' '$@' - -gbm_24x24.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[7]' '$@' - -gbm_16x16.png: gbm.ico - #This needs imagemagick - convert 'gbm.ico[8]' '$@' +gbm_%.png: gbm.ico +ifndef IMGMAGICK + $(error "convert is not available, please install imagemagick") +endif +#extracts the correct ico index appended to the filename from identify’s output + $(eval INDEX := $(shell identify gbm.ico | grep $* | cut -d" " -f1;)) + convert '$(INDEX)' '$@';