Fix build on CentOS/RHEL 7.

Allow building on aarch64 for CentOS/RHEL 8+ and Fedora.
Clean up SPEC file (conditionals, build requirements, scriptlets, formatting).
This commit is contained in:
Simone Caronni 2021-06-01 13:07:51 +02:00
parent 2ef82f3692
commit e0d0888ebe

View File

@ -26,12 +26,17 @@
%global toolsdaemon vmtoolsd
%global vgauthdaemon vgauthd
%if 0%{?rhel} == 7
%global _modulesloaddir %{_prefix}/lib/modules-load.d
%endif
Name: open-vm-tools
Version: %{toolsversion}
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Open Virtual Machine Tools for virtual machines hosted on VMware
License: GPLv2
URL: https://github.com/vmware/%{name}
Source0: https://github.com/vmware/%{name}/releases/download/stable-%{version}/%{name}-%{version}-%{toolsbuild}.tar.gz
Source1: %{toolsdaemon}.service
Source2: %{vgauthdaemon}.service
@ -42,7 +47,7 @@ Source5: vmtoolsd.pam
%if 0%{?rhel} >= 7
ExclusiveArch: x86_64
%else
ExclusiveArch: %{ix86} x86_64
ExclusiveArch: %{ix86} x86_64 aarch64
%endif
Patch1: %{name}-gcc11.patch
@ -57,24 +62,11 @@ BuildRequires: doxygen
# Fuse is optional and enables vmblock-fuse
BuildRequires: fuse-devel
BuildRequires: glib2-devel >= 2.14.0
%if 0%{?fedora} >= 23 || 0%{?rhel} > 7
# F23 split gdk-pixbuf2-devel >= 2.31.3-5 into 3 packages,
# gdk-pixbuf2-devel, gdk-pixbuf2-modules-devel, and
# gdk-pixbuf2-xlib-devel. gtk2-devel does not depend on
# gdk-pixbuf2-xlib-devel. Therefore, we need to pull in
# gdk-pixbuf2-xlib-devel dependency ourselves.
BuildRequires: gdk-pixbuf2-xlib-devel
BuildRequires: gtk3-devel >= 3.10.0
BuildRequires: gtkmm30-devel >= 3.10.0
%else
BuildRequires: gtk2-devel >= 2.4.0
BuildRequires: gtkmm24-devel
%endif
BuildRequires: libdrm-devel
BuildRequires: libicu-devel
BuildRequires: libmspack-devel
# Unfortunately, xmlsec1-openssl does not add libtool-ltdl
# dependency, so we need to add it ourselves.
# Unfortunately, xmlsec1-openssl does not add libtool-ltdl dependency, so we
# need to add it ourselves.
BuildRequires: libtool-ltdl-devel
BuildRequires: libX11-devel
BuildRequires: libXext-devel
@ -86,18 +78,21 @@ BuildRequires: libXtst-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: procps-devel
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
BuildRequires: rpcgen
%endif
BuildRequires: systemd-devel
%if 0%{?fedora} >= 30 || 0%{?rhel} >= 9
BuildRequires: systemd-rpm-macros
%endif
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
BuildRequires: libtirpc-devel
%endif
BuildRequires: xmlsec1-openssl-devel
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: gdk-pixbuf2-xlib-devel
BuildRequires: gtk3-devel >= 3.10.0
BuildRequires: gtkmm30-devel >= 3.10.0
BuildRequires: libtirpc-devel
BuildRequires: rpcgen
BuildRequires: systemd-rpm-macros
%else
BuildRequires: gtk2-devel >= 2.4.0
BuildRequires: gtkmm24-devel
BuildRequires: systemd
%endif
Requires: coreutils
Requires: fuse
Requires: iproute
@ -110,14 +105,10 @@ Requires: util-linux
Requires: which
# xmlsec1-openssl needs to be added explicitly
Requires: xmlsec1-openssl
%if 0%{?fedora} < 28 || 0%{?rhel} < 8
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%endif
# open-vm-tools >= 10.0.0 do not require open-vm-tools-deploypkg
# provided by VMware. That functionality is now available as part
# of open-vm-tools package itself.
# open-vm-tools >= 10.0.0 do not require open-vm-tools-deploypkg provided by
# VMware. That functionality is now available as part of open-vm-tools package
# itself.
Obsoletes: open-vm-tools-deploypkg <= 10.0.5
%description
@ -148,8 +139,8 @@ Requires: procps
%description sdmp
This package contains only the user-space programs and utility scripts of
%{name} that are essential for performing service discovery in VMware virtual
machines by vRealize Operations Service Discovery Management Pack.
%{name} that are essential for performing service discovery in VMware
virtual machines by vRealize Operations Service Discovery Management Pack.
%package devel
Summary: Development libraries for Open Virtual Machine Tools
@ -173,22 +164,22 @@ machines.
%autosetup -p1 -n %{name}-%{version}-%{toolsbuild}
%build
# Required for regenerating configure script when
# configure.ac get modified
autoreconf -vif
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
%global usetirpc with-tirpc
%else
%global usetirpc without-tirpc
%endif
%configure \
--without-kernel-modules \
--enable-xmlsec1 \
--enable-resolutionkms \
--enable-servicediscovery \
--%{usetirpc} \
%if 0%{?fedora} || 0%{?rhel} >= 8
--with-tirpc \
--without-gtk2 \
--without-gtkmm \
%else
--without-tirpc \
--without-gtk3 \
--without-gtkmm3 \
%endif
--disable-static
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
@ -227,16 +218,11 @@ install -p -m 644 -D '%{SOURCE3}' %{buildroot}%{_unitdir}/run-vmblock\\x2dfuse.m
install -p -m 644 -D %{SOURCE4} %{buildroot}%{_modulesloaddir}/open-vm-tools.conf
install -p -m 644 -D %{SOURCE5} %{buildroot}%{_sysconfdir}/pam.d/vmtoolsd
# 'make check' in open-vm-tools rebuilds docs and ends up regenerating
# the font file. We can add %%check secion once 'make check' is fixed
# upstream
# 'make check' in open-vm-tools rebuilds docs and ends up regenerating the font
# file. We can add %%check secion once 'make check' is fixed upstream.
%post
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
%{?ldconfig}
%else
/sbin/ldconfig
%endif
%?ldconfig
# Setup mount point for Shared Folders
# NOTE: Use systemd-detect-virt to detect VMware platform because
# vmware-checkvm might misbehave on non-VMware platforms.
@ -266,8 +252,8 @@ fi
%post desktop
%systemd_post run-vmblock\\x2dfuse.mount
# Need to enable the service as it is not enabled by default.
# Enabling an already-enabled service is not an error. So, we
# can perform this step everytime during the post-install.
# Enabling an already-enabled service is not an error. So, we can perform this
# step everytime during the post-install.
if [ -f %{_bindir}/vmware-checkvm ] && \
%{_bindir}/systemd-detect-virt | grep -iq VMware && \
%{_bindir}/vmware-checkvm &> /dev/null && \
@ -282,6 +268,7 @@ if %{_bindir}/systemctl is-active %{toolsdaemon}.service &> /dev/null; then
fi
%preun
%?ldconfig
%systemd_preun %{toolsdaemon}.service %{vgauthdaemon}.service
if [ "$1" = "0" -a \
@ -306,11 +293,7 @@ fi
%systemd_preun run-vmblock\\x2dfuse.mount
%postun
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
%{?ldconfig}
%else
/sbin/ldconfig
%endif
%?ldconfig
%systemd_postun_with_restart %{toolsdaemon}.service %{vgauthdaemon}.service
%postun desktop
@ -400,6 +383,11 @@ fi
%{_bindir}/vmware-vgauth-smoketest
%changelog
* Tue Jun 01 2021 Simone Caronni <negativo17@gmail.com> - 11.2.5-7
- Fix build on CentOS/RHEL 7.
- Allow building on aarch64 for CentOS/RHEL 8+ and Fedora.
- Clean up SPEC file (conditionals, build requirements, scriptlets, formatting).
* Mon Apr 05 2021 Ravindra Kumar <ravindrakumar@vmware.com> - 11.2.5-6
- Added missing escape char in run-vmblock\\x2dfuse.mount service name.
- Enabled run-vmblock\\x2dfuse.mount service during post-install.