2018-07-21 00:44:44 +00:00
|
|
|
{stdenv, fetchFromGitHub, fetchpatch, which, m4, python, bison, flex, llvmPackages,
|
2016-09-12 20:44:58 +00:00
|
|
|
testedTargets ? ["sse2" "host"] # the default test target is sse4, but that is not supported by all Hydra agents
|
2016-09-04 15:03:34 +00:00
|
|
|
}:
|
2015-11-28 20:28:27 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-01-15 11:25:03 +00:00
|
|
|
version = "1.9.2";
|
|
|
|
rev = "v${version}";
|
2015-11-28 20:28:27 +00:00
|
|
|
|
2016-09-04 15:03:34 +00:00
|
|
|
inherit testedTargets;
|
|
|
|
|
2015-11-28 20:28:27 +00:00
|
|
|
name = "ispc-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ispc";
|
|
|
|
repo = "ispc";
|
|
|
|
inherit rev;
|
2018-01-15 11:25:03 +00:00
|
|
|
sha256 = "0zaw7mwvly1csbdcbz9j8ry89n0r1fag1m1f579l4mgg1x6ksqry";
|
2015-11-28 20:28:27 +00:00
|
|
|
};
|
|
|
|
|
2016-09-12 20:44:58 +00:00
|
|
|
# there are missing dependencies in the Makefile, causing sporadic build failures
|
|
|
|
enableParallelBuilding = false;
|
2015-11-28 20:28:27 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
buildInputs = with llvmPackages; [
|
|
|
|
which
|
|
|
|
m4
|
|
|
|
python
|
|
|
|
bison
|
2017-07-29 17:42:44 +00:00
|
|
|
flex
|
2015-11-28 20:28:27 +00:00
|
|
|
llvm
|
2016-09-04 10:20:03 +00:00
|
|
|
llvmPackages.clang-unwrapped # we need to link against libclang, so we need the unwrapped
|
2015-11-28 20:28:27 +00:00
|
|
|
];
|
|
|
|
|
2018-07-03 22:26:59 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = https://github.com/ispc/ispc/commit/d504641f5af9d5992e7c8f0ed42c1063a39ede5b.patch;
|
|
|
|
sha256 = "192q3gyvam79469bmlwf0jpfi2y4f8hl2vgcvjngsqhvscwira0s";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2016-03-24 17:12:49 +00:00
|
|
|
postPatch = "sed -i -e 's/\\/bin\\///g' -e 's/-lcurses/-lncurses/g' Makefile";
|
2015-11-28 20:28:27 +00:00
|
|
|
|
2016-09-04 13:56:07 +00:00
|
|
|
# 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" )
|
|
|
|
#'';
|
|
|
|
|
2015-11-28 20:28:27 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp ispc $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
export ISPC_HOME=$PWD
|
2016-09-04 15:03:34 +00:00
|
|
|
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
|
2015-11-28 20:28:27 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
2017-09-10 13:43:46 +00:00
|
|
|
"CXX=${stdenv.cc}/bin/clang++"
|
|
|
|
"CLANG=${stdenv.cc}/bin/clang"
|
2015-11-28 20:28:27 +00:00
|
|
|
"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;
|
2016-09-04 13:56:07 +00:00
|
|
|
platforms = ["x86_64-linux"]; # TODO: buildable on more platforms?
|
2015-11-28 20:28:27 +00:00
|
|
|
maintainers = [ maintainers.aristid ];
|
|
|
|
};
|
|
|
|
}
|