Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.05 72 lines 2.6 kB view raw
1{ lib, stdenv, fetchFromGitHub, fetchpatch 2, cmake, which, m4, python3, bison, flex, llvmPackages, ncurses 3 4 # the default test target is sse4, but that is not supported by all Hydra agents 5, testedTargets ? if stdenv.isAarch64 || stdenv.isAarch32 then [ "neon-i32x4" ] else [ "sse2-i32x4" ] 6}: 7 8stdenv.mkDerivation rec { 9 pname = "ispc"; 10 version = "1.18.1"; 11 12 src = fetchFromGitHub { 13 owner = pname; 14 repo = pname; 15 rev = "v${version}"; 16 sha256 = "sha256-WBAVgjQjW4x9JGx6xotPoTVOePsPjBJEyBYA7TCTBvc="; 17 }; 18 19 nativeBuildInputs = [ cmake which m4 bison flex python3 llvmPackages.libllvm.dev ]; 20 buildInputs = with llvmPackages; [ 21 libllvm libclang openmp ncurses 22 ]; 23 24 postPatch = '' 25 substituteInPlace CMakeLists.txt \ 26 --replace CURSES_CURSES_LIBRARY CURSES_NCURSES_LIBRARY 27 substituteInPlace cmake/GenerateBuiltins.cmake \ 28 --replace 'bit 32 64' 'bit 64' 29 ''; 30 31 inherit testedTargets; 32 33 # needs 'transcendentals' executable, which is only on linux 34 doCheck = stdenv.isLinux; 35 36 # the compiler enforces -Werror, and -fno-strict-overflow makes it mad. 37 # hilariously this is something of a double negative: 'disable' the 38 # 'strictoverflow' hardening protection actually means we *allow* the compiler 39 # to do strict overflow optimization. somewhat misleading... 40 hardeningDisable = [ "strictoverflow" ]; 41 42 checkPhase = '' 43 export ISPC_HOME=$PWD/bin 44 for target in $testedTargets 45 do 46 echo "Testing target $target" 47 echo "================================" 48 echo 49 (cd ../ 50 PATH=${llvmPackages.clang}/bin:$PATH python run_tests.py -t $target --non-interactive --verbose --file=test_output.log 51 fgrep -q "No new fails" test_output.log || exit 1) 52 done 53 ''; 54 55 cmakeFlags = [ 56 "-DLLVM_CONFIG_EXECUTABLE=${llvmPackages.llvm.dev}/bin/llvm-config" 57 "-DCLANG_EXECUTABLE=${llvmPackages.clang}/bin/clang" 58 "-DCLANGPP_EXECUTABLE=${llvmPackages.clang}/bin/clang++" 59 "-DISPC_INCLUDE_EXAMPLES=OFF" 60 "-DISPC_INCLUDE_UTILS=OFF" 61 ("-DARM_ENABLED=" + (if stdenv.isAarch64 || stdenv.isAarch32 then "TRUE" else "FALSE")) 62 ("-DX86_ENABLED=" + (if stdenv.isx86_64 || stdenv.isx86_32 then "TRUE" else "FALSE")) 63 ]; 64 65 meta = with lib; { 66 homepage = "https://ispc.github.io/"; 67 description = "Intel 'Single Program, Multiple Data' Compiler, a vectorised language"; 68 license = licenses.bsd3; 69 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; # TODO: buildable on more platforms? 70 maintainers = with maintainers; [ aristid thoughtpolice athas ]; 71 }; 72}