about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-05-17 10:56:54 +0000
committerAlyssa Ross <hi@alyssa.is>2019-05-17 10:56:54 +0000
commitc1d22074139ab0d048a05b5e5116265d099114d6 (patch)
tree97977009422d675f8930f97c309b010481289e72 /nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions
parent4dc8afe4fd6b18437150129e0a1ecc23c6a1c0b9 (diff)
parentbc9df0f66110039e495b6debe3a6cda4a1bb0fed (diff)
downloadnixlib-c1d22074139ab0d048a05b5e5116265d099114d6.tar
nixlib-c1d22074139ab0d048a05b5e5116265d099114d6.tar.gz
nixlib-c1d22074139ab0d048a05b5e5116265d099114d6.tar.bz2
nixlib-c1d22074139ab0d048a05b5e5116265d099114d6.tar.lz
nixlib-c1d22074139ab0d048a05b5e5116265d099114d6.tar.xz
nixlib-c1d22074139ab0d048a05b5e5116265d099114d6.tar.zst
nixlib-c1d22074139ab0d048a05b5e5116265d099114d6.zip
Merge commit 'bc9df0f66110039e495b6debe3a6cda4a1bb0fed'
Diffstat (limited to 'nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions')
-rw-r--r--nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix82
-rw-r--r--nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch38
-rw-r--r--nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch12
3 files changed, 34 insertions, 98 deletions
diff --git a/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index ecefc9bc07e9..1a5c6c670c85 100644
--- a/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
+++ b/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, lib, patchelf, cdrkit, kernel, which, makeWrapper
-, xorg, dbus, virtualbox }:
+, zlib, xorg, dbus, virtualbox }:
 
 let
   version = virtualbox.version;
@@ -19,32 +19,23 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso";
-    sha256 = "0cwdmdgcd1jysyw7c9b3cdk1ngk5nq7slh1zkhxkvvq142cnm1v9";
+    sha256 = "1srcsf9264l5yxbq2x83z66j38blbfrywq5lkzwb5kih6sv548c3";
   };
 
   KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
   KERN_INCL = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/include";
 
-  patchFlags = [ "-p1" "-d" "install/src/vboxguest-${version}" ];
-
-  patches = [
-    ./fix_kerndir.patch
-    ./fix_kernincl.patch
-  ];
+  # If you add a patch you probably need this.
+  #patchFlags = [ "-p1" "-d" "install/src/vboxguest-${version}" ];
 
   hardeningDisable = [ "pic" ];
 
   NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration";
 
   nativeBuildInputs = [ patchelf makeWrapper ];
-  buildInputs = [ cdrkit dbus ] ++ kernel.moduleBuildDependencies;
+  buildInputs = [ cdrkit ] ++ kernel.moduleBuildDependencies;
 
-  installPhase = ''
-    mkdir -p $out
-    cp -r install/* $out
-  '';
-
-  buildCommand = with xorg; ''
+  unpackPhase = ''
     ${if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then ''
         isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run
         chmod 755 ./VBoxLinuxAdditions.run
@@ -63,39 +54,30 @@ stdenv.mkDerivation {
       ''
       else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions")
     }
+  '';
 
-    cd ../
-    patchPhase
-    cd install/src
-
-    # Build kernel modules
-    export INSTALL_MOD_PATH=$out
+  doConfigure = false;
 
+  buildPhase = ''
+    # Build kernel modules.
+    cd src
     find . -type f | xargs sed 's/depmod -a/true/' -i
-
     cd vboxguest-${version}
-
+    # Run just make first. If we only did make install, we get symbol warnings during build.
     make
-
     cd ../..
 
     # Change the interpreter for various binaries
-    for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} other/mount.vboxsf
-    do
-        ${if stdenv.hostPlatform.system == "i686-linux" then ''
-          patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $i
-        ''
-        else if stdenv.hostPlatform.system == "x86_64-linux" then ''
-          patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2 $i
-        ''
-        else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions")
-        }
-        patchelf --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc dbus libX11 libXt libXext libXmu libXfixes libXrandr libXcursor ]} $i
+    for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} other/mount.vboxsf; do
+        patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} $i
+        patchelf --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc zlib
+          xorg.libX11 xorg.libXt xorg.libXext xorg.libXmu xorg.libXfixes xorg.libXrandr xorg.libXcursor ]} $i
     done
 
     for i in lib/VBoxOGL*.so
     do
-        patchelf --set-rpath ${lib.makeLibraryPath [ "$out" dbus libXcomposite libXdamage libXext libXfixes ]} $i
+        patchelf --set-rpath ${lib.makeLibraryPath [ "$out"
+          xorg.libXcomposite xorg.libXdamage xorg.libXext xorg.libXfixes ]} $i
     done
 
     # FIXME: Virtualbox 4.3.22 moved VBoxClient-all (required by Guest Additions
@@ -105,6 +87,13 @@ stdenv.mkDerivation {
     # Remove references to /usr from various scripts and files
     sed -i -e "s|/usr/bin|$out/bin|" other/vboxclient.desktop
     sed -i -e "s|/usr/bin|$out/bin|" bin/VBoxClient-all
+  '';
+
+  installPhase = ''
+    # Install kernel modules.
+    cd src/vboxguest-${version}
+    make install INSTALL_MOD_PATH=$out
+    cd ../..
 
     # Install binaries
     install -D -m 755 other/mount.vboxsf $out/bin/mount.vboxsf
@@ -131,21 +120,18 @@ stdenv.mkDerivation {
     # Install Xorg drivers
     mkdir -p $out/lib/xorg/modules/{drivers,input}
     install -m 644 other/vboxvideo_drv_${xserverABI}.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so
+  '';
 
-    # Install kernel modules
-    cd src
+  # Stripping breaks these binaries for some reason.
+  dontStrip = true;
 
-    for i in *
-    do
-        cd $i
-        kernelVersion=$(cd ${kernel.dev}/lib/modules; ls)
-        export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
-        find . -type f | xargs sed -i -e "s|-o root||g" \
-                                      -e "s|-g root||g"
-        make install
-        cd ..
+  # Some code dlopen() libdbus, patch RUNPATH in fixupPhase so it isn't stripped.
+  postFixup = ''
+    for i in $(grep -F libdbus-1.so -l -r $out/{lib,bin}); do
+      origRpath=$(patchelf --print-rpath "$i")
+      patchelf --set-rpath "$origRpath:${lib.makeLibraryPath [ dbus ]}" "$i"
     done
-  ''; # */
+  '';
 
   meta = {
     description = "Guest additions for VirtualBox";
diff --git a/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch b/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch
deleted file mode 100644
index 0be949f63c92..000000000000
--- a/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-diff --git a/vboxsf/Makefile.include.header b/vboxsf/Makefile.include.header
-index 8df1eb4d25..5a3e5604e7 100644
---- a/vboxsf/Makefile.include.header
-+++ b/vboxsf/Makefile.include.header
-@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),)
- endif # neq($(KERNELRELEASE),)
-
- # Kernel build folder
--KERN_DIR := /lib/modules/$(KERN_VER)/build
- ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
-  $(error Error: unable to find the headers of the Linux kernel to build against. \
-           Specify KERN_VER=<version> and run Make again)
-
-diff --git a/vboxguest/Makefile.include.header b/vboxguest/Makefile.include.header
-index 8df1eb4d25..5a3e5604e7 100644
---- a/vboxguest/Makefile.include.header
-+++ b/vboxguest/Makefile.include.header
-@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),)
- endif # neq($(KERNELRELEASE),)
-
- # Kernel build folder
--KERN_DIR := /lib/modules/$(KERN_VER)/build
- ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
-  $(error Error: unable to find the headers of the Linux kernel to build against. \
-           Specify KERN_VER=<version> and run Make again)
-
-diff --git a/vboxvideo/Makefile.include.header b/vboxvideo/Makefile.include.header
-index 8df1eb4d25..5a3e5604e7 100644
---- a/vboxvideo/Makefile.include.header
-+++ b/vboxvideo/Makefile.include.header
-@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),)
- endif # neq($(KERNELRELEASE),)
-
- # Kernel build folder
--KERN_DIR := /lib/modules/$(KERN_VER)/build
- ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
-  $(error Error: unable to find the headers of the Linux kernel to build against. \
-           Specify KERN_VER=<version> and run Make again)
diff --git a/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch b/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch
deleted file mode 100644
index e59e2e98c1b3..000000000000
--- a/nixpkgs/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/vboxvideo/Makefile.include.header b/vboxvideo/Makefile.include.header
-index 8df1eb4d25..5a3e5604e7 100644
---- a/vboxvideo/Makefile.include.header
-+++ b/vboxvideo/Makefile.include.header
-@@ -122,7 +122,6 @@ ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
-           Specify KERN_VER=<version> and run Make again)
- endif
- # Kernel include folder
--KERN_INCL := $(KERN_DIR)/include
- # module install folder
- INSTALL_MOD_DIR ?= misc
- MODULE_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KERN_VER)/$(INSTALL_MOD_DIR)