# 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=5.2.16 pkgrel=1 arch=('x86_64') url='https://www.virtualbox.org' license=('GPL') makedepends=('alsa-lib' 'bin86' 'cdrkit' 'curl' 'dev86' 'device-mapper' 'glu' 'gsoap' 'iasl' 'openjdk' 'opus' 'libidl2' 'libpulse' 'libstdc++5' 'libvncserver' 'libvpx' 'libxcomposite' 'libxcursor' 'libxinerama' 'libxml2' 'libxmu' 'libxrandr' 'libxslt' 'libxtst' 'linux-headers' 'mesa' 'python2' '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" 'virtualbox-host-dkms.conf' 'virtualbox-guest-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' '007-python2-path.patch' '008-no-vboxvideo.patch' '009-include-path.patch' '010-qt-5.11.patch' 'PUEL') noextract=(VBoxGuestAdditions_$pkgver.iso "Oracle_VM_VirtualBox_Extension_Pack-$pkgver.vbox-extpack") sha256sums=('c30383ad9c86b8a2d1fee03e576f0c0b6ec5354cbfba5f795bf3c5cd339bf650' '68ddc870c9b9faf61850a69155388e5f3de0189f2d19ad4131e3c71aff2d26b0' 'dcb3b24d28c30749e6c073e102719ba16700fc9fe4e7a25de9503976b6774bf5' 'deb03efa7ad0376aa55a087f2e882afe00935f10b0e7aa853ba9147090d341ec' '113f9b92141b85df01f1e74d22f01d1f1aa81650eb79b89ceefc3cae20afe2e2' '2101ebb58233bbfadf3aa74381f22f7e7e508559d2b46387114bc2d8e308554c' 'da4c49f6ca94e047e196cdbcba2c321199f4760056ea66e0fbc659353e128c9e' '9c5238183019f9ebc7d92a8582cad232f471eab9d3278786225abc1a1c7bf66e' '033c597e0f5285d2ddb0490868e5b6f945f45c7b1b1152a02a9e6fea438b2c95' '55bd0bfa3265c098f2b67de3af3cdd2ad86f21282a49bfe79cbb22c0094ecfe7' 'bd80a7dd625d370d5ffbfe76af343f520515ef5a71c5a70d74d8f86090035101' '01dbb921bd57a852919cc78be5b73580a564f28ebab2fe8d6c9b8301265cbfce' 'e6e875ef186578b53106d7f6af48e426cdaf1b4e86834f01696b8ef1c685787f' '2a9d7748dc58f9d091f791da06b733a696943114f7c0d580fa00a0752eb1d2ac' 'f67674931c30187f867233e3a4ae662f93c9110fbd0bfce50dd9f391f4533bc0' '7d2da8fe10a90f76bbfc80ad1f55df4414f118cd10e10abfb76070326abebd46' '5d5af2de5b1f1c61ec793503350f2440661cf8fd640f11b8a86f10bce499c0dc' '6bdb017459532537199c399eefd3d84d8dc7f1786e79997caebd3b6eb5c75d9f' '8b7f241107863f82a5b0ae336aead0b3366a40103ff72dbebf33f54b512a0cbc' '1acc7014bcb3d9ca6da29eed813c3d6e91a688c43f9d93802fd4e3814f67ace4' 'c6ef35e6893d557c7c2269ff79bc299fe9058cfb2c933a7efdc7a8a7b6d9c5da' '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 # workaround, to be removed https://www.virtualbox.de/ticket/17036 echo "VBOX_WITH_EXTPACK_VBOXDTRACE=" >> LocalConfig.kmk msg2 'Remove gcc version censorship' sed -i 's/^check_gcc$/#check_gcc/' configure msg2 'Use our CFLAGS' echo "VBOX_GCC_OPT=$CXXFLAGS" >> LocalConfig.kmk msg2 'Use system GL headers' echo 'VBOX_USE_SYSTEM_GL_HEADERS=true' >> 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.3 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' 'python2' 'sdl' 'libvpx' 'libxml2' 'procps-ng' 'shared-mime-info' 'zlib' 'libxcursor' 'libxinerama' 'libx11' 'libxext' 'libxmu' 'libxt' 'VIRTUALBOX-HOST-MODULES') optdepends=('qt5-x11extras: GUI support' 'vde2: Virtual Distributed Ethernet support' 'virtualbox-guest-iso: Guest Additions CD image' 'virtualbox-ext-vnc: VNC server support' 'virtualbox-sdk: Developer kit' 'net-tools: Host-only or bridged networking support') backup=('etc/vbox/vbox.cfg') install=virtualbox.install source "VirtualBox-$pkgver/env.sh" cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin" # binaries install -dm755 "$pkgdir/usr/bin" install -m755 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 -m755 VBoxTunctl "$pkgdir/usr/bin" install -m755 rdesktop-vrdp "$pkgdir/usr/bin" # libraries install -dm755 "$pkgdir/usr/lib/virtualbox" install -m755 *.so "$pkgdir/usr/lib/virtualbox" install -m644 *.rc *.r0 VBoxEFI*.fd "$pkgdir/usr/lib/virtualbox" ## setuid root binaries install -m4755 VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetAdpCtl VBoxNetNAT -t "$pkgdir/usr/lib/virtualbox" ## other binaries install -m755 VBoxManage VBoxSVC VBoxExtPackHelperApp VBoxXPCOMIPCD VBoxTestOGL VBoxBalloonCtrl vboxwebsrv webtest -t "$pkgdir/usr/lib/virtualbox" # components install -dm755 "$pkgdir/usr/lib/virtualbox/components" install -m755 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 -dm755 "$pkgdir/var/lib/virtualbox/extensions" #install -dm755 "$pkgdir/usr/share/virtualbox/extensions" #ln -s ../../../var/lib/virtualbox/extensions "$pkgdir/usr/lib/virtualbox/ExtensionPacks" install -dm755 "$pkgdir/usr/lib/virtualbox/ExtensionPacks" # languages install -dm755 "$pkgdir/usr/share/virtualbox/nls" install -m755 nls/*.qm -t "$pkgdir/usr/share/virtualbox/nls" # rdesktop keymaps install -dm755 "$pkgdir/usr/share/virtualbox/rdesktop-vrdp-keymaps" install -m644 rdesktop-vrdp-keymaps/* "$pkgdir/usr/share/virtualbox/rdesktop-vrdp-keymaps" # useless scripts install -m755 VBoxCreateUSBNode.sh VBoxSysInfo.sh -t "$pkgdir/usr/share/virtualbox" # icons install -Dm644 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 -Dm644 virtualbox.desktop "$pkgdir/usr/share/applications/virtualbox.desktop" install -Dm644 virtualbox.xml "$pkgdir/usr/share/mime/packages/virtualbox.xml" #install configuration install -dm755 "$pkgdir/etc/vbox" echo 'INSTALL_DIR=/usr/lib/virtualbox' > "$pkgdir/etc/vbox/vbox.cfg" # back to srcdir cd "$srcdir" #licence install -Dm644 VirtualBox-$pkgver/COPYING "$pkgdir/usr/share/licenses/$pkgname/LICENSE" # install systemd stuff install -Dm644 60-vboxdrv.rules "$pkgdir/usr/lib/udev/rules.d/60-vboxdrv.rules" install -Dm644 vboxweb.service "$pkgdir/usr/lib/systemd/system/vboxweb.service" install -Dm644 virtualbox.sysusers "$pkgdir/usr/lib/sysusers.d/virtualbox.conf" # install module reloading shortcut (with a symlink with default helper) install -Dm755 vboxreload "$pkgdir/usr/bin" ln -s vboxreload "$pkgdir/usr/bin/rcvboxdrv" } package_virtualbox-sdk() { pkgdesc='VirtualBox Software Developer Kit (SDK)' depends=('python2') install -dm755 "$pkgdir/usr/lib/virtualbox" source "VirtualBox-$pkgver/env.sh" cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin" install -Dm755 vboxshell.py "$pkgdir/usr/lib/virtualbox/vboxshell.py" # python sdk pushd sdk/installer VBOX_INSTALL_PATH="/usr/lib/virtualbox" python2 vboxapisetup.py install --root "$pkgdir" popd rm -rf sdk/installer cp -r sdk "$pkgdir/usr/lib/virtualbox" # licence install -Dm644 "$srcdir/VirtualBox-$pkgver/COPYING" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } package_virtualbox-host-dkms() { pkgdesc='VirtualBox Host kernel modules sources' depends=('dkms' 'gcc' 'make') 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 -dm755 "$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 -Dm644 "$srcdir/VirtualBox-$pkgver/COPYING" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" # module loading local _p="$pkgdir/usr/lib/modules-load.d/$pkgname.conf" install -Dm644 /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 -Dm644 "$srcdir/$pkgname.conf" "$_p" sed -i "s,@VERSION@,$pkgver," "$_p" install -dm 755 "$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') 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 -dm755 "$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 -Dm644 "$srcdir/VirtualBox-$pkgver/COPYING" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" # module loading local _p="$pkgdir/usr/lib/modules-load.d/$pkgname.conf" install -Dm644 /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 -Dm644 "$srcdir/$pkgname.conf" "$_p" sed -i "s,@VERSION@,$pkgver," "$_p" install -dm 755 "$pkgdir/var/lib/dkms/vboxguest/$pkgver" ln -s "/usr/src/vboxguest-${pkgver}_OSE/" "$pkgdir/var/lib/dkms/vboxguest/$pkgver/source" } package_virtualbox-guest-utils() { pkgdesc='VirtualBox Guest userspace utilities' depends=('glibc' 'pam' 'libx11' 'libxcomposite' 'libxdamage' 'libxext' 'libxfixes' 'libxmu' 'libxt' 'xorg-xrandr' 'VIRTUALBOX-GUEST-MODULES' 'X-ABI-VIDEODRV_VERSION=24.0') replaces=('virtualbox-guest-additions') conflicts=('virtualbox-guest-additions' '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 -m755 VBoxClient VBoxControl VBoxService mount.vboxsf "$pkgdir/usr/bin" install -m755 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/98vboxadd-xclient \ "$pkgdir"/usr/bin/VBoxClient-all install -m644 -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 -m755 VBoxOGL*.so "$pkgdir/usr/lib" ln -s /usr/lib/VBoxOGL.so "$pkgdir/usr/lib/xorg/modules/dri/vboxvideo_dri.so" install -m755 -D pam_vbox.so "$pkgdir/usr/lib/security/pam_vbox.so" popd # systemd stuff install -Dm644 60-vboxguest.rules "$pkgdir/usr/lib/udev/rules.d/60-vboxguest.rules" install -Dm644 vboxservice.service "$pkgdir/usr/lib/systemd/system/vboxservice.service" install -Dm644 virtualbox-guest-utils.sysusers "$pkgdir/usr/lib/sysusers.d/virtualbox-guest-utils.conf" # licence install -Dm644 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 -m755 VBoxControl VBoxService mount.vboxsf "$pkgdir/usr/bin" install -m755 -D pam_vbox.so "$pkgdir/usr/lib/security/pam_vbox.so" popd # systemd stuff install -Dm644 60-vboxguest.rules "$pkgdir/usr/lib/udev/rules.d/60-vboxguest.rules" install -Dm644 vboxservice-nox.service "$pkgdir/usr/lib/systemd/system/vboxservice.service" install -Dm644 virtualbox-guest-utils.sysusers "$pkgdir/usr/lib/sysusers.d/virtualbox-guest-utils.conf" # licence install -Dm644 "$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 -Dm644 VNC-*.vbox-extpack "$pkgdir/usr/share/virtualbox/extensions/VNC-${pkgver}.vbox-extpack" # licence install -Dm644 "$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" }