at 18.09-beta 80 lines 2.2 kB view raw
1{stdenv, fetchFromGitHub, fetchpatch, which, m4, python, bison, flex, llvmPackages, 2testedTargets ? ["sse2" "host"] # the default test target is sse4, but that is not supported by all Hydra agents 3}: 4 5stdenv.mkDerivation rec { 6 version = "1.9.2"; 7 rev = "v${version}"; 8 9 inherit testedTargets; 10 11 name = "ispc-${version}"; 12 13 src = fetchFromGitHub { 14 owner = "ispc"; 15 repo = "ispc"; 16 inherit rev; 17 sha256 = "0zaw7mwvly1csbdcbz9j8ry89n0r1fag1m1f579l4mgg1x6ksqry"; 18 }; 19 20 # there are missing dependencies in the Makefile, causing sporadic build failures 21 enableParallelBuilding = false; 22 23 doCheck = true; 24 25 buildInputs = with llvmPackages; [ 26 which 27 m4 28 python 29 bison 30 flex 31 llvm 32 llvmPackages.clang-unwrapped # we need to link against libclang, so we need the unwrapped 33 ]; 34 35 patches = [ 36 (fetchpatch { 37 url = https://github.com/ispc/ispc/commit/d504641f5af9d5992e7c8f0ed42c1063a39ede5b.patch; 38 sha256 = "192q3gyvam79469bmlwf0jpfi2y4f8hl2vgcvjngsqhvscwira0s"; 39 }) 40 ]; 41 42 postPatch = "sed -i -e 's/\\/bin\\///g' -e 's/-lcurses/-lncurses/g' Makefile"; 43 44 # TODO: this correctly catches errors early, but also some things that are just weird and don't seem to be real 45 # errors 46 #configurePhase = '' 47 # makeFlagsArray=( SHELL="${bash}/bin/bash -o pipefail" ) 48 #''; 49 50 installPhase = '' 51 mkdir -p $out/bin 52 cp ispc $out/bin 53 ''; 54 55 checkPhase = '' 56 export ISPC_HOME=$PWD 57 for target in $testedTargets 58 do 59 echo "Testing target $target" 60 echo "================================" 61 echo 62 PATH=${llvmPackages.clang}/bin:$PATH python run_tests.py -t $target --non-interactive --verbose --file=test_output.log 63 fgrep -q "No new fails" test_output.log || exit 1 64 done 65 ''; 66 67 makeFlags = [ 68 "CXX=${stdenv.cc}/bin/clang++" 69 "CLANG=${stdenv.cc}/bin/clang" 70 "CLANG_INCLUDE=${llvmPackages.clang-unwrapped}/include" 71 ]; 72 73 meta = with stdenv.lib; { 74 homepage = https://ispc.github.io/ ; 75 description = "Intel 'Single Program, Multiple Data' Compiler, a vectorised language"; 76 license = licenses.bsd3; 77 platforms = ["x86_64-linux"]; # TODO: buildable on more platforms? 78 maintainers = [ maintainers.aristid ]; 79 }; 80}