diff --git a/pkgs/by-name/is/ispc/package.nix b/pkgs/by-name/is/ispc/package.nix index e08668ded3f6..56ccceaec1f6 100644 --- a/pkgs/by-name/is/ispc/package.nix +++ b/pkgs/by-name/is/ispc/package.nix @@ -15,6 +15,8 @@ testedTargets ? if stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32 then [ "neon-i32x4" ] + else if stdenv.hostPlatform.isRiscV64 then + [ "rvv-x4" ] else [ "sse2-i32x4" ], }: @@ -58,6 +60,11 @@ stdenv.mkDerivation (finalAttrs: { inherit testedTargets; + # run_tests.py does not know riscv64 hosts and defaults to x86 targets + patches = lib.optionals stdenv.hostPlatform.isRiscV64 [ + ./run-tests-riscv64.patch + ]; + doCheck = true; # the compiler enforces -Werror, and -fno-strict-overflow makes it mad. @@ -87,12 +94,13 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "CLANGPP_EXECUTABLE" "${llvmPackages.clang}/bin/clang++") (lib.cmakeBool "ISPC_INCLUDE_EXAMPLES" false) (lib.cmakeBool "ISPC_INCLUDE_UTILS" false) - (lib.cmakeFeature "ARM_ENABLED=" ( + (lib.cmakeFeature "ARM_ENABLED" ( if stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32 then "TRUE" else "FALSE" )) - (lib.cmakeFeature "X86_ENABLED=" ( + (lib.cmakeFeature "X86_ENABLED" ( if stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isx86_32 then "TRUE" else "FALSE" )) + (lib.cmakeFeature "RISCV_ENABLED" (if stdenv.hostPlatform.isRiscV64 then "TRUE" else "FALSE")) ]; meta = { diff --git a/pkgs/by-name/is/ispc/run-tests-riscv64.patch b/pkgs/by-name/is/ispc/run-tests-riscv64.patch new file mode 100644 index 000000000000..d00240c4ce64 --- /dev/null +++ b/pkgs/by-name/is/ispc/run-tests-riscv64.patch @@ -0,0 +1,12 @@ +--- a/scripts/run_tests.py ++++ b/scripts/run_tests.py +@@ -1368,6 +1368,9 @@ + elif platform.machine() == "ppc64le": + default_target = "generic-i32x4" + default_arch = "ppc64le" ++elif platform.machine() == "riscv64": ++ default_target = "rvv-x4" ++ default_arch = "riscv64" + elif "86" in platform.machine() or platform.machine() == "AMD64": + # Some variant of x86: x86_64, i386, i486, i586, i686 + # Windows reports platform as AMD64