virtualbox/virtualbox-kmp.spec
Larry Finger 0995f0ac3e Accepting request 819069 from home:lwfinger:branches:Virtualization
- Split virtualbox-kmp from virtualbox.spec (bsc#1114605)
  Adds files "virtualbox-kmp.spec" and "virtualbox-kmp.changes".

- Remove extraneous lines from spec file.

- Split virtualbox-kmp from virtualbox.spec (bsc#1114605)
  Adds files "virtualbox-kmp.spec" and "virtualbox-kmp.changes".

OBS-URL: https://build.opensuse.org/request/show/819069
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=557
2020-07-07 16:41:24 +00:00

328 lines
12 KiB
RPMSpec

#
# spec file for package virtualbox-kmp
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name: virtualbox-kmp
Version: 6.1.10
Release: 0
Summary: Kernel modules for VirtualBox
License: GPL-2.0-or-later
Group: System/Kernel
URL: http://www.virtualbox.org/
Source0: VirtualBox-%{version}-patched.tar.bz2
Source1: %{name}-files
Source2: %{name}-preamble
#rework init scripts to fit suse needs
Patch1: vbox-vboxdrv-init-script.diff
Patch2: vbox-vboxadd-init-script.diff
#fix build : "Error 4001 - String must be entirely alphanumeric"
#with renaming we probably break some macosx functionality however ths is just quick fix
#see thread : http://lists.freebsd.org/pipermail/freebsd-acpi/2010-October/006795.html
Patch6: vbox-smc-napa.diff
#fix build of Python and dev package on openSUSE 11.3
Patch8: vbox-python-detection.diff
#deprecated old-style C++ service proxies and objects,we have to use soapcpp2 -z1 flag
Patch9: vbox-deprec-gsoap-service-proxies.diff
#fix failed linking process during build - this patch is just quick workaround
Patch10: vbox-gsoapssl-deps.diff
#PATCH-FIX-OPENSUSE implement messagebox (VBoxPermissionMessage app), which is displayed, when user
#try to start VirtualBox and is not member of vboxusers group
Patch99: vbox-permissions_warning.diff
#PATCH-FIX-OPENSUSE Do not include build dates on binaries, makes build-compare happier
Patch100: vbox-no-build-dates.diff
Patch101: vbox-default-os-type.diff
# Disable the distributed versions of vboxdrv.sh and vboxadd.sh for security reasons.
Patch102: security_fixes.patch
#disable update in vbox gui
Patch103: vbox-disable-updates.diff
#use pie/fPIE for setuid binaries (bnc#743143)
Patch104: vbox-fpie.diff
#smap issues on Haswell or Broadwell (boo#931461)
Patch105: smap.diff
# Patch to build with Factory gcc5
Patch106: gcc5-real-support.patch
# Patch to build with gnu sed correctly
Patch107: virtualbox-sed-params.patch
# Patch to use snprintf correcty and not overflow dst buffer
Patch108: virtualbox-snpritnf-buffer-overflow.patch
# Patch to add code to explain USB Passthru
Patch109: vbox-usb-warning.diff
# Patch to ensure that VirtualBoxVM is SUID
Patch110: vbox-suid-warning.diff
# Fix symbol conflict between host and guest kmp
Patch111: fix_conflict_between_host_and_guest.patch
# Fix change in kernel API for ttm_bo_move_memcpy()
Patch112: modify_for_4_8_bo_move.patch
# Remove all mention of _smp_mflags
Patch113: vbox_remove_smp_mflags.patch
# Fix for missing include needed for server 1.19
Patch116: Fix_for_server_1.19.patch
# Fix invalid use of internal headers
Patch118: internal-headers.patch
# Fix rpmlint error for script /lib/usr/virtualbox/vboxshell.py
Patch120: fixes_for_python.patch
# Fix build for Qt 5.11
Patch122: fixes_for_Qt5.11.patch
# Switch to Python 3.4+
Patch123: switch_to_python3.4+.patch
# Use build parameters to control video driver problems
Patch125: remove_vbox_video_build.patch
# fix library search
Patch128: fix_lib_search.patch
# Fixes for modified kernel in Leap 42.3
Patch130: fixes_for_Leap42.3.patch
# Fixes for Qt5.13 on 32-bit systems
Patch132: fixes_for_qt5.13.patch
# Fixes for openSUSE Leap 15.2
Patch133: fixes_for_leap15.2.patch
# Fixes for kernel modules Makefile used at boot time
Patch134: fixes_for_makefile.patch
# Fix build for Qt 5.15
Patch135: fix-missing-includes-with-qt-5.15.patch
# Fix builds with GCC10
Patch136: fixes_for_gcc10.patch
# Fix for changes in GSOAP 2.8.103
Patch137: handle_gsoap_208103.patch
# Fixes for kernel 5.8
Patch138: fixes_for_5.8.patch
Patch999: virtualbox-fix-ui-background-color.patch
#
BuildRequires: %{kernel_module_package_buildreqs}
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: kbuild >= 0.1.9998svn3101
BuildRequires: libcap-devel
BuildRequires: libcurl-devel
BuildRequires: libopenssl-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-tools
BuildRequires: module-init-tools
BuildRequires: pam-devel
BuildRequires: yasm
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%(sed -e '/^Provides: multiversion(kernel)/d' %{_libexecdir}/rpm/kernel-module-subpackage > %{_builddir}/virtualbox-kmp-template)
ExclusiveArch: x86_64
%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE2} -n virtualbox -f %{SOURCE1} -x kdump um xen pae xenpae pv
Obsoletes: virtualbox-guest-kmp
Obsoletes: virtualbox-host-kmp
%description
This package contains the kernel-modules that VirtualBox uses to create or run virtual machines.
%prep
%setup -q -n VirtualBox-%{version}
%patch1 -p1
%patch2 -p1
%patch6 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch116 -p1
%patch118 -p1
%patch120 -p1
%patch122 -p1
%patch123 -p1
%patch125 -p1
%patch128 -p1
# Adjustments that are version dependent
%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
# Patch for Leap 42.3
%patch130 -p1
%endif
# Handle the 32-bit changes needed for Qt 5.13
%ifarch %ix86 && 0%{?qt5ver} >= 51300
%patch132 -p1
%endif
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
# make VB UI background colors look sane again
%patch999 -p1
#
##########################
####workaround kmk_sed --v
#instead of kmk_sed use /usr/bin/sed because of bug http://svn.netlabs.org/kbuild/ticket/112,
#but we have to create wrapper which will handle --append and --output options which are not provided by /usr/bin/sed
cat >> kmk_sed <<EOF
#!/bin/bash
while [ "\$#" != "0" ]; do
pass=\${pass}" \$1"
[ "\$1" == "-e" ] && shift && pass=\${pass}" '\$1'"
shift
done
eval "sed \$(echo "\$pass" | sed -e "s/--output=/>/g;s/--append=/>/g;s/--output/>/g;s/--append/>>/g");"
EOF
chmod +x ./kmk_sed
echo "SED = $RPM_BUILD_DIR/VirtualBox-%{version}/kmk_sed" >> LocalConfig.kmk
####workaround kmk_sed --^
##########################
#
# fix build of vboxvideo kernel module: replace relative drm include path with absolute include path
sed -i 's:include/drm:/usr/src/linux/include/drm:' src/VBox/Additions/linux/drm/Makefile.module.kms
%build
# Disable LTO - Link Time Optimization
%define _lto_cflags %{nil}
#ensure we don't ever use them
rm -rf src/libs/{libpng-*,libxml2-*,libxslt-*,zlib-*,boost-*}
# Craft LocalConfig.kmk
echo "
VBOX_GCC_OPT := %{optflags}
VBOX_GCC_WERR :=
VBOX_BUILD_PUBLISHER := _SUSE
VBOX_OSE := 1
VBOX_WITH_DOCS :=
VBOX_WITHOUT_LINUX_TEST_BUILDS := 1
VBOX_WITH_TESTCASES :=
SDK_VBOX_LIBXML2_DEFS := _REENTRANT
SDK_VBOX_LIBXML2_INCS := /usr/include/libxml2
SDK_VBOX_LIBXML2_LIBS := xml2
SDK_VBOX_OPENSSL_INCS :=
SDK_VBOX_OPENSSL_LIBS := ssl crypto
SDK_VBOX_BLD_OPENSSL_LIBS := ssl crypto
SDK_VBOX_LIBCURL_INCS :=
SDK_VBOX_LIBCURL_LIBS := curl
" > LocalConfig.kmk
COMMON_KMK_FLAGS="
KBUILD_VERBOSE=2 \
KBUILD_TARGET=linux \
BUILD_TARGET=linux \
"
# Architecture specific flags
%ifarch x86_64
COMMON_KMK_FLAGS+="
KBUILD_TARGET_ARCH=amd64 \
BUILD_TARGET_ARCH=amd64
"
%endif
# Build additions to export the source code of vbox{guest,sf,video} to
# out/linux.*/release/bin/additions/src/
%{_bindir}/kmk %_smp_mflags \
${COMMON_KMK_FLAGS} \
VBOX_WITH_X11_ADDITIONS= \
VBOX_ONLY_ADDITIONS=1
# The following kmk commands are used to extract the source of
# vbox{drv,netflt,netadp} without building the whole virtualbox
# program.
# 1. build src/bldprogs/ to get bin2c and VBoxTpG
%{_bindir}/kmk %_smp_mflags -C src/bldprogs/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_EXTPACKS=1
# 2. build src/VBox/HostDrivers/ with VBOX_ONLY_EXTPACKS=1 to
# get SUPR3.a for src/VBox/Runtime/
%{_bindir}/kmk %_smp_mflags -C src/VBox/HostDrivers/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_EXTPACKS=1
# 3. build src/VBox/Runtime/ with VBOX_ONLY_BUILD=1 to get
# VBoxRt.so for src/VBox/HostDrivers/Support/
%{_bindir}/kmk %_smp_mflags -C src/VBox/Runtime/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_BUILD=1
# 4. build src/VBox/HostDrivers/ to export the source of
# host kernel modules to out/linux.*/release/bin/src/
%{_bindir}/kmk %_smp_mflags -C src/VBox/HostDrivers/ \
${COMMON_KMK_FLAGS}
#
# build kernel modules for guest and host (check novel-kmp package as example)
# host modules : vboxdrv,vboxnetflt,vboxnetadp
# guest modules : vboxguest,vboxsf vboxvideo (for Leap 15.1 and older)
echo "build kernel modules"
for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp} \
out/linux.*/release/bin/additions/src/vbox{guest,sf,video}; do
#get the module name from path
module_name=$(basename "$vbox_module")
# go through the all flavors (desktop,default ...)
for flavor in %{flavors_to_build}; do
# delete old build dir for sure
rm -rf modules_build_dir/${module_name}_${flavor}
if [ "$module_name" = "vboxdrv" -o \
"$module_name" = "vboxguest" ] ; then
SYMBOLS=""
fi
# create build directory for specific flavor
mkdir -p modules_build_dir/$flavor
# copy sources which will be used to build vbox module in last step
cp -r $vbox_module/ modules_build_dir/$flavor/
# copy vboxdrv (for host) module symbols which are used by vboxnetflt and vboxnetadp km's:
if [ "$module_name" = "vboxnetflt" -o \
"$module_name" = "vboxnetadp" ] ; then
cp $PWD/modules_build_dir/$flavor/vboxdrv/Module.symvers \
$PWD/modules_build_dir/$flavor/$module_name
SYMBOLS="$PWD/modules_build_dir/$flavor/vboxdrv/Module.symvers"
fi
# copy vboxguest (for guest) module symbols which are used by vboxsf km:
if [ "$module_name" = "vboxsf" -o \
"$module_name" = "vboxvideo" ] ; then
cp $PWD/modules_build_dir/$flavor/vboxguest/Module.symvers \
$PWD/modules_build_dir/$flavor/$module_name
SYMBOLS="$PWD/modules_build_dir/$flavor/vboxguest/Module.symvers"
fi
# build the module for the specific flavor
make -j2 -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor %{?linux_make_arch} modules \
M=$PWD/modules_build_dir/$flavor/$module_name KBUILD_EXTRA_SYMBOLS="$SYMBOLS" V=1
done
done
%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra
#Keep the install process from calling mkinitrd. The VB kernel modules are not in initrd. bsc#1052428
export INITRD_IN_POSTTRANS=1
export KMP_NEEDS_MKINITRD=0
#to install modules we use here similar steps like in build phase, go through all the modules :
for module_name in vbox{drv,netflt,netadp,guest,sf,video}
do
#and through the all flavors
for flavor in %{flavors_to_build}; do
make -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules_install M=$PWD/modules_build_dir/$flavor/$module_name
done
done
%changelog