diff options
-rw-r--r-- | grc/freedesktop/Makefile.am | 50 | ||||
-rw-r--r-- | grc/freedesktop/grc_setup_freedesktop.in | 43 |
2 files changed, 63 insertions, 30 deletions
diff --git a/grc/freedesktop/Makefile.am b/grc/freedesktop/Makefile.am index 30073b951..9595af88c 100644 --- a/grc/freedesktop/Makefile.am +++ b/grc/freedesktop/Makefile.am @@ -21,36 +21,26 @@ include $(top_srcdir)/grc/Makefile.inc -sizes = 32 48 64 128 256 +ourdatadir = $(grc_data_prefix)/freedesktop +dist_ourdata_DATA = \ + grc-icon-256.png \ + grc-icon-128.png \ + grc-icon-64.png \ + grc-icon-48.png \ + grc-icon-32.png \ + gnuradio-grc.xml \ + gnuradio-grc.desktop \ + gnuradio-usrp_diagnostics.desktop -install-data-local: - for size in $(sizes); do \ - xdg-icon-resource install --context mimetypes --theme gnome --mode system --size $${size} $(srcdir)/grc-icon-$${size}.png application-gnuradio-grc; \ - xdg-icon-resource install --context mimetypes --mode system --size $${size} $(srcdir)/grc-icon-$${size}.png application-gnuradio-grc; \ - xdg-icon-resource install --context apps --theme gnome --mode system --size $${size} $(srcdir)/grc-icon-$${size}.png gnuradio-grc; \ - xdg-icon-resource install --context apps --mode system --size $${size} $(srcdir)/grc-icon-$${size}.png gnuradio-grc; \ - done - xdg-mime install --mode system $(srcdir)/gnuradio-grc.xml - xdg-desktop-menu install --mode system $(srcdir)/gnuradio-grc.desktop - xdg-desktop-menu install --mode system $(srcdir)/gnuradio-usrp_diagnostics.desktop +dist_bin_SCRIPTS = grc_setup_freedesktop +BUILT_SOURCES = grc_setup_freedesktop +grc_setup_freedesktop: Makefile $(srcdir)/grc_setup_freedesktop.in + sed -e 's|@SRCDIR[@]|$(ourdatadir)|g' $(srcdir)/grc_setup_freedesktop.in > $@ -uninstall-local: - for size in $(sizes); do \ - xdg-icon-resource uninstall --context mimetypes --theme gnome --mode system --size $${size} application-gnuradio-grc; \ - xdg-icon-resource uninstall --context mimetypes --mode system --size $${size} application-gnuradio-grc; \ - xdg-icon-resource uninstall --context apps --theme gnome --mode system --size $${size} gnuradio-grc; \ - xdg-icon-resource uninstall --context apps --mode system --size $${size} gnuradio-grc; \ - done - xdg-mime uninstall --mode system $(srcdir)/gnuradio-grc.xml - xdg-desktop-menu uninstall --mode system $(srcdir)/gnuradio-grc.desktop - xdg-desktop-menu uninstall --mode system $(srcdir)/gnuradio-usrp_diagnostics.desktop +EXTRA_DIST = $(srcdir)/grc_setup_freedesktop.in +MOSTLYCLEANFILES = $(BUILT_SOURCES) -EXTRA_DIST = \ - $(srcdir)/grc-icon-256.png \ - $(srcdir)/grc-icon-128.png \ - $(srcdir)/grc-icon-64.png \ - $(srcdir)/grc-icon-48.png \ - $(srcdir)/grc-icon-32.png \ - $(srcdir)/gnuradio-grc.xml \ - $(srcdir)/gnuradio-grc.desktop \ - $(srcdir)/gnuradio-usrp_diagnostics.desktop +install-data-hook: grc_setup_freedesktop + grc_setup_freedesktop install +uninstall-hook: grc_setup_freedesktop + sh grc_setup_freedesktop uninstall . diff --git a/grc/freedesktop/grc_setup_freedesktop.in b/grc/freedesktop/grc_setup_freedesktop.in new file mode 100644 index 000000000..b904ffff2 --- /dev/null +++ b/grc/freedesktop/grc_setup_freedesktop.in @@ -0,0 +1,43 @@ +#!/bin/sh +################################################## +# setup grc on a freedesktop platform +# $1 should be install or uninstall +# $2 is the optional path to the files +# when $2 is unspecified, the path is: +# @SRCDIR@ +################################################## + +ICON_SIZES="32 48 64 128 256" +if [ -n "$2" ]; then + SRCDIR="$2" +else + SRCDIR="@SRCDIR@" +fi + +case "$1" in +'install') + for size in ${ICON_SIZES}; do \ + xdg-icon-resource install --context mimetypes --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \ + xdg-icon-resource install --context mimetypes --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \ + xdg-icon-resource install --context apps --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \ + xdg-icon-resource install --context apps --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \ + done + xdg-mime install ${SRCDIR}/gnuradio-grc.xml + xdg-desktop-menu install ${SRCDIR}/gnuradio-grc.desktop + xdg-desktop-menu install ${SRCDIR}/gnuradio-usrp_diagnostics.desktop + ;; +'uninstall') + for size in ${ICON_SIZES}; do \ + xdg-icon-resource uninstall --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \ + xdg-icon-resource uninstall --context mimetypes --size ${size} application-gnuradio-grc; \ + xdg-icon-resource uninstall --context apps --theme gnome --size ${size} gnuradio-grc; \ + xdg-icon-resource uninstall --context apps --size ${size} gnuradio-grc; \ + done + xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml + xdg-desktop-menu uninstall gnuradio-grc.desktop + xdg-desktop-menu uninstall gnuradio-usrp_diagnostics.desktop + ;; +*) + echo "Usage: $0 [install|uninstall]" + ;; +esac |