diff --git a/Makefile b/Makefile index 92c460d..3d6b9b7 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,13 @@ else @echo Skipping upx compression endif -.PHONY: install -install: build compress +.PHONY: install-bin +install-bin: build compress install -d ${DESTDIR}${BINDIR} install -m 0755 ./${BINARY} ${DESTDIR}${BINDIR} +.PHONY: install +install: install-bin install-desktop clean .PHONY: clean ${GOCMD} clean @@ -35,3 +37,16 @@ install: build compress .PHONY: uninstall uninstall: clean rm -f ${DESTDIR}${BINDIR}/${BINARY} + rm -f ${DESTDIR}${DATAROOTDIR}/applications/${BINARY} + rm -f ${DESTDIR}${DATAROOTDIR}/pixmaps/${BINARY}-icon.png + -update-desktop-database 2> /dev/null + +.PHONY: install-desktop +install-desktop: ${BINARY}-icon.png +ifeq ($(shell uname), Linux) + install -d ${DESTDIR}${DATAROOTDIR}/applications + install -m 0644 ./${BINARY}.desktop ${DESTDIR}${DATAROOTDIR}/applications + install -d ${DESTDIR}${DATAROOTDIR}/pixmaps + install -m 0644 ./${BINARY}-icon.png ${DESTDIR}${DATAROOTDIR}/pixmaps + -update-desktop-database 2> /dev/null +endif diff --git a/README.md b/README.md index 05b91f3..6634020 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Most of the keys can be figured out if you don't know what they are already. I w ## Building -Minor build variations can be found for each system. Using upx (`apt install upx` or `brew install upx`) will reduce binary size by a good bit for any of these systems. After running the build command, and optionally running upx, move the resulting binary onto your path and you are good to go. Makefile coming soonTM. +Minor build variations can be found for each system. Using upx (`apt install upx` or `brew install upx`) will reduce binary size by a good bit for any of these systems. After running the build command, and optionally running upx, move the resulting binary onto your path and you are good to go. ### OSX / Linux @@ -35,7 +35,7 @@ Alternatively, you can just run a few things yourself and avoid make altogether: `go build -ldflags "-s -w" -o gnums && upx gnums` -You would then need to move the executable to where you want it. +You would then need to move the executable to where you want it, as well as install the desktop entry/icon (linux only). ### Windows diff --git a/gnums-icon.png b/gnums-icon.png new file mode 100644 index 0000000..0161b57 Binary files /dev/null and b/gnums-icon.png differ diff --git a/gnums.desktop b/gnums.desktop new file mode 100644 index 0000000..12564ce --- /dev/null +++ b/gnums.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=gnums +GenericName=RPN Calculator +Comment=Reverse Polish Notation Calculator +Terminal=false +Categories=Utility;Calculator; +Exec=gnums +Icon=gnums-icon +