LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File open-vm-tools.spec of Package open-vm-tools (Project Virtualization:VMware)

#
# spec file for package open-vm-tools
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010 Dominique Leuenberger, Amsterdam, Netherlands.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# exclude AMD PCnet32 LANCE pci.id from Supplements list [bnc#397554]
%define __find_supplements sh -c '/usr/lib/rpm/find-supplements %{name} | grep -v pci:v00001022d00002000'

%if 0%{?suse_version} <= 1210
# Modules to be built up to openSUSE 12.1, possibly not building on newer versions.
%define vm_modules1210 vmxnet
%endif

# Modules that have to be build up to version 12.2 (Last checked on 2012-02-05 with kernel 3.2.0)
%define vm_modules vmci vmblock vmhgfs vmsync vsock %{?vm_modules1210}

# X modules are lower prio upstream and once in a while fail. Offer an easy way to enable/disable them.
%define with_X 1

Name:           open-vm-tools
Version:        9.2.0
Release:        0
%define         svn_rev 799703
Summary:        Open Virtual Machine Tools
License:        BSD-3-Clause ; GPL-2.0 ; LGPL-2.1
Group:          System/Emulators/PC
Url:            http://open-vm-tools.sourceforge.net/
Source:         http://sourceforge.net/projects/open-vm-tools/files/open-vm-tools/stable-9.2.x/%{name}-%{version}-%{svn_rev}.tar.gz
Source1:        vmtoolsd
Source2:        vmware-user-autostart.desktop
Source4:        open-vm-tools.permissions
Source5:        vmware-user-autostart-wrapper
Source6:        open-vm-tools-modprobe.conf
Source7:        tools.conf
Source98:       preamble
Patch0:         open-vm-tools-kernel-3.6.patch
BuildRequires:  gcc-c++
# don't use pkgconfig(gtk+-2.0) so we can build on SLE
BuildRequires:  gtk2-devel
BuildRequires:  gtkmm2-devel
BuildRequires:  kernel-source
BuildRequires:  kernel-syms
BuildRequires:  libdnet-devel
BuildRequires:  libicu-devel
BuildRequires:  module-init-tools
BuildRequires:  pcre-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
BuildRequires:  pkgconfig(fuse)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# liburiparser was not present before 11.0
%if 0%{?suse_version} >= 1100
BuildRequires:  liburiparser-devel
%endif
BuildRequires:  pam-devel
Requires:       vmware-guest-kmp
Supplements:    modalias(pci:v000015ADd*sv*sd*bc*sc*i*)
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
Requires(pre):  permissions
ExclusiveArch:  %ix86 x86_64

%suse_kernel_module_package -n vmware-guest -p %{SOURCE98} xen um

%description
Open Virtual Machine Tools (open-vm-tools) are the open source
implementation of VMware Tools. They are a set of guest operating
system virtualization components that enhance performance and user
experience of virtual machines. As virtualization technology rapidly
becomes mainstream, each virtualization solution provider implements
their own set of tools and utilities to supplement the guest virtual
machine. However, most of the implementations are proprietary and are
tied to a specific virtualization platform.

With the Open Virtual Machine Tools project, we are hoping to solve
this and other related problems. The tools are currently composed of
kernel modules for Linux and user-space programs for all VMware
supported Unix-like guest operating systems. They provide several
useful functions like:

* File transfer between a host and guest

* Improved memory management and network performance under
   virtualization

* General mechanisms and protocols for communication between host and
guests and from guest to guest

%package -n vmware-guest-KMP
Summary:        Open Virtual Machine Tools - for VM GUESTS
Group:          System/Emulators/PC

%description -n vmware-guest-KMP
Open Virtual Machine Tools (open-vm-tools) are the open source
implementation of VMware Tools. They are a set of guest operating
system virtualization components that enhance performance and user
experience of virtual machines. As virtualization technology rapidly
becomes mainstream, each virtualization solution provider implements
their own set of tools and utilities to supplement the guest virtual
machine. However, most of the implementations are proprietary and are
tied to a specific virtualization platform.

With the Open Virtual Machine Tools project, we are hoping to solve
this and other related problems. The tools are currently composed of
kernel modules for Linux and user-space programs for all VMware
supported Unix-like guest operating systems. They provide several
useful functions like:

* File transfer between a host and guest

* Improved memory management and network performance under
   virtualization

* General mechanisms and protocols for communication between host and
guests and from guest to guest

%if %{with_X}

%package gui
Summary:        Open Virtual Machine Tools - GUI
Group:          System/Emulators/PC
Requires:       open-vm-tools
Supplements:    packageand(open-vm-tools:xorg-x11)
Requires(pre):  permissions

%description gui
GUI Toolbox for Open Virtual Machine Tools
%endif

%package -n libvmtools0
Summary:        Open Virtual Machine Tools - shared library
Group:          System/Libraries

%description -n libvmtools0
This is a shared library used by several Open VM Tools components,
such as vmware-toolbox-cmd and vmtoolsd (and its plugins).

%package -n libvmtools-devel
Summary:        Open Virtual Machine Tools - Development headers
Group:          Development
Requires:       libvmtools0 = %{version}

%description -n libvmtools-devel
Those are the development headers for libvmtools. They are needed
if you intend to create own plugins for vmtoolsd.

%prep
%setup -q -n %{name}-%{version}-%{svn_rev}
%if 0%{?suse_version} > 1220
%patch0 -p1
%endif
chmod -x AUTHORS COPYING ChangeLog NEWS README
# fix for an rpmlint warning regarding wrong line feeds
sed -i -e "s/\r//" README

%build
# disable warning unused-but-set-variable which will raise error because of -Werror
# disable warning deprecated-declarations which will raise error because of -Werror
# (this is because of 'g_static_mutex_init' usage which is now deprecated)
%if 0%{?suse_version} > 1110
export CFLAGS="%{optflags} -Wno-unused-but-set-variable -Wno-deprecated-declarations -fPIE"
export CPPFLAGS="%{optflags} -Wno-unused-but-set-variable -Wno-deprecated-declarations -fPIE"
%else
export CFLAGS="%{optflags} -Wno-deprecated-declarations -fPIE"
export CPPFLAGS="%{optflags} -Wno-deprecated-declarations -fPIE"
%endif
export LDFLAGS="-pie"
# comments in a continued line seem not to work... shame
# --disable-unity : liburiparser was not present before 11.0
%configure \
%if 0%{?suse_version} < 1140
    --disable-unity \
%endif
    --without-kernel-modules \
    --without-root-privileges \
    --without-procps \
%if %{with_X}
    --with-x \
%else
    --without-x \
%endif
    --disable-dependency-tracking \
    --disable-static
make

TOPDIR=$PWD
cd ..
mkdir -p obj
for flavor in %{flavors_to_build}; do
  rm -rf obj/$flavor
  cp -r %{name}-%{version}-%{svn_rev} obj/$flavor
  pushd obj/$flavor
  for module in %{vm_modules}; do
    pushd modules/linux/$module
    if [ -f ../vmci/Module.symvers ]; then
       cp ../vmci/Module.symvers .
    fi
    make -C /usr/src/linux-obj/%{_target_cpu}/$flavor modules M=$PWD VM_CCVER=$(gcc -dumpversion) HEADER_DIR="/usr/src/linux-obj/$(uname -i)/default/include" SRCROOT=$PWD OVT_SOURCE_DIR=$TOPDIR
    popd
  done
  popd
done

%install
# let's use the kernel's own modules_install routine
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
pushd ..
for flavor in %{flavors_to_build}; do
  pushd obj/$flavor
  for module in %{vm_modules}; do
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install M=$PWD/modules/linux/$module
  done
  popd
done
popd

# fix some rights on the kernel modules, to have a complete -debuginfo package
chmod u+x %{buildroot}/lib/modules/*/updates/*

%if 0%{?suse_version} > 1110
%make_install
%else
%makeinstall
%endif
# Clean up the *.la files make install put all around
find %{buildroot} -name '*.la' -delete -print

# install the vmtoolsd init script and also it's rcvmtoolsd softlink
install -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/vmtoolsd
ln -sf ../../etc/init.d/vmtoolsd %{buildroot}%{_sbindir}/rcvmtoolsd

%if %{with_X}
# vmware-user is started by vmware-user-suid-wrapper by xdg-autostart
# unfortunately, vmware-user-suid-wrapper does not wait for it's block device
# to appear. For this reason we have now a vmware-user-autostart-wrapper
# which checks for /proc/fs/vmblock/dev to appear and then starts vmware-user-suid-wrapper
install -D -m 0755 %{SOURCE5} %{buildroot}%{_bindir}/vmware-user-autostart-wrapper
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/xdg/autostart/vmware-user-autostart.desktop

# Install the default tools.conf
install -D -m 0644 %{S:7} %{buildroot}%{_sysconfdir}/vmware-tools/tools.conf

# In case we install vmware-user-suid-wrapper, we need to give it 4755 permissions.
#install -D -m 0644 %%{S:4} %%{buildroot}%%{_sysconfdir}/permissions.d/open-vm-tools

# We have our own 'safe' autostart wrapper, which checks for modules to start in autologin mode...
# Thus we drop the 'original' autostartup
rm %{buildroot}%{_sysconfdir}/xdg/autostart/vmware-user.desktop

# handle the .destop files for translations
%suse_update_desktop_file vmware-user-autostart
%endif

# modprobe configuration for vmnics.
install -D -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/modprobe.d/50-vmnics.conf

# fix a link pointing to the buildroot for mount.vmhgfs
( cd %{buildroot}/sbin; rm mount.vmhgfs; ln -s ..%{_sbindir}/mount.vmhgfs )

# the script installs some binaries into /usr/share/open-vm-tools which are just some tests.
# So we drop them for the moment. Upstream has been informed about this.
rm -r %{buildroot}%{_datadir}/%{name}

%post
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions /usr/bin/vmware-user-suid-wrapper
%endif
/sbin/ldconfig
%{fillup_and_insserv -Y vmtoolsd}

%if %{with_X}

%verifyscript gui
%verify_permissions -e /usr/bin/vmware-user-suid-wrapper

%post gui
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions /usr/bin/vmware-user-suid-wrapper
%endif

%endif

%preun
# stop service with the old name (if exists) on update (something like %%stop_on_update)
test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -ge 1 ; then
    test -f /etc/sysconfig/services && . /etc/sysconfig/services
    if test "$YAST_IS_RUNNING" != "instsys" ; then
        /etc/init.d/vmware-guestd stop &> /dev/null || :
    fi
fi
%stop_on_removal vmtoolsd
vmware-rpctool "tools.set.version 0" || :

%postun
%restart_on_update vmtoolsd
%insserv_cleanup
/sbin/ldconfig

%post -n libvmtools0 -p /sbin/ldconfig

%postun -n libvmtools0 -p /sbin/ldconfig

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_bindir}/vmtoolsd
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%dir %{_libdir}/%{name}/plugins/common
%dir %{_libdir}/%{name}/plugins/vmsvc
%if %{with_X}
%dir %{_libdir}/%{name}/plugins/vmusr
%endif
%{_libdir}/%{name}/plugins/vmsvc/libguestInfo.so
%{_libdir}/%{name}/plugins/vmsvc/libpowerOps.so
%{_libdir}/%{name}/plugins/vmsvc/libtimeSync.so
%{_libdir}/%{name}/plugins/vmsvc/libvmbackup.so
%{_libdir}/%{name}/plugins/common/libhgfsServer.so
%{_libdir}/%{name}/plugins/common/libvix.so
%{_bindir}/vmware-checkvm
%{_bindir}/vmware-hgfsclient
%{_bindir}/vmware-rpctool
%{_bindir}/vmware-toolbox-cmd
%{_bindir}/vmware-vmblock-fuse
%{_bindir}/vmware-xferlogs
%{_sbindir}/mount.vmhgfs
/sbin/mount.vmhgfs
%config(noreplace) %{_sysconfdir}/pam.d/vmtoolsd
%dir %{_sysconfdir}/vmware-tools
%dir %{_sysconfdir}/vmware-tools/scripts
%dir %{_sysconfdir}/vmware-tools/scripts/vmware
%{_sysconfdir}/vmware-tools/poweroff-vm-default
%{_sysconfdir}/vmware-tools/poweron-vm-default
%{_sysconfdir}/vmware-tools/resume-vm-default
%{_sysconfdir}/vmware-tools/scripts/vmware/network
%{_sysconfdir}/vmware-tools/statechange.subr
%{_sysconfdir}/vmware-tools/suspend-vm-default
%config(noreplace) %{_sysconfdir}/vmware-tools/tools.conf
%{_sysconfdir}/vmware-tools/vm-support
%{_sysconfdir}/init.d/vmtoolsd
%{_sysconfdir}/modprobe.d/50-vmnics.conf
%{_sbindir}/rcvmtoolsd
%exclude %{_libdir}/*.so

%if %{with_X}

%files gui
%defattr(-, root, root)
%{_sysconfdir}/xdg/autostart/vmware-user-autostart.desktop
%verify(not mode) %attr(0755,root,root) %{_bindir}/vmware-user-suid-wrapper
%{_libdir}/%{name}/plugins/vmusr/libdesktopEvents.so
%{_libdir}/%{name}/plugins/vmusr/libdndcp.so
%{_libdir}/%{name}/plugins/vmusr/libresolutionSet.so
%{_bindir}/vmware-user-autostart-wrapper
%endif

%files -n libvmtools0
%defattr(-, root, root)
%{_libdir}/libvmtools.so.*
%{_libdir}/libguestlib.so.*
%{_libdir}/libhgfs.so.*

%files -n libvmtools-devel
%defattr(-,root,root)
%{_includedir}/vmGuestLib
%{_libdir}/*.so
%{_libdir}/pkgconfig/vmguestlib.pc

%changelog