changeset 19778:1687269e31e4

build: Generate Octave logo icons from SVG source (bug #37062) * acinclude.m4 (OCTAVE_PROG_ICOTOOL, OCTAVE_PROG_RSVG_CONVERT): New macros. * configure.ac: Use them. Set AMCOND_HAVE_ICON_TOOLS. * etc/icons/Makefile.am (BUILT_PNG_ICONS): Build PNG icons of varying sizes from SVG source. (octave-logo.ico) Build Windows icon containing a subset of PNG icons. * etc/icons/octave-logo.ico, etc/icons/octave-logo.png: Delete.
author Mike Miller <mtmiller@ieee.org>
date Wed, 18 Feb 2015 00:10:22 -0500
parents 67f2c76f9f4d
children 99ef3e58214e
files configure.ac etc/icons/Makefile.am etc/icons/octave-logo.ico etc/icons/octave-logo.png m4/acinclude.m4
diffstat 5 files changed, 69 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Tue Feb 17 17:34:48 2015 -0800
+++ b/configure.ac	Wed Feb 18 00:10:22 2015 -0500
@@ -159,6 +159,12 @@
 OCTAVE_PROG_PAGER
 OCTAVE_PROG_PYTHON
 
+## Programs used to generate icons file formats.
+OCTAVE_PROG_ICOTOOL
+OCTAVE_PROG_RSVG_CONVERT
+AM_CONDITIONAL([AMCOND_HAVE_ICON_TOOLS],
+  [test -n "$ICOTOOL" && test -n "$RSVG_CONVERT"])
+
 ### Default terminal font for the GUI
 case $host_os in
   mingw* | msdosmsvc)
--- a/etc/icons/Makefile.am	Tue Feb 17 17:34:48 2015 -0800
+++ b/etc/icons/Makefile.am	Wed Feb 18 00:10:22 2015 -0500
@@ -21,14 +21,31 @@
 include $(top_srcdir)/build-aux/common.mk
 
 IMAGE_FILES = \
-  octave-logo.ico \
-  octave-logo.png \
   octave-logo.svg \
   octave-sombrero.png
 
+PNG_SIZES = \
+  512 \
+  256 \
+  128 \
+  64 \
+  48 \
+  32 \
+  24 \
+  22 \
+  16
+
+BUILT_PNG_ICONS = $(patsubst %,octave-logo-%.png,$(PNG_SIZES))
+
+WINDOWS_PNG_ICONS = $(filter %-16.png %-32.png %-48.png %-256.png,$(BUILT_PNG_ICONS))
+
+BUILT_ICONS = \
+  $(BUILT_PNG_ICONS) \
+  octave-logo.ico
+
 image_DATA = $(IMAGE_FILES)
 
-all-local: octave.desktop
+all-local: octave.desktop $(BUILT_ICONS)
 
 octave.desktop: octave.desktop.in Makefile
 	@echo "making $@ from $<"
@@ -37,20 +54,49 @@
 	  -e "s|%OCTAVE_PREFIX%|${prefix}|"
 	mv $@-t $@
 
+$(BUILT_PNG_ICONS): octave-logo.svg
+	$(RSVG_CONVERT) -w $(lastword $(subst -, ,$(patsubst %.png,%,$@))) $< > $@-t
+	mv $@-t $@
+
+octave-logo.ico: $(WINDOWS_PNG_ICONS)
+	$(ICOTOOL) --create --raw $^ > $@-t
+	mv $@-t $@
+
 install-data-local:
 	-if test -n "$(DESKTOP_FILE_INSTALL)"; then \
 	  $(DESKTOP_FILE_INSTALL) --dir=$(DESTDIR)$(datadir)/applications \
 	    --vendor www.octave.org octave.desktop; \
 	fi
+	for f in $(BUILT_PNG_ICONS); do \
+	  size=`echo $$f | $(SED) -n -e "s/.*-\([0-9]\+\)\.png/\1/p"`; \
+	  $(MKDIR_P) $(DESTDIR)$(datadir)/icons/hicolor/$${size}x$${size}/apps; \
+	  $(INSTALL_DATA) $$f $(DESTDIR)$(datadir)/icons/hicolor/$${size}x$${size}/apps/octave.png; \
+	done
+	$(MKDIR_P) $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
+	$(INSTALL_DATA) $(srcdir)/octave-logo.svg $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/octave.svg
 
 uninstall-local:
 	if test -n "$(DESKTOP_FILE_INSTALL)"; then \
 	  rm -f $(DESTDIR)$(datadir)/applications/www.octave.org-octave.desktop; \
 	fi
+	for f in $(BUILT_PNG_ICONS); do \
+	  size=`echo $$f | $(SED) -n -e "s/.*-\([0-9]\+\)\.png/\1/p"`; \
+	  rm -f $(DESTDIR)$(datadir)/icons/hicolor/$${size}x$${size}/apps/octave.png; \
+	done
+	rm -f $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/octave.svg
+
+if AMCOND_HAVE_ICON_TOOLS
+else
+dist-hook:
+	@echo "Packaging distribution requires icotool and rsvg-convert." ; exit 1;
+endif
 
 EXTRA_DIST = \
+  $(BUILT_ICONS) \
   $(IMAGE_FILES) \
   octave.desktop.in
 
 CLEANFILES = octave.desktop
 
+MAINTAINERCLEANFILES = $(BUILT_ICONS)
+
Binary file etc/icons/octave-logo.ico has changed
Binary file etc/icons/octave-logo.png has changed
--- a/m4/acinclude.m4	Tue Feb 17 17:34:48 2015 -0800
+++ b/m4/acinclude.m4	Wed Feb 18 00:10:22 2015 -0500
@@ -2116,6 +2116,13 @@
   AC_SUBST(GPERF)
 ])
 dnl
+dnl Find icotool program.
+dnl
+AC_DEFUN([OCTAVE_PROG_ICOTOOL], [
+  AC_CHECK_PROG(ICOTOOL, icotool, icotool, [])
+  AC_SUBST(ICOTOOL)
+])
+dnl
 dnl Check for makeinfo.
 dnl
 AC_DEFUN([OCTAVE_PROG_MAKEINFO], [
@@ -2170,6 +2177,13 @@
   AC_SUBST(PYTHON)
 ])
 dnl
+dnl Find rsvg-convert program.
+dnl
+AC_DEFUN([OCTAVE_PROG_RSVG_CONVERT], [
+  AC_CHECK_PROG(RSVG_CONVERT, rsvg-convert, rsvg-convert, [])
+  AC_SUBST(RSVG_CONVERT)
+])
+dnl
 dnl Find sed program.
 dnl
 # Check for a fully-functional sed program, that truncates