Move .desktop and icon management out of debian dir
authorKeith Packard <keithp@keithp.com>
Sun, 16 Feb 2014 23:17:40 +0000 (15:17 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 16 Feb 2014 23:52:22 +0000 (15:52 -0800)
This constructs a .desktop file from a template and installs it, along
with suitable .svg icons, during the normal build process

Signed-off-by: Keith Packard <keithp@keithp.com>
Makefile.am
altosui/.gitignore
altosui/Makefile.am
altosui/altos.desktop.in [new file with mode: 0644]
altosui/linux-install.sh
configure.ac
debian/altos.desktop [deleted file]
debian/altos.install
icon/Makefile.am [new file with mode: 0644]

index fa4da1f..f035bb3 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS=ao-tools src doc altoslib libaltos altosuilib altosui micropeak ao-utils altosdroid
+SUBDIRS=ao-tools src doc icon altoslib libaltos altosuilib altosui micropeak ao-utils altosdroid
 
 EXTRA_DIST = ChangeLog
 
index 4ee3f4a..10b600e 100644 (file)
@@ -14,8 +14,10 @@ altosui-jdb
 classaltosui.stamp
 altos-windows.nsi
 Altos-Linux-*.tar.bz2
+Altos-Linux-*.sh
 Altos-Mac-*.zip
 Altos-Windows-*.exe
+altos.desktop
 *.dll
 *.dylib
 *.so
index 20b234a..03c1cfc 100644 (file)
@@ -103,6 +103,10 @@ LIBALTOS= \
        libaltos.dylib \
        altos.dll
 
+desktopdir = $(datadir)/applications
+desktop_file = altos.desktop
+desktop_DATA = $(desktop_file)
+
 JAR=altosui.jar
 
 FATJAR=altosui-fat.jar
@@ -179,8 +183,8 @@ FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFR
 
 LINUX_LIBS=libaltos32.so libaltos64.so
 
-LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC)
-LINUX_EXTRA=altosui-fat ../debian/altos.desktop ../debian/altusmetrum.xpm
+LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) altos.desktop.in ../icon/altusmetrum.svg
+LINUX_EXTRA=altosui-fat
 
 MACOSX_INFO_PLIST=Info.plist
 MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf
@@ -196,6 +200,11 @@ clean-local:
                $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt altos-windows.log altos-windows.nsi \
                altosui altosui-test altosui-jdb macosx linux
 
+EXTRA_DIST = $(desktop_file).in
+
+$(desktop_file): $(desktop_file).in
+       sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/altos.desktop.in > $@
+
 if FATINSTALL
 
 FATTARGET=$(FATDIR)/$(VERSION)
@@ -335,8 +344,6 @@ $(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA)
        -rm -rf linux
        mkdir -p linux/AltOS
        cp -p $(LINUX_FILES) linux/AltOS
-       sed -e 's;/usr/bin;%BIN%;' -e 's;/usr/share/pixmaps;%BIN%;' $(srcdir)/../debian/altos.desktop > linux/AltOS/altos.desktop.in
-       cp -p $(srcdir)/../debian/altusmetrum.xpm linux/AltOS/altusmetrum.xpm
        cp -p altosui-fat linux/AltOS/altosui
        chmod +x linux/AltOS/altosui
        tar cjf $@ -C linux AltOS
diff --git a/altosui/altos.desktop.in b/altosui/altos.desktop.in
new file mode 100644 (file)
index 0000000..6611434
--- /dev/null
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Name=AltOS UI
+GenericName=Altus Metrum Ground Station
+Comment=View and log downlink data from Altus Metrum products
+Icon=%icondir%/altusmetrum.svg
+Exec=%bindir%/altosui %f
+Terminal=false
+MimeType=text/plain;
+Categories=Education;Electronics;Science;
index c5101eb..d7ec951 100644 (file)
@@ -144,7 +144,7 @@ BIN="$target_abs"/AltOS
 desktop="$target"/AltOS/altos.desktop
 
 rm -f "$desktop"
-sed "s;%BIN%;$BIN;" "$target"/AltOS/altos.desktop.in > "$desktop"
+sed -e "s;%bindir%;$BIN;" -e "s;%icondir%;$BIN;" "$target"/AltOS/altos.desktop.in > "$desktop"
 
 #
 # Figure out where to install the .desktop file. If we can, write it
@@ -185,6 +185,12 @@ case "$?" in
     ;;
 esac
 
+#
+# Install icon to desktop if desired
+#
+
+
+
 finish 0
 
 __ARCHIVE_BELOW__
index 6be99d1..12cfdaa 100644 (file)
@@ -487,6 +487,7 @@ AC_OUTPUT([
 Makefile
 src/Makedefs
 altoslib/Makefile
+icon/Makefile
 altosuilib/Makefile
 altosuilib/AltosUIVersion.java
 altosui/Makefile
diff --git a/debian/altos.desktop b/debian/altos.desktop
deleted file mode 100644 (file)
index 2d93f29..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=AltOS UI
-GenericName=Altus Metrum Ground Station
-Comment=View and log downlink data from Altus Metrum products
-Icon=/usr/share/pixmaps/altusmetrum.svg
-Exec=/usr/bin/altosui %f
-Terminal=false
-MimeType=text/plain;
-Categories=Education;Electronics;Science;
index 8bfdd83..50f21eb 100644 (file)
@@ -1,5 +1,3 @@
-debian/altos.desktop   usr/share/applications
-debian/altusmetrum.svg usr/share/pixmaps
 debian/altusmetrum.xpm usr/share/pixmaps
 src/*/*.ihx            usr/share/altos
 src/*/*.map            usr/share/altos
diff --git a/icon/Makefile.am b/icon/Makefile.am
new file mode 100644 (file)
index 0000000..eedb776
--- /dev/null
@@ -0,0 +1,26 @@
+RES=16 32 48 256
+
+AM_FILES=$(shell for i in $(RES); do echo altus-metrum-$$i.png; done)
+MP_FILES=$(shell for i in $(RES); do echo micropeak-$$i.png; done)
+
+ICO_FILES=altus-metrum.ico micro-peak.ico
+
+icondir = $(datadir)/icons/hicolor/scalable/apps
+
+AM_ICON = altusmetrum.svg
+MP_ICON = micropeak.svg
+
+icon_DATA = $(AM_ICON) $(MP_ICON)
+
+EXTRA_DIST = $(icon_DATA) $(AM_FILES) $(MP_FILES)
+
+all-local: $(ICO_FILES)
+
+#clean-local:
+#      $(RM) -f $(ICO_FILES)
+
+altus-metrum.ico: $(AM_FILES)
+       icotool -c -o $@ $(AM_FILES)
+
+micro-peak.ico: $(MP_FILES)
+       icotool -c -o $@ $(MP_FILES)
\ No newline at end of file