Description: Fix Makefile to install files into right directory
Author: Marvin Stark <marv@der-marv.de>
Reviewed-by: Thiago Pezzo <pezzo@protonmail.com>
Forwarded: No
Index: gprename-20210415/Makefile
===================================================================
--- gprename-20210415.orig/Makefile
+++ gprename-20210415/Makefile
@@ -3,8 +3,8 @@
 # Copyright (C) 2007 gprename-users@lists.sourceforge.net
 
 # Globals:
-PREFIX=/usr/local
-DESTDIR=/usr/local
+PREFIX=/usr
+DESTDIR=$(CURDIR)/debian/gprename
 
 build:
 	# Create temporary build directory and modify file locations.
@@ -24,10 +24,8 @@ build:
 	install -d "$(CURDIR)/build/locale/ru"
 	install -d "$(CURDIR)/build/locale/sv"
 	install -d "$(CURDIR)/build/locale/zh_CN"
-	perl -ne 's!\@INSTALLDIR\@!$(PREFIX)!g ; print' < bin/gprename > build/gprename
-	perl -ne 's!\@INSTALLDIR\@!$(PREFIX)!g ; print' < bin/gprename.desktop > build/gprename.desktop
 
-install: uninstall build
+install: build
 	# Compile all .po files to .mo
 	msgfmt -o build/locale/ca.mo	locale/ca.po
 	msgfmt -o build/locale/de.mo	locale/de.po
@@ -45,72 +43,74 @@ install: uninstall build
 	msgfmt -o build/locale/zh_CN.mo	locale/zh_CN.po
 
 	# Create directories
-	install -d "$(DESTDIR)"
-	install -d "$(DESTDIR)/bin"
-	install -d "/usr/share"
-	install -d "/usr/share/icons"
-	install -d "$(DESTDIR)/share/applications"
-	install -d "$(DESTDIR)/share/man"
-	install -d "$(DESTDIR)/share/man/man1"
-	install -d "$(DESTDIR)/share/locale/ca/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/de/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/es/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/et/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/fr/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/id/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/it/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/nl/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/pl/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/pt_BR/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/ro/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/ru/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/sv/LC_MESSAGES"
-	install -d "$(DESTDIR)/share/locale/zh_CN/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)"
+	install -d "$(DESTDIR)$(PREFIX)/bin"
+	install -d "$(DESTDIR)$(PREFIX)/share"
+	install -d "$(DESTDIR)$(PREFIX)/share/icons"
+	install -d "$(DESTDIR)$(PREFIX)/share/pixmaps"
+	install -d "$(DESTDIR)$(PREFIX)/share/pixmaps/gprename"
+	install -d "$(DESTDIR)$(PREFIX)/share/applications"
+	install -d "$(DESTDIR)$(PREFIX)/share/man"
+	install -d "$(DESTDIR)$(PREFIX)/share/man/man1"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/ca/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/de/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/es/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/et/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/fr/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/id/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/it/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/nl/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/pl/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/pt_BR/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/ro/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/ru/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/sv/LC_MESSAGES"
+	install -d "$(DESTDIR)$(PREFIX)/share/locale/zh_CN/LC_MESSAGES"
 
 	# Copy all files in the filesystem
-	install -m 755 build/gprename                "$(DESTDIR)/bin/"
-	install -m 644 gprename-nautilus-actions.xml "$(DESTDIR)/share/applications/"
-	install -m 644 icon/gprename.png             "/usr/share/icons/"
-	install -m 644 man/gprename.1                "$(DESTDIR)/share/man/man1/"
-	install -m 644 build/locale/ca.mo            "$(DESTDIR)/share/locale/ca/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/de.mo            "$(DESTDIR)/share/locale/de/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/es.mo            "$(DESTDIR)/share/locale/es/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/et.mo            "$(DESTDIR)/share/locale/et/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/fr.mo            "$(DESTDIR)/share/locale/fr/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/id.mo            "$(DESTDIR)/share/locale/id/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/it.mo            "$(DESTDIR)/share/locale/it/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/nl.mo            "$(DESTDIR)/share/locale/nl/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/pl.mo            "$(DESTDIR)/share/locale/pl/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/pt_BR.mo         "$(DESTDIR)/share/locale/pt_BR/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/ro.mo            "$(DESTDIR)/share/locale/ro/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/ru.mo            "$(DESTDIR)/share/locale/ru/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/sv.mo            "$(DESTDIR)/share/locale/sv/LC_MESSAGES/gprename.mo"
-	install -m 644 build/locale/zh_CN.mo         "$(DESTDIR)/share/locale/zh_CN/LC_MESSAGES/gprename.mo"
-	desktop-file-install bin/gprename.desktop
-	update-desktop-database
+	install -m 755 bin/gprename                  "$(DESTDIR)$(PREFIX)/bin/"
+	install -m 644 bin/gprename.desktop          "$(DESTDIR)$(PREFIX)/share/applications/"
+	install -m 644 icon/gprename.png             "$(DESTDIR)$(PREFIX)/share/icons/"
+	install -m 644 icon/gprename_nautilus-action.png  "$(DESTDIR)$(PREFIX)/share/icons/"
+	install -m 644 icon/gprename_debian_menu_icon.xpm "$(DESTDIR)$(PREFIX)/share/pixmaps/gprename"
+	install -m 644 man/gprename.1                "$(DESTDIR)$(PREFIX)/share/man/man1/"
+	install -m 644 build/locale/ca.mo            "$(DESTDIR)$(PREFIX)/share/locale/ca/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/de.mo            "$(DESTDIR)$(PREFIX)/share/locale/de/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/es.mo            "$(DESTDIR)$(PREFIX)/share/locale/es/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/et.mo            "$(DESTDIR)$(PREFIX)/share/locale/et/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/fr.mo            "$(DESTDIR)$(PREFIX)/share/locale/fr/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/id.mo            "$(DESTDIR)$(PREFIX)/share/locale/id/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/it.mo            "$(DESTDIR)$(PREFIX)/share/locale/it/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/nl.mo            "$(DESTDIR)$(PREFIX)/share/locale/nl/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/pl.mo            "$(DESTDIR)$(PREFIX)/share/locale/pl/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/pt_BR.mo         "$(DESTDIR)$(PREFIX)/share/locale/pt_BR/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/ro.mo            "$(DESTDIR)$(PREFIX)/share/locale/ro/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/ru.mo            "$(DESTDIR)$(PREFIX)/share/locale/ru/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/sv.mo            "$(DESTDIR)$(PREFIX)/share/locale/sv/LC_MESSAGES/gprename.mo"
+	install -m 644 build/locale/zh_CN.mo         "$(DESTDIR)$(PREFIX)/share/locale/zh_CN/LC_MESSAGES/gprename.mo"
 	@echo "Installation completed."
 
-uninstall: clean
-	rm -f  "$(DESTDIR)/bin/gprename"
-	rm -f  "/usr/share/applications/gprename.desktop"
-	rm -f  "$(DESTDIR)/share/applications/gprename-nautilus-actions.xml"
-	rm -f  "$(DESTDIR)/share/man/man1/gprename.1"
-	rm -f  "$(DESTDIR)/share/locale/ca/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/de/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/es/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/et/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/fr/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/id/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/it/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/nl/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/pl/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/pt_BR/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/ro/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/ru/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/sv/LC_MESSAGES/gprename.mo"
-	rm -f  "$(DESTDIR)/share/locale/zh_CN/LC_MESSAGES/gprename.mo"
-	rm -fr "/usr/share/icons/gprename"
-	update-desktop-database
+uninstall:
+	rm -f  "$(DESTDIR)$(PREFIX)/bin/gprename"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/icons/gprename.png"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/icons/gprename_nautilus-action.png"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/pixmaps/gprename/gprename_debian_menu_icon.xpm"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/applications/gprename.desktop"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/man/man1/gprename.1"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/ca/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/de/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/es/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/et/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/fr/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/id/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/it/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/nl/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/pl/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/pt_BR/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/ro/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/ru/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/sv/LC_MESSAGES/gprename.mo"
+	rm -f  "$(DESTDIR)$(PREFIX)/share/locale/zh_CN/LC_MESSAGES/gprename.mo"
 
 clean:
 	rm -rf build
