meson: tools: build virsh_win_icon object file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-07-01 03:08:06 +02:00
parent 20f001b016
commit a39ea937aa
6 changed files with 32 additions and 81 deletions

View File

@ -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

View File

@ -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([])

View File

@ -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])
])

View File

@ -2327,6 +2327,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)

View File

@ -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 =
@ -126,28 +119,6 @@ BUILT_SOURCES =
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 \

View File

@ -115,3 +115,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