%global __provides_exclude_from %{_libdir}/VBoxGuestAdditions # Standard compiler flags, without: # -Wall -- VirtualBox takes care of reasonable warnings very well # -m32, -m64 -- 32bit code is built besides 64bit on x86_64 # -fexceptions -- R0 code doesn't link against C++ library, no __gxx_personality_v0 #global optflags %%(rpm --eval %%optflags |sed 's/-Wall//;s/-m[0-9][0-9]//;s/-fexceptions//') # fix for error: code model kernel does not support PIC mode #global optflags %%(echo %%{optflags} -fno-pic) #global optflags %%(echo %%{optflags} | sed 's/-specs=.*cc1 //') # In prerelease builds (such as betas), this package has the same # major version number, while the kernel module abi is not guaranteed # to be stable. This is so that we force the module update in sync with # userspace. #global prerel RC1 %global prereltag %{?prerel:_%(awk 'BEGIN {print toupper("%{prerel}")}')} # Now we use upstream pdf %bcond_with legacy_vboxvideo_drv %bcond_without guest_additions %bcond_without python2 %bcond_without python3 Name: VirtualBox Version: 6.1.8 Release: 100%{?dist} Summary: A general-purpose full virtualizer for PC hardware License: GPLv2 or (GPLv2 and CDDL) URL: http://www.virtualbox.org/wiki/VirtualBox ExclusiveArch: x86_64 Requires: %{name}-server%{?isa} = %{version} Obsoletes: %{name}-qt < 5.1.8 Source0: https://download.virtualbox.org/virtualbox/%{version}%{?prereltag}/VirtualBox-%{version}%{?prereltag}.tar.bz2 Source1: https://download.virtualbox.org/virtualbox/%{version}%{?prereltag}/UserManual.pdf Source2: VirtualBox.appdata.xml Source3: VirtualBox-60-vboxdrv.rules Source4: VirtualBox.modules Source5: VirtualBox-60-vboxguest.rules Source7: vboxservice.service Source8: 96-vbox.preset Source10: vboxweb.service Source20: os_mageia.png Source21: os_mageia_64.png Patch1: VirtualBox-6.0.0-noupdate.patch Patch2: VirtualBox-6.1.0-strings.patch Patch18: VirtualBox-OSE-4.0.2-aiobug.patch Patch27: VirtualBox-gcc.patch Patch29: 590355dbdcffa4081c377fd31565e172785b390c.patch # from Debian Patch28: 02-gsoap-build-fix.patch Patch30: 37-python-3.7-support.patch Patch32: VBoxVNC.fix.patch # from ArchLinux Patch40: 007-python2-path.patch # from Mageia Patch50: VirtualBox-5.1.0-add-Mageia-support.patch Patch51: VirtualBox-5.1.0-revert-VBox.sh.patch # from Fedora Patch60: VirtualBox-5.2.10-xclient.patch Patch61: 0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch # from OpenSuse Patch70: vbox-python-detection.diff Patch80: VirtualBox-6.1.4-hacks.patch Patch84: VirtualBox-6.1.4-wayland-crash.patch Patch85: VirtualBox-6.1.4-Xwayland-shortcut-inhibit.patch BuildRequires: gcc-c++ BuildRequires: kBuild >= 0.1.9998.r3093 BuildRequires: python%{python3_pkgversion}-devel BuildRequires: desktop-file-utils # for xsltproc BuildRequires: libxslt BuildRequires: makeself BuildRequires: yasm BuildRequires: boost-devel BuildRequires: libXcomposite-devel BuildRequires: libXdamage-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 BuildRequires: libpciaccess-devel BuildRequires: pixman-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} BuildRequires: systemd %{?systemd_requires} BuildRequires: systemd %description VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2. Presently, VirtualBox runs on Windows, Linux, Macintosh, and Solaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista, Windows 7, Windows 8, Windows 10), DOS/Windows 3.x, Linux (2.4, 2.6, 3.x and 4.x), Solaris and OpenSolaris, OS/2, and OpenBSD. %package guest-additions Summary: %{name} Guest Additions Group: System Environment/Base Requires: %{name}-kmod = %{version} Provides: %{name}-kmod-common = %{version}-%{release} Requires: xorg-x11-server-Xorg Requires: xorg-x11-xinit Provides: %{name}-guest = %{version}-%{release} Obsoletes: %{name}-guest < %{version}-%{release} %if "%(xserver-sdk-abi-requires 2>/dev/null)" Requires: %(xserver-sdk-abi-requires ansic) Requires: %(xserver-sdk-abi-requires videodrv) Requires: %(xserver-sdk-abi-requires xinput) %endif %description guest-additions This subpackage is like the VirtualBox Guest Additions but just for Fedora, therefore it should be installed only in a Fedora guest system. This subpackage provides tools that use kernel modules for supporting integration with the Host, including file sharing, clipboard sharing, X.org X11 video and mouse driver, USB and webcam proxy and Seamless mode. %prep %setup -q -n %{name}-%{version}%{?prereltag} # add Mageia images cp -a %{SOURCE20} %{SOURCE21} src/VBox/Frontends/VirtualBox/images/ # Remove prebuilt binary tools find -name '*.py[co]' -delete rm -r src/VBox/Additions/WINNT rm -r src/VBox/Additions/os2 rm -r kBuild/ rm -r tools/ # Remove bundle X11 sources and some lib sources, before patching. rm -r src/VBox/Additions/x11/x11include/ rm -r src/VBox/Additions/x11/x11stubs/ rm -r src/VBox/Additions/3D/mesa/mesa-17.3.9/ # wglext.h has typedefs for Windows-specific extensions #rm include/VBox/HostServices/wglext.h # src/VBox/GuestHost/OpenGL/include/GL/glext.h have VBOX definitions #rm -r src/VBox/GuestHost/OpenGL/include/GL #rm -rf src/libs/liblzf-3.4/ rm -r src/libs/libxml2-2.9.*/ rm -r src/libs/libpng-1.6.*/ rm -r src/libs/zlib-1.2.*/ %patch1 -p1 -b .noupdates %patch2 -p1 -b .strings %patch18 -p1 -b .aiobug #patch27 -p1 -b .gcc %if 0%{?fedora} > 20 %patch28 -p1 -b .gsoap2 %endif %if 0%{?fedora} < 28 || 0%{?rhel} %patch29 -p2 -R -b .gsoap3 %endif #patch30 -p1 -b .python37 %patch32 -p1 -b .vnc %patch40 -p1 -b .python2_path # mageia support not ready for 6.0 #patch50 -p1 -b .mageia-support %patch51 -p1 -b .revert-VBox.sh %patch60 -p1 -b .xclient %patch61 -p1 -b .automount %patch70 -p1 -b .python-detection %patch80 -p1 -b .hack %patch84 -p1 -b .wayland %patch85 -p1 -b .wayland2 %build ./configure --only-additions --disable-kmods . ./env.sh umask 0022 # VirtualBox build system installs and builds in the same step, # not always looking for the installed files in 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 \ VBOX_NO_LEGACY_XORG_X11=1 \ SDK_VBOX_LIBPNG_INCS="" \ SDK_VBOX_LIBXML2_INCS="" \ SDK_VBOX_OPENSSL_INCS="" \ SDK_VBOX_OPENSSL_LIBS="ssl crypto" \ SDK_VBOX_ZLIB_INCS="" \ VBOX_BUILD_PUBLISHER=_Lei # VBOX_XCURSOR_LIBS="Xcursor Xext X11 GL" \ # doc/manual/fr_FR/ missing man_VBoxManage-debugvm.xml and man_VBoxManage-extpack.xml # VBOX_WITH_DOCS_TRANSLATIONS=1 \ # we can't build CHM DOCS we need hhc.exe which is not in source and we need # also install wine: # wine: cannot find # '/builddir/build/BUILD/VirtualBox-5.1.6/tools/win.x86/HTML_Help_Workshop/v1.3//hhc.exe' # VBOX_WITH_DOCS_CHM=1 \ # VBOX_WITH_ADDITION_DRIVERS = \ # VBOX_WITH_INSTALLER = 1 \ # VBOX_WITH_LINUX_ADDITIONS = 1 \ # VBOX_WITH_X11_ADDITIONS = 1 \ #VBOX_WITH_LIGHTDM_GREETER=1 \ %install # The directory layout created below attempts to mimic the one of # the commercially supported version to minimize confusion # Directory structure install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_sbindir} install -d %{buildroot}%{_libdir} install -d %{buildroot}%{_datadir} install -d %{buildroot}%{_prefix}/src/%{name}-kmod-%{version} install -d %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d install -d %{buildroot}%{_sysconfdir}/xdg/autostart install -d %{buildroot}%{_udevrulesdir} install -d %{buildroot}%{_unitdir} install -d %{buildroot}%{_presetdir} install -d %{buildroot}%{_datadir}/%{name}-kmod-%{version} %if %{with guest_additions} # Guest X.Org drivers mkdir -p %{buildroot}%{_libdir}/security mkdir -p %{buildroot}%{_libdir}/VBoxGuestAdditions # Michael Thayer from Oracle wrote: I have applied the patch [1] I posted so that you # can build with VBOX_USE_SYSTEM_XORG_HEADERS=1 set in future to only # build the X.Org drivers against the installed system headers. # also wrote: # As vboxmouse_drv is not needed at all for X.Org Server 1.7 and later do not # build it in this case. # and # Build using local X.Org headers. We assume X.Org Server 1.7 or later. # # [1] https://www.virtualbox.org/changeset/43588/vbox %if %{with legacy_vboxvideo_drv} install -m 0755 -D obj/bin/additions/vboxvideo_drv_system.so \ %{buildroot}%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so %endif # Guest-additions tools install -m 0755 -t %{buildroot}%{_sbindir} \ obj/bin/additions/VBoxService \ obj/bin/additions/mount.vboxsf install -m 0755 -t %{buildroot}%{_bindir} \ obj/bin/additions/VBoxClient \ obj/bin/additions/VBoxControl # Guest libraries install -m 0755 -t %{buildroot}%{_libdir}/security \ obj/bin/additions/pam_vbox.so # init/vboxadd-x11 code near call the function install_x11_startup_app 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 %{SOURCE7} %{buildroot}%{_unitdir}/vboxservice.service install -p -m 0644 -D %{SOURCE8} %{buildroot}%{_presetdir}/96-vbox.preset install -p -m 0644 -D %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-vboxguest.rules %endif %pre guest-additions # 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 # Guest additions install %post guest-additions /sbin/ldconfig %systemd_post vboxservice.service #chcon -u system_u -t mount_exec_t "$lib_path/$PACKAGE/mount.vboxsf" > /dev/null 2>&1 # for i in "$lib_path"/*.so # do # restorecon "$i" >/dev/null # done # ;; #chcon -u system_u -t lib_t "$lib_dir"/*.so # Our logging code generates some glue code on 32-bit systems. At least F10 # needs a rule to allow this. Send all output to /dev/null in case this is # completely irrelevant on the target system. #chcon -t unconfined_execmem_exec_t '/usr/bin/VBoxClient' > /dev/null 2>&1 #semanage fcontext -a -t unconfined_execmem_exec_t '/usr/bin/VBoxClient' > /dev/null 2>&1 %preun guest-additions %systemd_preun vboxservice.service %postun guest-additions /sbin/ldconfig %systemd_postun_with_restart vboxservice.service %if %{with guest_additions} %files guest-additions %license COPYING* %{_bindir}/VBoxClient %{_bindir}/VBoxControl %{_bindir}/VBoxClient-all %{_sbindir}/VBoxService %{_sbindir}/mount.vboxsf %{_libdir}/security/pam_vbox.so %if %{with legacy_vboxvideo_drv} %{_libdir}/xorg/modules/drivers/* %endif %{_libdir}/VBoxGuestAdditions %{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient.sh %{_sysconfdir}/xdg/autostart/vboxclient.desktop %{_udevrulesdir}/60-vboxguest.rules %{_unitdir}/vboxservice.service %{_presetdir}/96-vbox.preset %endif