[virt-tools-list] [PATCH virt-viewer 2/5] win32: add a few Windows sepecific data

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 30 01:37:42 UTC 2012


Add application icon and manifest
---
 Makefile.am              |    2 +-
 configure.ac             |   18 ++++++++++++++++++
 icons/Makefile.am        |    9 +++++++++
 src/Makefile.am          |   17 +++++++++++++++++
 src/virt-viewer.manifest |   11 +++++++++++
 src/virt-viewer.rc.in    |   27 +++++++++++++++++++++++++++
 6 files changed, 83 insertions(+), 1 deletions(-)
 create mode 100644 src/virt-viewer.manifest
 create mode 100644 src/virt-viewer.rc.in

diff --git a/Makefile.am b/Makefile.am
index d25207f..4792b42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ NULL =
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = src man plugin po data icons
+SUBDIRS = icons src man plugin po data
 
 EXTRA_DIST =					\
 	$(PACKAGE).spec				\
diff --git a/configure.ac b/configure.ac
index 3298f55..9276334 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,10 +21,27 @@ GTK_VNC2_REQUIRED="0.4.0"
 SPICE_GTK_REQUIRED="0.11"
 SPICE_PROTOCOL_REQUIRED="0.10.1"
 
+AC_MSG_CHECKING([for native Win32])
+case "$host_os" in
+     *mingw*|*cygwin*)
+        os_win32=yes
+        ;;
+     *)
+        os_win32=no
+        ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
+
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 
+AS_IF([test "x$os_win32" = "xyes"], [
+     AC_CHECK_TOOL(WINDRES, [windres])
+     AC_CHECK_PROGS(ICOTOOL, [icotool])
+])
+
 AC_CONFIG_LIBOBJ_DIR([src])
 
 AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions])
@@ -182,6 +199,7 @@ AC_OUTPUT([
     plugin/Makefile
     po/Makefile.in
     src/Makefile
+    src/virt-viewer.rc
     virt-viewer.spec
 ])
 
diff --git a/icons/Makefile.am b/icons/Makefile.am
index 189ea2b..820a421 100644
--- a/icons/Makefile.am
+++ b/icons/Makefile.am
@@ -1 +1,10 @@
 SUBDIRS = 16x16 22x22 24x24 32x32 48x48 256x256
+
+if OS_WIN32
+noinst_DATA = virt-viewer.ico
+endif
+
+# http://stackoverflow.com/questions/3236115/which-icon-sizes-should-my-windows-applications-icon-include
+ico_sizes = 16 32 48 256
+%.ico: $(foreach s,$(ico_sizes),$(s)x$(s)/%.png)
+	$(AM_V_GEN)$(ICOTOOL) -c -o $@ $^
diff --git a/src/Makefile.am b/src/Makefile.am
index e85e939..5349c17 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,6 @@
 NULL =
+LDADD =
+MAINTAINERCLEANFILES =
 bin_PROGRAMS =
 
 builderxmldir = $(pkgdatadir)/ui
@@ -105,3 +107,18 @@ if HAVE_SPICE_GTK
 remote_viewer_LDFLAGS += $(SPICE_GTK_LIBS) $(SPICE_CONTROLLER_LIBS)
 remote_viewer_CFLAGS += $(SPICE_GTK_CFLAGS) $(SPICE_CONTROLLER_CFLAGS)
 endif
+
+VIRT_VIEWER_RES = virt-viewer.rc virt-viewer.manifest
+ICONDIR = $(top_builddir)/icons
+MANIFESTDIR = $(srcdir)
+EXTRA_DIST += $(VIRT_VIEWER_RES)
+
+if OS_WIN32
+virt-viewer_rc.$(OBJEXT): $(VIRT_VIEWER_RES) $(top_builddir)/icons/virt-viewer.ico
+	$(AM_V_GEN)$(WINDRES)				\
+		-DICONDIR='\"$(ICONDIR)\"'		\
+		-DMANIFESTDIR='\"$(MANIFESTDIR)\"'	\
+		-i $< -o $@
+LDADD += virt-viewer_rc.$(OBJEXT)
+MAINTAINERCLEANFILES += virt-viewer_rc.$(OBJEXT)
+endif
diff --git a/src/virt-viewer.manifest b/src/virt-viewer.manifest
new file mode 100644
index 0000000..d921a06
--- /dev/null
+++ b/src/virt-viewer.manifest
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+</assembly>
diff --git a/src/virt-viewer.rc.in b/src/virt-viewer.rc.in
new file mode 100644
index 0000000..196e631
--- /dev/null
+++ b/src/virt-viewer.rc.in
@@ -0,0 +1,27 @@
+1 VERSIONINFO
+FILEVERSION     1,0,0,0
+PRODUCTVERSION  1,0,0,0
+
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904E4"
+    BEGIN
+      VALUE "CompanyName", "virt-manager.org"
+      VALUE "FileDescription", "A remote desktop client"
+      VALUE "FileVersion", "@VERSION@"
+      VALUE "InternalName", "@PACKAGE_STRING@"
+      VALUE "LegalCopyright", "Copyright (C) 2007-2012 Red Hat, Inc."
+      VALUE "OriginalFilename", "virt-viewer.exe"
+      VALUE "ProductName", "VirtViewer"
+      VALUE "ProductVersion", "@VERSION@"
+    END
+  END
+
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x409, 1252
+  END
+END
+2 ICON ICONDIR "/virt-viewer.ico"
+3 RT_MANIFEST MANIFESTDIR "/virt-viewer.manifest"
-- 
1.7.7.6




More information about the virt-tools-list mailing list