nixpkgs/pkgs/development/compilers/ispc/default.nix
Troels Henriksen 12f03a0776 ispc: do not test on the "host" target
This is because some very sensitive tests may fail when using more
exotic platforms and vector instructions.  For example, floating point
summation (which is not associative in the first place), or
transcendental functions.  Arguably, ispc's test suite is too
sensitive here.
2019-10-02 19:43:20 +02:00

74 lines
1.9 KiB
Nix

{stdenv, fetchFromGitHub, which, m4, python, bison, flex, llvmPackages,
testedTargets ? ["sse2"] # the default test target is sse4, but that is not supported by all Hydra agents
}:
stdenv.mkDerivation rec {
version = "1.10.0";
rev = "v${version}";
inherit testedTargets;
pname = "ispc";
src = fetchFromGitHub {
owner = "ispc";
repo = "ispc";
inherit rev;
sha256 = "1x07n2gaff3v32yvddrb659mx5gg12bnbsqbyfimp396wn04w60b";
};
# there are missing dependencies in the Makefile, causing sporadic build failures
enableParallelBuilding = false;
doCheck = true;
buildInputs = with llvmPackages; [
which
m4
python
bison
flex
llvm
llvmPackages.clang-unwrapped # we need to link against libclang, so we need the unwrapped
];
postPatch = "sed -i -e 's,/bin/,,g' -e 's/-lcurses/-lncurses/g' Makefile";
# TODO: this correctly catches errors early, but also some things that are just weird and don't seem to be real
# errors
#configurePhase = ''
# makeFlagsArray=( SHELL="${bash}/bin/bash -o pipefail" )
#'';
installPhase = ''
mkdir -p $out/bin
cp ispc $out/bin
'';
checkPhase = ''
export ISPC_HOME=$PWD
for target in $testedTargets
do
echo "Testing target $target"
echo "================================"
echo
PATH=${llvmPackages.clang}/bin:$PATH python run_tests.py -t $target --non-interactive --verbose --file=test_output.log
fgrep -q "No new fails" test_output.log || exit 1
done
'';
makeFlags = [
"CXX=${stdenv.cc}/bin/clang++"
"CLANG=${stdenv.cc}/bin/clang"
"CLANG_INCLUDE=${llvmPackages.clang-unwrapped}/include"
];
meta = with stdenv.lib; {
homepage = https://ispc.github.io/ ;
description = "Intel 'Single Program, Multiple Data' Compiler, a vectorised language";
license = licenses.bsd3;
platforms = ["x86_64-linux"]; # TODO: buildable on more platforms?
maintainers = [ maintainers.aristid ];
};
}