ispc: use cmake for building.

The Makefile approach is gone in newer versions of ispc.
This commit is contained in:
Troels Henriksen 2019-10-09 13:17:01 +02:00 committed by Jon
parent 8b302e41d4
commit 170eefbbb0

View File

@ -1,4 +1,4 @@
{stdenv, fetchFromGitHub, which, m4, python, bison, flex, llvmPackages, {stdenv, fetchFromGitHub, cmake, which, m4, python, bison, flex, llvmPackages,
testedTargets ? ["sse2"] # the default test target is sse4, but that is not supported by all Hydra agents testedTargets ? ["sse2"] # the default test target is sse4, but that is not supported by all Hydra agents
}: }:
@ -17,11 +17,9 @@ stdenv.mkDerivation rec {
sha256 = "1x07n2gaff3v32yvddrb659mx5gg12bnbsqbyfimp396wn04w60b"; sha256 = "1x07n2gaff3v32yvddrb659mx5gg12bnbsqbyfimp396wn04w60b";
}; };
# there are missing dependencies in the Makefile, causing sporadic build failures
enableParallelBuilding = false;
doCheck = stdenv.isLinux; doCheck = stdenv.isLinux;
nativeBuildInputs = [ cmake ];
buildInputs = with llvmPackages; [ buildInputs = with llvmPackages; [
which which
m4 m4
@ -32,7 +30,7 @@ stdenv.mkDerivation rec {
llvmPackages.clang-unwrapped # we need to link against libclang, so we need the unwrapped 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"; postPatch = "sed -i -e 's/curses/ncurses/g' CMakeLists.txt";
# TODO: this correctly catches errors early, but also some things that are just weird and don't seem to be real # TODO: this correctly catches errors early, but also some things that are just weird and don't seem to be real
# errors # errors
@ -40,27 +38,23 @@ stdenv.mkDerivation rec {
# makeFlagsArray=( SHELL="${bash}/bin/bash -o pipefail" ) # makeFlagsArray=( SHELL="${bash}/bin/bash -o pipefail" )
#''; #'';
installPhase = ''
mkdir -p $out/bin
cp ispc $out/bin
'';
checkPhase = '' checkPhase = ''
export ISPC_HOME=$PWD export ISPC_HOME=$PWD/bin
for target in $testedTargets for target in $testedTargets
do do
echo "Testing target $target" echo "Testing target $target"
echo "================================" echo "================================"
echo echo
(cd ../
PATH=${llvmPackages.clang}/bin:$PATH python run_tests.py -t $target --non-interactive --verbose --file=test_output.log 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 fgrep -q "No new fails" test_output.log || exit 1)
done done
''; '';
makeFlags = [ cmakeFlags = [
"CXX=${stdenv.cc}/bin/clang++" "-DCLANG_EXECUTABLE=${llvmPackages.clang}/bin/clang"
"CLANG=${stdenv.cc}/bin/clang" "-DISPC_INCLUDE_EXAMPLES=OFF"
"CLANG_INCLUDE=${llvmPackages.clang-unwrapped}/include" "-DISPC_INCLUDE_UTILS=OFF"
]; ];
meta = with stdenv.lib; { meta = with stdenv.lib; {