desktop/virtualbox/PKGBUILD
2019-01-29 08:04:37 +01:00

436 lines
18 KiB
Bash

# Arch contributor: https://projects.archlinux.org/svntogit/community.git/plain/trunk/PKGBUILD?h=packages/virtualbox
pkgbase=virtualbox
pkgname=('virtualbox'
'virtualbox-host-dkms'
'virtualbox-guest-dkms'
'virtualbox-sdk'
'virtualbox-guest-utils'
'virtualbox-guest-utils-nox'
'virtualbox-guest-iso'
'virtualbox-ext-vnc'
'virtualbox-ext-oracle')
pkgver=6.0.4
pkgrel=1
_vboxsf_commit='9451f61e6787e95aa51e42b6381db6b059bc49da'
arch=('x86_64')
url='https://virtualbox.org'
license=('GPL' 'custom')
makedepends=('alsa-lib'
'bin86'
'cdrkit'
'curl'
'dev86'
'device-mapper'
'git'
'glu'
'gsoap'
'iasl'
'openjdk'
'libidl2'
'libpulse'
'libstdc++5'
'libvncserver'
'libvpx'
'libxcomposite'
'libxcursor'
'libxinerama'
'libxml2'
'libxmu'
'libxrandr'
'libxslt'
'libxtst'
'linux-headers'
'mesa'
'opus'
'python3'
'qt5-base'
'qt5-x11extras'
'qt5-tools'
'sdl'
'sdl_ttf'
'vde2'
'xalan-c'
'xf86driproto'
'xorg-server-devel'
'gcc'
'lib32-gcc-libs'
'lib32-glibc')
source=("http://download.virtualbox.org/virtualbox/$pkgver/VirtualBox-$pkgver.tar.bz2"
"http://download.virtualbox.org/virtualbox/$pkgver/VBoxGuestAdditions_$pkgver.iso"
"http://download.virtualbox.org/virtualbox/$pkgver/Oracle_VM_VirtualBox_Extension_Pack-$pkgver.vbox-extpack"
# We need to build a modified version of vboxsf for Linux 4.16
# https://bugzilla.redhat.com/show_bug.cgi?id=1481630#c65
"git+https://github.com/jwrdegoede/vboxsf#commit=$_vboxsf_commit"
'virtualbox-host-dkms.conf'
'virtualbox-guest-dkms.conf'
'virtualbox-vboxsf-dkms.conf'
'virtualbox.sysusers'
'virtualbox-guest-utils.sysusers'
'60-vboxdrv.rules'
'60-vboxguest.rules'
'LocalConfig.kmk'
'vboxservice.service'
'vboxservice-nox.service'
'vboxweb.service'
'vboxreload'
'002-dri-driver-path.patch'
'005-gsoap-build.patch'
'006-rdesktop-vrdp-keymap-path.patch'
'008-no-vboxvideo.patch'
'009-include-path.patch'
'011-python-3-7.patch'
# The following patch and mount.vboxsf wrapper should be removed
# once support for mainline-style options string gets upstreamed
'012-vboxsf-automount.patch'
'mount.vboxsf'
'PUEL')
noextract=(VBoxGuestAdditions_$pkgver.iso
"Oracle_VM_VirtualBox_Extension_Pack-$pkgver.vbox-extpack")
sha256sums=('f80b0c68182c946fb74ada8034960c38159ad91085b153da1277e4f191af6e1f'
'749b0c76aa6b588e3310d718fc90ea472fdc0b7c8953f7419c20be7e7fa6584a'
'8887d5dd9dd26bd376926b38857715e28f2d678b6d3a034144ddc3fde4a387d9'
'SKIP'
'deb03efa7ad0376aa55a087f2e882afe00935f10b0e7aa853ba9147090d341ec'
'c328376b05183d269f98319ec660f54c55e298f77d229977606862b064651a7c'
'e37712bcbbafbdee47230a962446d63b0ae882801a89931d93ad9e704e70ad4b'
'2101ebb58233bbfadf3aa74381f22f7e7e508559d2b46387114bc2d8e308554c'
'da4c49f6ca94e047e196cdbcba2c321199f4760056ea66e0fbc659353e128c9e'
'9c5238183019f9ebc7d92a8582cad232f471eab9d3278786225abc1a1c7bf66e'
'033c597e0f5285d2ddb0490868e5b6f945f45c7b1b1152a02a9e6fea438b2c95'
'2cb3b67883a4c747492e474e22ad568781823ef18deebb96152f9883e0c2cc1c'
'bd80a7dd625d370d5ffbfe76af343f520515ef5a71c5a70d74d8f86090035101'
'01dbb921bd57a852919cc78be5b73580a564f28ebab2fe8d6c9b8301265cbfce'
'e6e875ef186578b53106d7f6af48e426cdaf1b4e86834f01696b8ef1c685787f'
'2a9d7748dc58f9d091f791da06b733a696943114f7c0d580fa00a0752eb1d2ac'
'f67674931c30187f867233e3a4ae662f93c9110fbd0bfce50dd9f391f4533bc0'
'7d2da8fe10a90f76bbfc80ad1f55df4414f118cd10e10abfb76070326abebd46'
'13c6ca9be0f91582445fd2a14a8c58a0625a15d9cb98cb6e8c2736d77ea976ab'
'8b7f241107863f82a5b0ae336aead0b3366a40103ff72dbebf33f54b512a0cbc'
'1acc7014bcb3d9ca6da29eed813c3d6e91a688c43f9d93802fd4e3814f67ace4'
'55224cb74b54b331d691f171efc0d4c058a14f738551f1d8f559146c2908635d'
'a784f3cc24652a16385cc63abac6c5178932ca5f3861be7650631b7dafa753a4'
'f3ed6741f8977f40900c8aa372fa082df1f8723d497d4fff445153c543bc8947'
'715c7246dc0f779ceab39446812362b2f9bf64a55ed5d3a905f053cfab36da9e')
prepare() {
cd "VirtualBox-$pkgver"
# apply patch from the source array (should be a pacman feature)
local filename
for filename in "${source[@]}"; do
if [[ "$filename" =~ \.patch$ ]]; then
msg2 "Applying patch ${filename##*/}"
patch -p1 -N -i "$srcdir/${filename##*/}"
fi
done
msg2 'Applying local config'
cp "$srcdir/LocalConfig.kmk" .
msg2 'Use our CFLAGS'
echo "VBOX_GCC_OPT=$CXXFLAGS" >> LocalConfig.kmk
cd $srcdir
msg2 'Get our batch agreement hash of PUEL of Oracle Extension Pack'
[[ -d shrunk ]] || mkdir shrunk
tar xfC "Oracle_VM_VirtualBox_Extension_Pack-$pkgver.vbox-extpack" shrunk
}
build() {
cd "VirtualBox-$pkgver"
msg2 'Build virtualbox'
./configure \
--disable-docs \
--enable-webservice \
--enable-vde \
--enable-vnc \
--disable-kmods \
--with-makeself=/usr/bin/echo
# fake makeself binary to compile without nofatal
# makeself is used by linux installer. we don't need it.
source ./env.sh
kmk
msg2 'Build rdesktop-vrdp'
kmk -C src/VBox/RDP/client-1.8.4
msg2 'Build VNC extension pack'
kmk -C src/VBox/ExtPacks/VNC packing
}
package_virtualbox() {
pkgdesc='Powerful x86 virtualization for enterprise as well as home use'
depends=('glibc' 'openssl' 'curl' 'gcc-libs' 'libpng' 'python3' 'sdl'
'libvpx' 'libxml2' 'procps-ng' 'shared-mime-info' 'zlib'
'libxcursor' 'libxinerama' 'libx11' 'libxext' 'libxmu' 'libxt'
'VIRTUALBOX-HOST-MODULES')
optdepends=('vde2: Virtual Distributed Ethernet support'
'qt5-x11extras: GUI support'
'virtualbox-guest-iso: Guest Additions CD image'
'virtualbox-ext-vnc: VNC server support'
'virtualbox-sdk: Developer kit')
backup=('etc/vbox/vbox.cfg')
replaces=('virtualbox-ose')
conflicts=('virtualbox-ose')
install=virtualbox.install
source "VirtualBox-$pkgver/env.sh"
cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin"
# binaries
install -dm0755 "$pkgdir/usr/bin"
install -m0755 VBox.sh "$pkgdir/usr/bin/VBox"
for i in VBoxHeadless VBoxManage VBoxSDL VirtualBox vboxwebsrv VBoxBalloonCtrl; do
ln -sf VBox "$pkgdir/usr/bin/$i"
ln -sf VBox "$pkgdir/usr/bin/${i,,}"
done
install -m0755 VBoxTunctl "$pkgdir/usr/bin"
install -m0755 rdesktop-vrdp "$pkgdir/usr/bin"
# libraries
install -dm0755 "$pkgdir/usr/lib/virtualbox"
install -m0755 *.so "$pkgdir/usr/lib/virtualbox"
install -m0644 *.rc *.r0 VBoxEFI*.fd "$pkgdir/usr/lib/virtualbox"
## setuid root binaries
install -m4755 VBoxSDL VirtualBoxVM VBoxHeadless VBoxNetDHCP VBoxNetAdpCtl VBoxNetNAT -t "$pkgdir/usr/lib/virtualbox"
## other binaries
install -m0755 VirtualBox VBoxManage VBoxSVC VBoxExtPackHelperApp VBoxXPCOMIPCD VBoxTestOGL VBoxBalloonCtrl vboxwebsrv webtest -t "$pkgdir/usr/lib/virtualbox"
# components
install -dm0755 "$pkgdir/usr/lib/virtualbox/components"
install -m0755 components/* -t "$pkgdir/usr/lib/virtualbox/components"
# extensions packs
## as virtualbox install itself stuff in this directory, move it to /var and
## trick it with a symlink
## FIXME: trick is disabled for now
#install -dm0755 "$pkgdir/var/lib/virtualbox/extensions"
#install -dm0755 "$pkgdir/usr/share/virtualbox/extensions"
#ln -s ../../../var/lib/virtualbox/extensions "$pkgdir/usr/lib/virtualbox/ExtensionPacks"
install -dm0755 "$pkgdir/usr/lib/virtualbox/ExtensionPacks"
# languages
install -dm0755 "$pkgdir/usr/share/virtualbox/nls"
install -m0755 nls/*.qm -t "$pkgdir/usr/share/virtualbox/nls"
# rdesktop keymaps
install -dm0755 "$pkgdir/usr/share/virtualbox/rdesktop-vrdp-keymaps"
install -m0644 rdesktop-vrdp-keymaps/* "$pkgdir/usr/share/virtualbox/rdesktop-vrdp-keymaps"
# useless scripts
install -m0755 VBoxCreateUSBNode.sh VBoxSysInfo.sh -t "$pkgdir/usr/share/virtualbox"
# icons
install -Dm0644 VBox.png "$pkgdir/usr/share/pixmaps/VBox.png"
pushd icons >/dev/null
for i in *; do
install -d "$pkgdir/usr/share/icons/hicolor/$i/mimetypes"
cp $i/* "$pkgdir/usr/share/icons/hicolor/$i/mimetypes"
done
popd >/dev/null
#desktop
install -Dm0644 virtualbox.desktop "$pkgdir/usr/share/applications/virtualbox.desktop"
install -Dm0644 virtualbox.xml "$pkgdir/usr/share/mime/packages/virtualbox.xml"
#install configuration
install -dm0755 "$pkgdir/etc/vbox"
echo 'INSTALL_DIR=/usr/lib/virtualbox' > "$pkgdir/etc/vbox/vbox.cfg"
# back to srcdir
cd "$srcdir"
#licence
install -Dm0644 VirtualBox-$pkgver/COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# install systemd stuff
install -Dm0644 60-vboxdrv.rules "$pkgdir/usr/lib/udev/rules.d/60-vboxdrv.rules"
install -Dm0644 vboxweb.service "$pkgdir/usr/lib/systemd/system/vboxweb.service"
install -Dm0644 virtualbox.sysusers "$pkgdir/usr/lib/sysusers.d/virtualbox.conf"
# install module reloading shortcut (with a symlink with default helper)
install -Dm0755 vboxreload "$pkgdir/usr/bin"
ln -s vboxreload "$pkgdir/usr/bin/rcvboxdrv"
}
package_virtualbox-sdk() {
pkgdesc='VirtualBox Software Developer Kit (SDK)'
depends=('python3')
install -dm0755 "$pkgdir/usr/lib/virtualbox"
source "VirtualBox-$pkgver/env.sh"
cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin"
install -Dm0755 vboxshell.py "$pkgdir/usr/lib/virtualbox/vboxshell.py"
# python sdk
pushd sdk/installer
VBOX_INSTALL_PATH="/usr/lib/virtualbox" python vboxapisetup.py install --root "$pkgdir"
popd
cp -r sdk "$pkgdir/usr/lib/virtualbox"
rm -r "$pkgdir/usr/lib/virtualbox/sdk/installer"
# licence
install -Dm0644 "$srcdir/VirtualBox-$pkgver/COPYING" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_virtualbox-host-dkms() {
pkgdesc='VirtualBox Host kernel modules sources'
depends=('dkms' 'gcc' 'make')
replaces=('virtualbox-host-modules'
'virtualbox-host-modules-lts')
provides=('VIRTUALBOX-HOST-MODULES')
optdepends=('linux-headers: build modules against Chakra kernel'
'linux-lts-headers: build modules against LTS kernel')
install=virtualbox-host-dkms.install
install -dm0755 "$pkgdir/usr/src"
source "VirtualBox-$pkgver/env.sh"
cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin"
cp -r src "$pkgdir/usr/src/vboxhost-${pkgver}_OSE"
# licence
install -Dm0644 "$srcdir/VirtualBox-$pkgver/COPYING" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# module loading
local _p="$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
install -Dm0644 /dev/null "$_p"
printf "vboxdrv\nvboxpci\nvboxnetadp\nvboxnetflt\n" > "$_p"
# starting vbox 5.1, dkms.conf file was dropped
local _p="$pkgdir/usr/src/vboxhost-${pkgver}_OSE/dkms.conf"
install -Dm0644 "$srcdir/$pkgname.conf" "$_p"
sed -i "s,@VERSION@,$pkgver," "$_p"
install -dm0755 "$pkgdir/var/lib/dkms/vboxhost/$pkgver"
ln -s "/usr/src/vboxhost-${pkgver}_OSE/" "$pkgdir/var/lib/dkms/vboxhost/$pkgver/source"
sed -i -e "s/vboxver=.*/vboxver=${pkgver}/" "${startdir}/virtualbox-host-dkms.install"
}
package_virtualbox-guest-dkms() {
pkgdesc='VirtualBox Guest kernel modules sources'
depends=('dkms' 'gcc' 'make')
replaces=('virtualbox-guest-modules'
'virtualbox-guest-modules-lts')
provides=('VIRTUALBOX-GUEST-MODULES')
optdepends=('linux-headers: build modules against Chakra kernel'
'linux-lts-headers: build modules against LTS kernel')
install=virtualbox-guest-dkms.install
install -dm0755 "$pkgdir/usr/src"
source "VirtualBox-$pkgver/env.sh"
cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
cp -r src "$pkgdir/usr/src/vboxguest-${pkgver}_OSE"
# licence
install -Dm0644 "$srcdir/VirtualBox-$pkgver/COPYING" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# module loading
local _p="$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
install -Dm0644 /dev/null "$_p"
printf "vboxguest\nvboxsf\nvboxvideo\n" > "$_p"
# starting vbox 5.1, dkms.conf file was dropped
local _p="$pkgdir/usr/src/vboxguest-${pkgver}_OSE/dkms.conf"
install -Dm0644 "$srcdir/$pkgname.conf" "$_p"
sed -i "s,@VERSION@,$pkgver," "$_p"
# vboxsf module for Linux 4.16 and later
install -d "$pkgdir/usr/src/vboxsf-${pkgver}_OSE"
cp -rT "$srcdir/vboxsf" "$pkgdir/usr/src/vboxsf-${pkgver}_OSE/vboxsf"
rm -rf "$pkgdir/usr/src/vboxsf-${pkgver}_OSE/vboxsf/.git"
echo "obj-m = vboxsf/" >"$pkgdir/usr/src/vboxsf-${pkgver}_OSE/Makefile"
local _p="$pkgdir/usr/src/vboxsf-${pkgver}_OSE/dkms.conf"
install -Dm0644 "$srcdir/virtualbox-vboxsf-dkms.conf" "$_p"
sed -i "s,@VERSION@,$pkgver," "$_p"
}
package_virtualbox-guest-utils() {
pkgdesc='VirtualBox Guest userspace utilities'
depends=('glibc' 'pam' 'libx11' 'libxcomposite'
'libxdamage' 'libxext' 'libxfixes' 'libxmu' 'libxt' 'xorg-xrandr'
'VIRTUALBOX-GUEST-MODULES')
conflicts=('virtualbox-guest-utils-nox')
install=virtualbox-guest-utils.install
source "VirtualBox-$pkgver/env.sh"
pushd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
install -d "$pkgdir/usr/bin"
install -m0755 VBoxClient VBoxControl VBoxService "$srcdir/mount.vboxsf" "$pkgdir/usr/bin"
install -Dm0755 mount.vboxsf "$pkgdir/usr/lib/virtualbox/mount.vboxsf"
install -m0755 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/98vboxadd-xclient \
"$pkgdir"/usr/bin/VBoxClient-all
install -m0644 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/vboxclient.desktop \
"$pkgdir"/etc/xdg/autostart/vboxclient.desktop
install -d "$pkgdir/usr/lib/xorg/modules/dri"
install -m0755 VBoxOGL*.so "$pkgdir/usr/lib"
ln -s /usr/lib/VBoxOGL.so "$pkgdir/usr/lib/xorg/modules/dri/vboxvideo_dri.so"
install -m0755 -D pam_vbox.so "$pkgdir/usr/lib/security/pam_vbox.so"
popd
# systemd stuff
install -Dm0644 60-vboxguest.rules "$pkgdir/usr/lib/udev/rules.d/60-vboxguest.rules"
install -Dm0644 vboxservice.service "$pkgdir/usr/lib/systemd/system/vboxservice.service"
install -Dm0644 virtualbox-guest-utils.sysusers "$pkgdir/usr/lib/sysusers.d/virtualbox-guest-utils.conf"
# licence
install -Dm0644 VirtualBox-$pkgver/COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_virtualbox-guest-utils-nox() {
pkgdesc='VirtualBox Guest userspace utilities without X support'
depends=('glibc' 'pam' 'VIRTUALBOX-GUEST-MODULES')
conflicts=('virtualbox-guest-utils')
install=virtualbox-guest-utils.install
source "VirtualBox-$pkgver/env.sh"
pushd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
install -d "$pkgdir/usr/bin"
install -m0755 VBoxControl VBoxService "$srcdir/mount.vboxsf" "$pkgdir/usr/bin"
install -Dm0755 mount.vboxsf "$pkgdir/usr/lib/virtualbox/mount.vboxsf"
install -m0755 -D pam_vbox.so "$pkgdir/usr/lib/security/pam_vbox.so"
popd
# systemd stuff
install -Dm0644 60-vboxguest.rules "$pkgdir/usr/lib/udev/rules.d/60-vboxguest.rules"
install -Dm0644 vboxservice-nox.service "$pkgdir/usr/lib/systemd/system/vboxservice.service"
install -Dm0644 virtualbox-guest-utils.sysusers "$pkgdir/usr/lib/sysusers.d/virtualbox-guest-utils.conf"
# licence
install -Dm0644 "$srcdir/VirtualBox-$pkgver/COPYING" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_virtualbox-guest-iso() {
pkgdesc='The official VirtualBox Guest Additions ISO image'
license=('custom:PUEL')
install=${pkgname}.install
install -Dm 644 VBoxGuestAdditions_$pkgver.iso \
"$pkgdir/usr/lib/virtualbox/additions/VBoxGuestAdditions.iso"
install -Dm 644 "$srcdir/PUEL" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_virtualbox-ext-vnc() {
pkgdesc='VirtualBox VNC extension pack'
depends=('virtualbox' 'libvncserver')
optdepends=('tigervnc: vnc client')
install=virtualbox-ext-vnc.install
source "VirtualBox-$pkgver/env.sh"
cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/packages"
install -Dm0644 VNC-*.vbox-extpack "$pkgdir/usr/share/virtualbox/extensions/VNC-${pkgver}.vbox-extpack"
# licence
install -Dm0644 "$srcdir/VirtualBox-$pkgver/COPYING" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_virtualbox-ext-oracle() {
pkgdesc="Oracle VM VirtualBox Extension Pack"
arch=('x86_64')
license=('custom:PUEL')
depends=("virtualbox")
options=('emptydirs')
install=${pkgname}.install
install -dm755 ${pkgdir}/usr/share/virtualbox/extensions
install -Dm0644 ${srcdir}/shrunk/ExtPack-license.txt "${pkgdir}/usr/share/licenses/${pkgname}/PUEL"
}
# vim:set ts=4 sw=4 et: