1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-30 09:31:01 +00:00
nixpkgs/pkgs/development/libraries/libibverbs/default.nix
2016-12-05 11:44:28 +01:00

80 lines
2.3 KiB
Nix

{ stdenv, fetchurl }:
let
verbs = rec {
version = "1.1.8";
name = "libibverbs-${version}";
url = "http://downloads.openfabrics.org/verbs/${name}.tar.gz";
sha256 = "13w2j5lrrqxxxvhpxbqb70x7wy0h8g329inzgfrvqv8ykrknwxkw";
};
drivers = {
libmlx4 = rec {
version = "1.0.6";
name = "libmlx4-${version}";
url = "http://downloads.openfabrics.org/mlx4/${name}.tar.gz";
sha256 = "f680ecbb60b01ad893490c158b4ce8028a3014bb8194c2754df508d53aa848a8";
};
libmthca = rec {
version = "1.0.6";
name = "libmthca-${version}";
url = "http://downloads.openfabrics.org/mthca/${name}.tar.gz";
sha256 = "cc8ea3091135d68233d53004e82b5b510009c821820494a3624e89e0bdfc855c";
};
};
in stdenv.mkDerivation rec {
inherit (verbs) name version ;
srcs = [
( fetchurl { inherit (verbs) url sha256 ; } )
( fetchurl { inherit (drivers.libmlx4) url sha256 ; } )
( fetchurl { inherit (drivers.libmthca) url sha256 ; } )
];
sourceRoot = name;
# Install userspace drivers
postInstall = ''
for dir in ${drivers.libmlx4.name} ${drivers.libmthca.name} ; do
cd ../$dir
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$out/include"
export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS -L$out/lib"
./configure $configureFlags
make -j$NIX_BUILD_CORES
make install
done
mkdir -p $out/lib/pkgconfig
cat >$out/lib/pkgconfig/ibverbs.pc <<EOF
prefix=$out
exec_prefix=\''${prefix}
libdir=\''${exec_prefix}/lib
includedir=\''${prefix}/include
Name: IB verbs
Version: ${version}
Description: Library for direct userspace use of RDMA (InfiniBand/iWARP)
Libs: -L\''${libdir} -libverbs
Cflags: -I\''${includedir}
EOF
'';
# Re-add the libibverbs path into runpath of the library
# to enable plugins to be found by dlopen
postFixup = ''
RPATH=$(patchelf --print-rpath $out/lib/libibverbs.so)
patchelf --set-rpath $RPATH:$out/lib $out/lib/libibverbs.so.1.0.0
'';
meta = with stdenv.lib; {
homepage = https://www.openfabrics.org/;
license = licenses.bsd2;
platforms = with platforms; linux ++ freebsd;
maintainers = with maintainers; [ wkennington bzizou ];
};
}