Fixes and improvements to XDG installation

This commit is contained in:
Lior Halphon 2021-02-27 17:34:11 +02:00
parent 3c0f4d458d
commit cd2e4b3cef
3 changed files with 40 additions and 3 deletions

17
FreeDesktop/sameboy.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-gameboy-rom">
<comment>Game Boy ROM</comment>
<icon name="x-gameboy-rom"/>
<glob-deleteall/>
<glob pattern="*.gb"/>
<glob pattern="*.sgb"/>
</mime-type>
<mime-type type="application/x-gameboy-color-rom">
<comment>Game Boy Color ROM</comment>
<icon name="x-gameboy-color-rom"/>
<glob-deleteall/>
<glob pattern="*.gbc"/>
<glob pattern="*.cgb"/>
</mime-type>
</mime-info>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-gameboy-color-rom">
<comment>YOUR MOM</comment>
<icon name="application-x-gameboy-color-rom"/>
<glob pattern="*.gbc"/>
<glob pattern="*.cgb"/>
<glob pattern="*.quacky"/>
</mime-type>
</mime-info>

View File

@ -434,22 +434,32 @@ libretro:
# If you somehow find a reasonable way to make associate an icon with an extension in this dumpster # If you somehow find a reasonable way to make associate an icon with an extension in this dumpster
# fire of a desktop environment, open an issue or a pull request # fire of a desktop environment, open an issue or a pull request
ifneq ($(CAN_INSTALL),) ifneq ($(CAN_INSTALL),)
ICON_NAMES := apps/sameboy ICON_NAMES := apps/sameboy mimetypes/x-gameboy-rom mimetypes/x-gameboy-color-rom
ICON_SIZES := 16x16 32x32 64x64 128x128 256x256 512x512 ICON_SIZES := 16x16 32x32 64x64 128x128 256x256 512x512
ICONS := $(foreach name,$(ICON_NAMES), $(foreach size,$(ICON_SIZES),$(DESTDIR)$(PREFIX)/share/icons/hicolor/$(size)/$(name).png)) ICONS := $(foreach name,$(ICON_NAMES), $(foreach size,$(ICON_SIZES),$(DESTDIR)$(PREFIX)/share/icons/hicolor/$(size)/$(name).png))
install: sdl $(DESTDIR)$(PREFIX)/share/applications/sameboy.desktop $(ICONS)(PREFIX)/share/mime/application/x-gameboy-color-rom.xml install: sdl $(DESTDIR)$(PREFIX)/share/applications/sameboy.desktop $(ICONS) FreeDesktop/sameboy.xml
mkdir -p $(DESTDIR)$(PREFIX)/share/sameboy/ mkdir -p $(DESTDIR)$(PREFIX)/share/sameboy/
cp -rf $(BIN)/SDL/* $(DESTDIR)$(PREFIX)/share/sameboy/ cp -rf $(BIN)/SDL/* $(DESTDIR)$(PREFIX)/share/sameboy/
mv $(DESTDIR)$(PREFIX)/share/sameboy/sameboy $(DESTDIR)$(PREFIX)/bin/sameboy mv $(DESTDIR)$(PREFIX)/share/sameboy/sameboy $(DESTDIR)$(PREFIX)/bin/sameboy
ifeq ($(DESTDIR),) ifeq ($(DESTDIR),)
-update-mime-database -n $(PREFIX)/mime
-xdg-desktop-menu install --mode system FreeDesktop/sameboy.xml
-xdg-icon-resource forceupdate --mode system -xdg-icon-resource forceupdate --mode system
-xdg-desktop-menu forceupdate --mode system -xdg-desktop-menu forceupdate --mode system
-su $(SUDO_USER) -c "xdg-desktop-menu forceupdate --mode system"
endif endif
$(DESTDIR)$(PREFIX)/share/icons/hicolor/%/apps/sameboy.png: FreeDesktop/AppIcon/%.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/%/apps/sameboy.png: FreeDesktop/AppIcon/%.png
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
cp -f $^ $@ cp -f $^ $@
$(DESTDIR)$(PREFIX)/share/icons/hicolor/%/mimetypes/x-gameboy-rom.png: FreeDesktop/Cartridge/%.png
-@$(MKDIR) -p $(dir $@)
cp -f $^ $@
$(DESTDIR)$(PREFIX)/share/icons/hicolor/%/mimetypes/x-gameboy-color-rom.png: FreeDesktop/ColorCartridge/%.png
-@$(MKDIR) -p $(dir $@)
cp -f $^ $@
$(DESTDIR)$(PREFIX)/share/applications/sameboy.desktop: FreeDesktop/sameboy.desktop $(DESTDIR)$(PREFIX)/share/applications/sameboy.desktop: FreeDesktop/sameboy.desktop
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)