2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2020-04-24 16:50:56 +01:00
|
|
|
, cmake, which, m4, python3, bison, flex, llvmPackages
|
|
|
|
|
|
|
|
# the default test target is sse4, but that is not supported by all Hydra agents
|
|
|
|
, testedTargets ? [ "sse2" ]
|
2016-09-04 16:03:34 +01:00
|
|
|
}:
|
2015-11-28 20:28:27 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 16:50:56 +01:00
|
|
|
pname = "ispc";
|
|
|
|
version = "1.13.0";
|
2015-11-28 20:28:27 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-04-24 16:50:56 +01:00
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1l74xkpwwxc38k2ngg7mpvswziiy91yxslgfad6688hh1n5jvayd";
|
2015-11-28 20:28:27 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 16:50:56 +01:00
|
|
|
nativeBuildInputs = [ cmake which m4 bison flex python3 ];
|
2015-11-28 20:28:27 +00:00
|
|
|
buildInputs = with llvmPackages; [
|
2020-04-24 16:50:56 +01:00
|
|
|
# we need to link against libclang, so we need the unwrapped
|
|
|
|
llvm llvmPackages.clang-unwrapped
|
2015-11-28 20:28:27 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 16:50:56 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace curses ncurses
|
|
|
|
substituteInPlace cmake/GenerateBuiltins.cmake \
|
|
|
|
--replace 'bit 32 64' 'bit 64'
|
|
|
|
'';
|
|
|
|
|
|
|
|
inherit testedTargets;
|
2015-11-28 20:28:27 +00:00
|
|
|
|
2020-04-24 16:50:56 +01:00
|
|
|
# needs 'transcendentals' executable, which is only on linux
|
|
|
|
doCheck = stdenv.isLinux;
|
|
|
|
|
|
|
|
# the compiler enforces -Werror, and -fno-strict-overflow makes it mad.
|
|
|
|
# hilariously this is something of a double negative: 'disable' the
|
|
|
|
# 'strictoverflow' hardening protection actually means we *allow* the compiler
|
|
|
|
# to do strict overflow optimization. somewhat misleading...
|
|
|
|
hardeningDisable = [ "strictoverflow" ];
|
2016-09-04 14:56:07 +01:00
|
|
|
|
2015-11-28 20:28:27 +00:00
|
|
|
checkPhase = ''
|
2019-10-09 12:17:01 +01:00
|
|
|
export ISPC_HOME=$PWD/bin
|
2016-09-04 16:03:34 +01:00
|
|
|
for target in $testedTargets
|
|
|
|
do
|
|
|
|
echo "Testing target $target"
|
|
|
|
echo "================================"
|
|
|
|
echo
|
2019-10-09 12:17:01 +01:00
|
|
|
(cd ../
|
|
|
|
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)
|
2016-09-04 16:03:34 +01:00
|
|
|
done
|
2015-11-28 20:28:27 +00:00
|
|
|
'';
|
|
|
|
|
2019-10-09 12:17:01 +01:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCLANG_EXECUTABLE=${llvmPackages.clang}/bin/clang"
|
|
|
|
"-DISPC_INCLUDE_EXAMPLES=OFF"
|
|
|
|
"-DISPC_INCLUDE_UTILS=OFF"
|
2020-04-24 16:50:56 +01:00
|
|
|
"-DARM_ENABLED=FALSE"
|
|
|
|
];
|
2015-11-28 20:28:27 +00:00
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 16:50:56 +01:00
|
|
|
homepage = "https://ispc.github.io/";
|
2015-11-28 20:28:27 +00:00
|
|
|
description = "Intel 'Single Program, Multiple Data' Compiler, a vectorised language";
|
2020-04-24 16:50:56 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ]; # TODO: buildable on more platforms?
|
|
|
|
maintainers = with maintainers; [ aristid thoughtpolice ];
|
2015-11-28 20:28:27 +00:00
|
|
|
};
|
|
|
|
}
|