summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2018-05-30 02:06:49 +0000
committerOrivej Desh <orivej@gmx.fr>2018-05-30 02:06:49 +0000
commit3576d47d33f4877f7e967cb3783199e5e2765d95 (patch)
treedb5e76b2ca13f5233c439ea70ff79600a8940192 /pkgs/os-specific
parent5197a4cefd3d36ca812df0ed1da92fc0a71da070 (diff)
parent798d5f5cdb8a8b8f92f920ffc66cd480c9c661ce (diff)
downloadnixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.tar
nixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.tar.gz
nixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.tar.bz2
nixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.tar.lz
nixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.tar.xz
nixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.tar.zst
nixpkgs-3576d47d33f4877f7e967cb3783199e5e2765d95.zip
Merge branch 'master' into staging
* master: (30 commits)
  bitlbee: fix build
  git: 2.17.0 -> 2.17.1
  sc-controller: 0.4.2 -> 0.4.3
  zeroc-ice: fix parallel building
  pythonPackages.bsddb3: fix build after 0fd461d5
  haskellPackages.hlibgit2: fix build after #28029
  gdk-pixbuf: patch library rpath references on darwin
  virtualbox: fix build after #28029
  GHCJS darwin fixes (#41120)
  neovim-remote: 1.8.6 -> 2.0.5
  messenger-for-desktop: remove (#41224)
  typora: gnome2 cleanup (#41167)
  discord: gnome2 cleanup (#41174)
  skypeforlinux: gnome2 cleanup (#41176)
  wire-desktop: gnome2 cleanup (#41155)
  hyper: gnome2 cleanup (#41170)
  drone: 0.5 -> 0.8.5 (#41200)
  racket: use proper uname, allow for unix sockets
  kytea: fix build after #28029
  yoda: fix build after #28029
  ...
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/bcc/default.nix48
-rw-r--r--pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch14
-rw-r--r--pkgs/os-specific/linux/bcc/libbcc-path.patch11
3 files changed, 59 insertions, 14 deletions
diff --git a/pkgs/os-specific/linux/bcc/default.nix b/pkgs/os-specific/linux/bcc/default.nix
index 2e2c872fb18..4f0a423600f 100644
--- a/pkgs/os-specific/linux/bcc/default.nix
+++ b/pkgs/os-specific/linux/bcc/default.nix
@@ -1,9 +1,9 @@
 { stdenv, fetchFromGitHub, fetchpatch, makeWrapper, cmake, llvmPackages, kernel
-, flex, bison, elfutils, python, pythonPackages, luajit, netperf, iperf, libelf
+, flex, bison, elfutils, python, luajit, netperf, iperf, libelf
 , systemtap
 }:
 
-stdenv.mkDerivation rec {
+python.pkgs.buildPythonApplication rec {
   version = "0.5.0";
   name = "bcc-${version}";
 
@@ -14,9 +14,11 @@ stdenv.mkDerivation rec {
     sha256 = "0bb3244xll5sqx0lvrchg71qy2zg0yj6r5h4v5fvrg1fjhaldys9";
   };
 
+  format = "other";
+
   buildInputs = [
     llvmPackages.llvm llvmPackages.clang-unwrapped kernel
-    elfutils python pythonPackages.netaddr luajit netperf iperf
+    elfutils luajit netperf iperf
     systemtap.stapBuild
   ];
 
@@ -26,18 +28,31 @@ stdenv.mkDerivation rec {
       url = "https://github.com/iovisor/bcc/commit/bd7fa55bb39b8978dafd0b299e35616061e0a368.patch";
       sha256 = "1sgxhsq174iihyk1x08py73q8fh78d7y3c90k5nh8vcw2pf1xbnf";
     })
+
+    # This is needed until we fix
+    # https://github.com/NixOS/nixpkgs/issues/40427
+    ./fix-deadlock-detector-import.patch
   ];
 
   nativeBuildInputs = [ makeWrapper cmake flex bison ]
     # libelf is incompatible with elfutils-libelf
     ++ stdenv.lib.filter (x: x != libelf) kernel.moduleBuildDependencies;
 
-  cmakeFlags =
-    [ "-DBCC_KERNEL_MODULES_DIR=${kernel.dev}/lib/modules"
-      "-DREVISION=${version}"
-      "-DENABLE_USDT=ON"
-      "-DENABLE_CPP_API=ON"
-    ];
+  cmakeFlags = [
+    "-DBCC_KERNEL_MODULES_DIR=${kernel.dev}/lib/modules"
+    "-DREVISION=${version}"
+    "-DENABLE_USDT=ON"
+    "-DENABLE_CPP_API=ON"
+  ];
+
+  postPatch = ''
+    substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
+    patch -p1 < libbcc-path.patch
+  '';
+
+  propagatedBuildInputs = [
+    python.pkgs.netaddr
+  ];
 
   postInstall = ''
     mkdir -p $out/bin $out/share
@@ -47,12 +62,17 @@ stdenv.mkDerivation rec {
 
     find $out/share/bcc/tools -type f -executable -print0 | \
     while IFS= read -r -d ''$'\0' f; do
-      pythonLibs="$out/lib/python2.7/site-packages:${pythonPackages.netaddr}/lib/${python.libPrefix}/site-packages"
-      rm -f $out/bin/$(basename $f)
-      makeWrapper $f $out/bin/$(basename $f) \
-        --prefix LD_LIBRARY_PATH : $out/lib \
-        --prefix PYTHONPATH : "$pythonLibs"
+      bin=$out/bin/$(basename $f)
+      if [ ! -e $bin ]; then
+        ln -s $f $bin
+      fi
     done
+
+    sed -i -e "s!lib=.*!lib=$out/bin!" $out/bin/{java,ruby,node,python}gc
+  '';
+
+  postFixup = ''
+    wrapPythonProgramsIn "$out/share/bcc/tools" "$out $pythonPath"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch b/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch
new file mode 100644
index 00000000000..87ce618a0dd
--- /dev/null
+++ b/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch
@@ -0,0 +1,14 @@
+--- source.org/tools/deadlock_detector.py	1980-01-02 00:00:00.000000000 +0000
++++ source/tools/deadlock_detector.py	2018-05-29 13:57:11.807126673 +0100
+@@ -44,9 +44,8 @@
+ #
+ # 01-Feb-2017   Kenny Yu   Created this.
+ 
+-from __future__ import (
+-    absolute_import, division, unicode_literals, print_function
+-)
++from __future__ import absolute_import, division, unicode_literals, print_function
++
+ from bcc import BPF
+ from collections import defaultdict
+ import argparse
diff --git a/pkgs/os-specific/linux/bcc/libbcc-path.patch b/pkgs/os-specific/linux/bcc/libbcc-path.patch
new file mode 100644
index 00000000000..187bb3aadd0
--- /dev/null
+++ b/pkgs/os-specific/linux/bcc/libbcc-path.patch
@@ -0,0 +1,11 @@
+--- source.org/src/python/bcc/libbcc.py	2018-05-13 08:35:06.850522883 +0100
++++ source/src/python/bcc/libbcc.py	2018-05-13 08:36:24.602733151 +0100
+@@ -14,7 +14,7 @@
+ 
+ import ctypes as ct
+ 
+-lib = ct.CDLL("libbcc.so.0", use_errno=True)
++lib = ct.CDLL("@out@/lib/libbcc.so.0", use_errno=True)
+ 
+ # keep in sync with bpf_common.h
+ lib.bpf_module_create_b.restype = ct.c_void_p