[libvirt PATCH 258/351] meson: tools: build virsh_win_icon object file

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:58:14 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 Makefile.am            |  2 --
 configure.ac           | 14 --------------
 m4/virt-win-windres.m4 | 36 ------------------------------------
 meson.build            |  1 +
 tools/Makefile.am      | 29 -----------------------------
 tools/meson.build      | 31 +++++++++++++++++++++++++++++++
 6 files changed, 32 insertions(+), 81 deletions(-)
 delete mode 100644 m4/virt-win-windres.m4

diff --git a/Makefile.am b/Makefile.am
index c5809204e6b..0b62d15eef5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,8 +26,6 @@ SUBDIRS = . tools docs \
 XZ_OPT ?= -v -T0
 export XZ_OPT
 
-ACLOCAL_AMFLAGS = -I m4
-
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
 
diff --git a/configure.ac b/configure.ac
index dc1a27ae94b..24724e3755a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,6 @@ dnl License along with this library.  If not, see
 dnl <http://www.gnu.org/licenses/>.
 
 AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_MACRO_DIR([m4])
 dnl Make automake keep quiet about wildcards & other GNUmake-isms
 AM_INIT_AUTOMAKE([
     foreign
@@ -90,10 +89,6 @@ dnl Need to test if pkg-config exists
 PKG_PROG_PKG_CONFIG
 
 
-dnl MinGW checks
-LIBVIRT_WIN_CHECK_WINDRES
-
-
 # Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
 # we're building shared libraries.  This is the name of the directory
 # in which .o files will be created.
@@ -124,12 +119,3 @@ AC_CONFIG_FILES([\
         tests/Makefile \
         tools/Makefile])
 AC_OUTPUT
-
-AC_MSG_NOTICE([])
-AC_MSG_NOTICE([Configuration summary])
-AC_MSG_NOTICE([=====================])
-AC_MSG_NOTICE([])
-AC_MSG_NOTICE([Windows])
-AC_MSG_NOTICE([])
-LIBVIRT_WIN_RESULT_WINDRES
-AC_MSG_NOTICE([])
diff --git a/m4/virt-win-windres.m4 b/m4/virt-win-windres.m4
deleted file mode 100644
index e913eb48b8e..00000000000
--- a/m4/virt-win-windres.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-dnl The MinGW windres checks
-dnl
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_WIN_CHECK_WINDRES], [
-  dnl Look for windres to build a Windows icon resource.
-  with_windres=no
-  case "$host" in
-    *-*-mingw* )
-      AC_CHECK_TOOL([WINDRES], [windres], [])
-      if test "x$WINDRES" != "x"; then
-        with_windres=yes
-      fi
-      ;;
-  esac
-  AM_CONDITIONAL([WITH_WIN_ICON], [test "$with_windres" = "yes"])
-])
-
-AC_DEFUN([LIBVIRT_WIN_RESULT_WINDRES], [
-  LIBVIRT_RESULT([windres], [$with_windres], [$WINDRES])
-])
diff --git a/meson.build b/meson.build
index 69145512519..b623ddbf4fd 100644
--- a/meson.build
+++ b/meson.build
@@ -2307,6 +2307,7 @@ summary(libs_summary, section: 'Libraries', bool_yn: true)
 
 win_summary = {
   'MinGW': host_machine.system() == 'windows',
+  'windres': host_machine.system() == 'windows',
 }
 summary(win_summary, section: 'Windows', bool_yn: true)
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
index de1edbd54a0..4f4adf94382 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -21,13 +21,6 @@
 # needed
 STANDALONE_CPPFLAGS = -I$(top_srcdir)
 
-ICON_FILES = \
-	libvirt_win_icon_16x16.ico \
-	libvirt_win_icon_32x32.ico \
-	libvirt_win_icon_48x48.ico \
-	libvirt_win_icon_64x64.ico \
-	virsh_win_icon.rc
-
 confdir = $(sysconfdir)/libvirt
 conf_DATA =
 
@@ -125,28 +118,6 @@ virt_admin_CFLAGS = \
 
 if WITH_WIN_ICON
 virsh_LDADD += virsh_win_icon.$(OBJEXT)
-
-# Before you edit virsh_win_icon.rc, please note the following
-# limitations of the resource file format:
-#
-# (1) '..' is not permitted in the icon filename field.
-# (2) '-' is not permitted in the icon filename field.
-# (3) Comments are not permitted in the file.
-#
-# Windows appears to choose the first <= 32x32 icon it finds
-# in the resource file.  Therefore you should list the available
-# icons from largest to smallest, and make sure that the 32x32
-# icon is the most legible.
-#
-# Windows .ICO is a special MS-only format.  GIMP and other
-# tools can write it.  However there are several variations,
-# and Windows seems to do its own colour quantization.  More
-# information is needed in this area.
-
-virsh_win_icon.$(OBJEXT): virsh_win_icon.rc
-	$(AM_V_GEN)$(WINDRES) \
-	  --input-format rc --input $< \
-	  --output-format coff --output $@
 endif WITH_WIN_ICON
 
 install-data-local: install-systemd install-nss \
diff --git a/tools/meson.build b/tools/meson.build
index 53bc1af7bc4..c110cfcf177 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -111,3 +111,34 @@ if conf.has('WITH_LOGIN_SHELL')
     install_rpath: libdir,
   )
 endif
+
+if host_machine.system() == 'windows'
+  # Before you edit virsh_win_icon.rc, please note the following
+  # limitations of the resource file format:
+  #
+  # (1) '..' is not permitted in the icon filename field.
+  # (2) '-' is not permitted in the icon filename field.
+  # (3) Comments are not permitted in the file.
+  #
+  # Windows appears to choose the first <= 32x32 icon it finds
+  # in the resource file.  Therefore you should list the available
+  # icons from largest to smallest, and make sure that the 32x32
+  # icon is the most legible.
+  #
+  # Windows .ICO is a special MS-only format.  GIMP and other
+  # tools can write it.  However there are several variations,
+  # and Windows seems to do its own colour quantization.  More
+  # information is needed in this area.
+  windres = import('windows')
+  virsh_icon_res = windres.compile_resources(
+    'virsh_win_icon.rc',
+    depend_files: [
+      'libvirt_win_icon_16x16.ico',
+      'libvirt_win_icon_32x32.ico',
+      'libvirt_win_icon_48x48.ico',
+      'libvirt_win_icon_64x64.ico',
+    ],
+  )
+else
+  virsh_icon_res = []
+endif
-- 
2.26.2




More information about the libvir-list mailing list