beignet: 1.1.2 -> 1.2.1

Split unit tests to a separate package.
This commit is contained in:
Nikolay Amiantov 2017-01-20 02:49:34 +03:00
parent af7a8a36df
commit 45c8c077ad
2 changed files with 64 additions and 79 deletions

View File

@ -6,111 +6,99 @@
, llvm
, libdrm
, libX11
, libXfixes
, libpthreadstubs
, libXdmcp
, libXdamage
, libXxf86vm
, python
, gl
, libXext
, python3
, ocl-icd
, mesa_noglu
, makeWrapper
, beignet
}:
stdenv.mkDerivation rec {
name = "beignet-${version}";
version = "1.1.2";
version = "1.2.1";
src = fetchurl {
url = "https://01.org/sites/default/files/${name}-source.tar.gz";
sha256 = "6a8d875afbb5e3c4fc57da1ea80f79abadd9136bfd87ab1f83c02784659f1d96";
sha256 = "07y8ga545654jdbijmplga7a7j3jn04q5gfdjsl8cax16hsv0kmp";
};
patches = [ ./clang_llvm.patch ];
enableParallelBuilding = true;
postPatch = ''
patchShebangs src/git_sha1.sh;
for f in $(find utests -type f)
do
sed -e "s@isnan(@std::isnan(@g" -i $f
sed -e "s@_std::isnan@_isnan@g" -i $f
sed -e "s@isinf(@std::isinf(@g" -i $f
sed -e "s@_std::isinf@_isinf@g" -i $f
done
patchShebangs src/git_sha1.sh
'';
configurePhase = ''
cmake . -DCMAKE_INSTALL_PREFIX=$out \
-DCLANG_LIBRARY_DIR="${clang-unwrapped}/lib" \
-DLLVM_INSTALL_DIR="${llvm}/bin" \
-DCLANG_INSTALL_DIR="${clang-unwrapped}/bin"
'';
postInstall = ''
mkdir -p $out/utests/kernels
mkdir -p $out/utests/lib
cp -r kernels $out/utests
cp src/libcl.so $out/utests/lib
cat > $out/utests/setenv.sh << EOF
#!/bin/sh
export OCL_BITCODE_LIB_PATH=$out/lib/beignet/beignet.bc
export OCL_HEADER_FILE_DIR=$out/lib/beignet/include
export OCL_PCH_PATH=$out/lib/beignet/beignet.pch
export OCL_GBE_PATH=$out/lib/beignet/libgbe.so
export OCL_INTERP_PATH=$out/lib/beignet/libgbeinterp.so
export OCL_KERNEL_PATH=$out/utests/kernels
export OCL_IGNORE_SELF_TEST=1
EOF
function fixRunPath {
p0=$(patchelf --print-rpath $1)
p1=$(echo $p0 | sed -e "s@$(pwd)/src@$out/utests/lib@g" -)
p2=$(echo $p1 | sed -e "s@$(pwd)/utests@$out/utests@g" -)
patchelf --set-rpath $p2 $1
}
fixRunPath utests/utest_run
fixRunPath utests/libutests.so
cp utests/utest_run $out/utests
cp utests/libutests.so $out/utests
mkdir -p $out/bin
ln -s $out/utests/setenv.sh $out/bin/beignet_setenv.sh
ln -s $out/utests/utest_run $out/bin/beignet_utest_run
'';
# To run the unit tests, the user must be in "video" group.
# The nix builders are members of only "nixbld" group, so
# they are able to compile the tests, but not to run them.
# To verify the installation, add yourself to "video" group,
# switch to a working directory which has both read and write
# permissions, run: nix-shell -p pkgs.beignet, and execute:
# . beignet_setenv.sh && beignet_utest_run
doCheck = false;
cmakeFlags = [ "-DCLANG_LIBRARY_DIR=${clang-unwrapped}/lib" ];
buildInputs = [
llvm
clang-unwrapped
cmake
libX11
pkgconfig
libdrm
gl
libXfixes
libXext
libpthreadstubs
libdrm
libXdmcp
libXdamage
libXxf86vm
python
ocl-icd
mesa_noglu
];
nativeBuildInputs = [
cmake
pkgconfig
python3
];
passthru.utests = stdenv.mkDerivation rec {
name = "beignet-utests-${version}";
inherit version src;
preConfigure = ''
cd utests
'';
enableParallelBuilding = true;
nativeBuildInputs = [
cmake
python3
pkgconfig
makeWrapper
];
buildInputs = [
ocl-icd
];
installPhase = ''
wrapBin() {
install -Dm755 "$1" "$out/bin/$(basename "$1")"
wrapProgram "$out/bin/$(basename "$1")" \
--set OCL_BITCODE_LIB_PATH ${beignet}/lib/beignet/beignet.bc \
--set OCL_HEADER_FILE_DIR "${beignet}/lib/beignet/include" \
--set OCL_PCH_PATH "${beignet}/lib/beignet/beignet.pch" \
--set OCL_GBE_PATH "${beignet}/lib/beignet/libgbe.so" \
--set OCL_INTERP_PATH "${beignet}/lib/beignet/libgbeinterp.so" \
--set OCL_KERNEL_PATH "$out/lib/beignet/kernels" \
--set OCL_IGNORE_SELF_TEST 1
}
install -Dm755 libutests.so $out/lib/libutests.so
wrapBin utest_run
wrapBin flat_address_space
mkdir $out/lib/beignet
cp -r ../../kernels $out/lib/beignet
'';
};
meta = with stdenv.lib; {
homepage = https://cgit.freedesktop.org/beignet/;
homepage = "https://cgit.freedesktop.org/beignet/";
description = "OpenCL Library for Intel Ivy Bridge and newer GPUs";
longDescription = ''
The package provides an open source implementation of the OpenCL specification for Intel GPUs.

View File

@ -6815,10 +6815,7 @@ in
beecrypt = callPackage ../development/libraries/beecrypt { };
beignet = callPackage ../development/libraries/beignet {
inherit (llvmPackages_37) llvm clang-unwrapped;
inherit (xorg) libX11 libXfixes libpthreadstubs libXdmcp libXdamage libXxf86vm;
inherit (python3Packages) python;
inherit (purePackages) gl;
inherit (llvmPackages) llvm clang-unwrapped;
};
belle-sip = callPackage ../development/libraries/belle-sip { };