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