Blob Blame History Raw
%global __provides_exclude_from %{_libdir}/VBoxGuestAdditions

Name:       virtualbox-guest-additions
Version:    5.2.6
Release:    4%{?dist}
Summary:    VirtualBox Guest Additions
License:    GPLv2 or (GPLv2 and CDDL)
URL:        http://www.virtualbox.org/wiki/VirtualBox

Source0:    http://download.virtualbox.org/virtualbox/%{version}/VirtualBox-%{version}.tar.bz2
Source1:    vboxservice.service
Source2:    96-vbox.preset
Source3:    VirtualBox-60-vboxguest.rules
Source4:    VBoxOGLRun.sh

# Small compile fix
Patch1:     VirtualBox-5.0.18-xserver_guest.patch
# Mainline vboxsf uses an option string rather then a custom binary data struct
Patch2:     0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
# Do not show an error dialog when not running under vbox
Patch3:     VirtualBox-5.2.6-xclient.patch
# Fix build with gcc8
Patch4:     VirtualBox-5.2.6-gcc8.patch

BuildRequires:  kBuild >= 0.1.9998
BuildRequires:  desktop-file-utils
# for xsltproc
BuildRequires:  libxslt
BuildRequires:  makeself
BuildRequires:  yasm
BuildRequires:  boost-devel
BuildRequires:  libXcomposite-devel
BuildRequires:  libXmu-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libXt-devel
BuildRequires:  mesa-libEGL-devel
BuildRequires:  mesa-libGL-devel
BuildRequires:  mesa-libGLU-devel
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  zlib-devel
# For the OpenGL passthru libs, these are statically linked against libstdc++
# like mesa itself is to avoid trouble with game-runtimes providing their
# own older libstdc++ (e.g. steam does this)
BuildRequires:  libstdc++-static
%{?systemd_requires}
# Obsoletes/provides for upgrade path from the rpmfusion guest-additions pkg
Obsoletes:      VirtualBox-guest-additions < %{version}-%{release}
Provides:       VirtualBox-guest-additions = %{version}-%{release}
Provides:       VirtualBox-kmod-common = %{version}-%{release}
# Virtual Box guests are always x86, no need to build for other archs
ExclusiveArch:  i686 x86_64

%description
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for
enterprise as well as home use. This package contains the VirtualBox
Guest Additions which support better integration of VirtualBox guests
with the Host, including file sharing, clipboard sharing and Seamless mode.


%package        ogl
Summary:        GL pass-through support

%description    ogl
The %{name}-ogl package contains an alternate libGL.so.1
which renders GL by passing all GL commands through to the host.

To use OpenGL pass-through mode run apps using "VBoxOGLRun foo -opt1 -opt2".


%prep
%autosetup -p1 -n VirtualBox-%{version}
# Remove prebuilt binaries
find -name '*.py[co]' -delete
rm -r kBuild/
rm -r tools/
# Remove bundle X11 sources and some lib sources
rm -r src/VBox/Additions/x11/x11include/
rm -r src/VBox/Additions/x11/x11stubs/
rm include/VBox/HostServices/glext.h
rm include/VBox/HostServices/glxext.h
rm include/VBox/HostServices/wglext.h
rm -r src/libs/libxml2-2.9.*/
rm -r src/libs/libpng-1.2.*/
rm -r src/libs/zlib-1.2.8/
# CRLF->LF
sed -i 's/\r//' COPYING


%build
./configure --only-additions --disable-kmods
. ./env.sh
umask 0022

# VirtualBox build system installs and builds in the same step,
# not allways looking for the installed files to places they have
# really been installed to. Therefore we do not override any of
# the installation paths, but install the tree with the default
# layout under 'obj' and shuffle files around in %%install.
kmk %{_smp_mflags}                                             \
    KBUILD_VERBOSE=2                                           \
    PATH_OUT="$PWD/obj"                                        \
    TOOL_YASM_AS=yasm                                          \
    VBOX_WITH_TESTCASES=                                       \
    VBOX_WITH_VALIDATIONKIT=                                   \
    VBOX_USE_SYSTEM_XORG_HEADERS=1                             \
    VBOX_USE_SYSTEM_GL_HEADERS=1                               \
    SDK_VBOX_LIBPNG_INCS=""                                    \
    SDK_VBOX_LIBXML2_INCS=""                                   \
    SDK_VBOX_OPENSSL_INCS=""                                   \
    SDK_VBOX_OPENSSL_LIBS="$(pkgconf --libs openssl)"          \
    SDK_VBOX_ZLIB_INCS=                                        \
    VBOX_NO_LEGACY_XORG_X11=1                                  \
    VBOX_BUILD_PUBLISHER=_Fedora


%install
# The directory layout created below attempts to mimic the one of
# the commercially supported version to minimize confusion
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_libdir}/security
mkdir -p %{buildroot}%{_libdir}/VBoxGuestAdditions

install -m 0755 -t %{buildroot}%{_sbindir}   \
    obj/bin/additions/VBoxService
install -m 0755 -t %{buildroot}%{_bindir}    \
    obj/bin/additions/VBoxClient             \
    obj/bin/additions/VBoxControl

install -m 0755 -t %{buildroot}%{_libdir}/security \
    obj/bin/additions/pam_vbox.so
install -m 0755 -t %{buildroot}%{_libdir}/VBoxGuestAdditions \
    obj/bin/additions/VBoxOGL*.so
ln -s VBoxOGL.so %{buildroot}%{_libdir}/VBoxGuestAdditions/libGL.so.1

install -p -m 0755 -D src/VBox/Additions/x11/Installer/98vboxadd-xclient \
    %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh
ln -s ../..%{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh \
    %{buildroot}%{_bindir}/VBoxClient-all
desktop-file-install --dir=%{buildroot}%{_sysconfdir}/xdg/autostart/ \
    --remove-key=Encoding src/VBox/Additions/x11/Installer/vboxclient.desktop
desktop-file-validate \
    %{buildroot}%{_sysconfdir}/xdg/autostart/vboxclient.desktop

install -p -m 0644 -D %{SOURCE1} %{buildroot}%{_unitdir}/vboxservice.service
install -p -m 0644 -D %{SOURCE2} %{buildroot}%{_presetdir}/96-vbox.preset
install -p -m 0644 -D %{SOURCE3} %{buildroot}%{_udevrulesdir}/60-vboxguest.rules
install -p -m 0755 -D %{SOURCE4} %{buildroot}%{_bindir}/VBoxOGLRun


%pre
# Add a group "vboxsf" for Shared Folders access
# All users which want to access the auto-mounted Shared Folders have to
# be added to this group.
getent group vboxsf >/dev/null || groupadd -r vboxsf 2>&1
getent passwd vboxadd >/dev/null || \
    useradd -r -g 1 -d /var/run/vboxadd -s /sbin/nologin vboxadd 2>&1

%post
%systemd_post vboxservice.service

%preun
%systemd_preun vboxservice.service

%postun
%systemd_postun_with_restart vboxservice.service


%files
%license COPYING*
%{_bindir}/VBoxClient
%{_bindir}/VBoxControl
%{_bindir}/VBoxClient-all
%{_sbindir}/VBoxService
%{_libdir}/security/pam_vbox.so
%{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh
%{_sysconfdir}/xdg/autostart/vboxclient.desktop
%{_unitdir}/vboxservice.service
%{_presetdir}/96-vbox.preset
%{_udevrulesdir}/60-vboxguest.rules

%files ogl
%license COPYING*
%{_bindir}/VBoxOGLRun
%{_libdir}/VBoxGuestAdditions


%changelog
* Wed Feb  7 2018 Hans de Goede <hdegoede@redhat.com> - 5.2.6-4
- Do not use pkg-config for includes, as pkg-config prefixes an unwanted -I
- Fix /etc/X11/xinit/xinitrc.d/98vboxadd-xclient.sh to now show an error
  notification when not running under vbox, as we will be part of the
  Workstation livecd which may run anywhere

* Mon Jan 29 2018 Hans de Goede <hdegoede@redhat.com> - 5.2.6-3
- Update to 5.2.6
- Drop VirtualBox-4.3.0-no-bundles.patch, set make variables instead
- Adjust automount vboxservice for mainline vboxsf filesystem driver
- Drop mount.vboxsf, the mainline vboxsf filesystem driver works with the
  regular mount binary
- Drop commented out Requires: kernel, this is bad idea (rhbz#1534595)
- Use pkgconfig to get include/libs instead of hardcoding (rhbz#1534595)
- Rename to lowercaps virtualbox-guest-additions, add Obsoletes / Provides
  for upgradepath from rpmfusion (rhbz#1534595)
- Add Provides: VirtualBox-kmod-common for rpmfusion upgradepath (rhbz#1534595)
- Latest rpmfusion Release is 2, set our Release field to 3

* Sun Nov 26 2017 Hans de Goede <hdegoede@redhat.com> - 5.2.2-1
- Update to 5.2.2

* Thu Sep 21 2017 Hans de Goede <hdegoede@redhat.com> - 5.2.0-0.1.svn68769
- Switch to a 5.2 svn snapshot, as 5.2 has a new /dev/vboxguest ioctl API
  which the mainline version of the vboxguest drivers implement

* Mon Aug 28 2017 Hans de Goede <hdegoede@redhat.com> - 5.1.26-3
- Put the libGL.so.1 replacement libs and VBoxOGLRun scripts in an -ogl
  subpackage, so that people can install both the i686 and x86_64 versions.
- Filter out libGL.so.1 provides

* Mon Aug 14 2017 Hans de Goede <hdegoede@redhat.com> - 5.1.26-2
- Initial Fedora package based on the guest-addition parts of the
  rpmfusion VirtualBox package