Blob Blame History Raw
%global majorversion    9.2
%global minorversion    3
%global toolsbuild      1031360
%global toolsversion    %{majorversion}.%{minorversion}
%global toolsdaemon     vmtoolsd

Name:             open-vm-tools
Version:          %{toolsversion}
Release:          2%{?dist}
Summary:          Open VMware Tools for virtual machines hosted on VMware
Group:            Applications/System
License:          GPLv2
URL:              http://%{name}.sourceforge.net/
BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExclusiveArch:    %{ix86} x86_64

Source0:          http://sourceforge.net/projects/%{name}/files/%{name}/stable-%{majorversion}.x/%{name}-%{version}-%{toolsbuild}.tar.gz
Source1:          %{name}.service
Source2:          %{name}.init

BuildRequires:          doxygen
# Fuse is optional and enables vmblock-fuse
BuildRequires:          fuse-devel
BuildRequires:          glib2-devel >= 2.6.0
BuildRequires:          gtk2-devel >= 2.4.0
BuildRequires:          gtkmm24-devel
BuildRequires:          libdnet-devel
BuildRequires:          libicu-devel
BuildRequires:          libX11-devel
BuildRequires:          libXext-devel
BuildRequires:          libXi-devel
BuildRequires:          libXinerama-devel
BuildRequires:          libXrandr-devel
BuildRequires:          libXrender-devel
BuildRequires:          libXtst-devel
BuildRequires:          pam-devel

%if 0%{?rhel} == 6
BuildRequires:          procps
%else
BuildRequires:          procps-devel
%endif

%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires:          systemd-units
%endif

%if 0%{?fedora} == 16 || 0%{?fedora} == 17
Requires(post):         systemd-units
Requires(preun):        systemd-units
Requires(postun):       systemd-units
%endif

%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
Requires(post):         systemd
Requires(preun):        systemd
Requires(postun):       systemd
%endif

%if 0%{?rhel} == 5 || 0%{?rhel} == 6
Requires(post):         /sbin/chkconfig
Requires(preun):        /sbin/chkconfig
Requires(preun):        /sbin/service
Requires(postun):       /sbin/service
%endif

%description
The %{name} project is an open source implementation of VMware Tools. It
is a suite of open source virtualization utilities and drivers to improve the
functionality, user experience and administration of VMware virtual machines.
This package contains only the core user-space programs and libraries of
%{name}.

%package          desktop
Summary:          User experience components for Open VMware Tools
Group:            System Environment/Libraries
Requires:         %{name}%{?_isa} = %{version}-%{release}

%description      desktop
This package contains only the user-space programs and libraries of
%{name} that are essential for improved user experience of VMware virtual
machines.

%package          devel
Summary:          Development libraries for Open VMware Tools
Group:            Development/Libraries
Requires:         %{name}%{?_isa} = %{version}-%{release}

%description      devel
This package contains only the user-space programs and libraries of
%{name} that are essential for developing customized applications for
VMware virtual machines.

%prep
%setup -q -n %{name}-%{version}-%{toolsbuild}

%build
# Use -Wno-unused-local-typedefs to build with GCC 4.8
export CFLAGS="$RPM_OPT_FLAGS -Wno-unused-local-typedefs"
export CXXLAGS="$RPM_OPT_FLAGS -Wno-unused-local-typedefs"
%configure \
    --without-kernel-modules \
    --disable-static
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
make %{?_smp_mflags}

%install
export DONT_STRIP=1
make install DESTDIR=%{buildroot}

# Remove exec bit from config files
chmod a-x %{buildroot}%{_sysconfdir}/pam.d/*

# Remove the DOS line endings
sed -i "s|\r||g" README

# Remove unnecessary files from packaging
find %{buildroot}%{_libdir} -name '*.la' -delete
rm -fr %{buildroot}%{_defaultdocdir}
rm -f docs/api/build/html/FreeSans.ttf

%if 0%{?fedora} || 0%{?rhel} >= 7

# Systemd unit files
install -p -m 644 -D %{SOURCE1} %{buildroot}%{_unitdir}/%{toolsdaemon}.service

%else

# Initscripts
install -p -m 755 -D %{SOURCE2} %{buildroot}%{_initrddir}/%{toolsdaemon}

%endif

# '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

%if 0%{?fedora} == 17

%post
/sbin/ldconfig
if [ $1 -eq 1 ] ; then
    # Initial installation
    /bin/systemctl enable %{toolsdaemon}.service >/dev/null 2>&1 || :
fi

%preun
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload disable %{toolsdaemon}.service > /dev/null 2>&1 || :
    /bin/systemctl stop %{toolsdaemon}.service > /dev/null 2>&1 || :
fi

%postun
/sbin/ldconfig
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart %{toolsdaemon}.service >/dev/null 2>&1 || :
fi

%endif

%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7

%post
/sbin/ldconfig
%systemd_post %{toolsdaemon}.service

%preun
%systemd_preun %{toolsdaemon}.service

%postun
/sbin/ldconfig
%systemd_postun_with_restart %{toolsdaemon}.service

%endif

%if 0%{?rhel} == 6 || 0%{?rhel} == 5

%post
/sbin/chkconfig --add %{toolsdaemon}

%preun
if [ $1 -eq 0 ]; then
    /sbin/service %{toolsdaemon} stop >/dev/null 2>&1 || :
    /sbin/chkconfig --del %{toolsdaemon}
fi

%postun
if [ $1 -ge 1 ]; then
    /sbin/service %{toolsdaemon} condrestart >/dev/null 2>&1 || :
fi

%endif

%post devel -p /sbin/ldconfig

%postun devel -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%config(noreplace) %{_sysconfdir}/pam.d/*
%{_sysconfdir}/vmware-tools/
%{_bindir}/vmtoolsd
%{_bindir}/vmware-checkvm
%{_bindir}/vmware-hgfsclient
%{_bindir}/vmware-rpctool
%{_bindir}/vmware-toolbox-cmd
%{_bindir}/vmware-xferlogs
%{_libdir}/libguestlib.so.*
%{_libdir}/libhgfs.so.*
%{_libdir}/libvmtools.so.*
%dir %{_libdir}/%{name}/
%dir %{_libdir}/%{name}/plugins
%dir %{_libdir}/%{name}/plugins/common
%{_libdir}/%{name}/plugins/common/*.so
%dir %{_libdir}/%{name}/plugins/vmsvc
%{_libdir}/%{name}/plugins/vmsvc/*.so
%{_sbindir}/mount.vmhgfs
%{_datadir}/%{name}/
%exclude /sbin/
%if 0%{?fedora} || 0%{?rhel} >= 7
%{_unitdir}/%{toolsdaemon}.service
%else
%{_initrddir}/%{toolsdaemon}
%endif

%files desktop
%defattr(-,root,root,-)
%{_sysconfdir}/xdg/autostart/*.desktop
%{_bindir}/vmware-user-suid-wrapper
%{_bindir}/vmware-vmblock-fuse
%{_libdir}/%{name}/plugins/vmusr/

%files devel
%defattr(-,root,root,-)
%doc docs/api/build/*
%{_includedir}/vmGuestLib/
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libguestlib.so
%{_libdir}/libhgfs.so
%{_libdir}/libvmtools.so

%changelog
* Fri Apr 26 2013 Simone Caronni <negativo17@gmail.com> - 9.2.3-2
- Enable service by default on systemd systems.

* Fri Apr 26 2013 Simone Caronni <negativo17@gmail.com> - 9.2.3-1
- Package new upstream version open-vm-tools-9.2.3-1031360.
- Removed configure options CUSTOM_PROCPS_NAME (for libproc) and
  -Wno-deprecated-declarations as these have been addressed in
  open-vm-tools-9.2.3-1031360.
- Added workaround for RHEL bug #950748.

* Wed Apr 24 2013 Simone Caronni <negativo17@gmail.com> - 9.2.2-1
- First build.