ispc: unbreak on darwin (#458797)

This commit is contained in:
Alexandre Esteves
2025-11-11 12:17:37 +00:00
committed by GitHub
+39 -36
View File
@@ -19,15 +19,15 @@
[ "sse2-i32x4" ],
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "ispc";
version = "1.28.2";
src = fetchFromGitHub {
owner = "ispc";
repo = "ispc";
rev = "v${version}";
sha256 = "sha256-dmpOvJ5dVhjGKpJ9xw/lXbvk2FgLv2vjzmUExUfLRmo=";
tag = "v${finalAttrs.version}";
hash = "sha256-dmpOvJ5dVhjGKpJ9xw/lXbvk2FgLv2vjzmUExUfLRmo=";
};
nativeBuildInputs = [
@@ -48,12 +48,21 @@ stdenv.mkDerivation rec {
ncurses
];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace CURSES_CURSES_LIBRARY CURSES_NCURSES_LIBRARY
substituteInPlace cmake/GenerateBuiltins.cmake \
--replace 'bit 32 64' 'bit 64'
'';
postPatch =
# Workaround for LLVM version mismatch: the build uses libcxx 19 (from darwin
# stdenv), while LLVM 21 is provided as a runtime dependency.
lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/util.cpp \
--replace-fail "#ifdef _LIBCPP_VERSION" "#if FALSE"
''
# These tests fail on x86_64-darwin, see ispc/ispc#{3529, 3623}
+ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
substituteInPlace tests/func-tests/round-float16-uniform.ispc \
--replace-fail "// See issue #3529" "// rule: skip on OS=mac"
substituteInPlace tests/func-tests/round-float16-varying.ispc \
--replace-fail "// See issue #3529" "// rule: skip on OS=mac"
'';
inherit testedTargets;
@@ -79,39 +88,33 @@ stdenv.mkDerivation rec {
'';
cmakeFlags = [
"-DFILE_CHECK_EXECUTABLE=${llvmPackages.llvm}/bin/FileCheck"
"-DLLVM_AS_EXECUTABLE=${llvmPackages.llvm}/bin/llvm-as"
"-DLLVM_CONFIG_EXECUTABLE=${llvmPackages.llvm.dev}/bin/llvm-config"
"-DCLANG_EXECUTABLE=${llvmPackages.clang}/bin/clang"
"-DCLANGPP_EXECUTABLE=${llvmPackages.clang}/bin/clang++"
"-DISPC_INCLUDE_EXAMPLES=OFF"
"-DISPC_INCLUDE_UTILS=OFF"
(
"-DARM_ENABLED="
+ (if stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32 then "TRUE" else "FALSE")
)
(
"-DX86_ENABLED="
+ (if stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isx86_32 then "TRUE" else "FALSE")
)
(lib.cmakeFeature "FILE_CHECK_EXECUTABLE" "${llvmPackages.llvm}/bin/FileCheck")
(lib.cmakeFeature "LLVM_AS_EXECUTABLE" "${llvmPackages.llvm}/bin/llvm-as")
(lib.cmakeFeature "LLVM_CONFIG_EXECUTABLE" "${llvmPackages.llvm.dev}/bin/llvm-config")
(lib.cmakeFeature "CLANG_EXECUTABLE" "${llvmPackages.clang}/bin/clang")
(lib.cmakeFeature "CLANGPP_EXECUTABLE" "${llvmPackages.clang}/bin/clang++")
(lib.cmakeBool "ISPC_INCLUDE_EXAMPLES" false)
(lib.cmakeBool "ISPC_INCLUDE_UTILS" false)
(lib.cmakeFeature "ARM_ENABLED=" (
if stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32 then "TRUE" else "FALSE"
))
(lib.cmakeFeature "X86_ENABLED=" (
if stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isx86_32 then "TRUE" else "FALSE"
))
];
meta = with lib; {
homepage = "https://ispc.github.io/";
meta = {
description = "Intel 'Single Program, Multiple Data' Compiler, a vectorised language";
mainProgram = "ispc";
license = licenses.bsd3;
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
]; # TODO: buildable on more platforms?
maintainers = with maintainers; [
homepage = "https://ispc.github.io/";
changelog = "https://github.com/ispc/ispc/releases/tag/${finalAttrs.version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
aristid
thoughtpolice
athas
alexfmpe
];
mainProgram = "ispc";
platforms = with lib.platforms; linux ++ darwin; # TODO: buildable on more platforms?
};
}
})