Files
nixpkgs/pkgs/by-name/sp/spirv-tools/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

64 lines
2.2 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
python3,
spirv-headers,
}:
stdenv.mkDerivation {
pname = "spirv-tools";
version = "1.4.321.0-unstable-2025-06-25";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
# The SPIRV-Headers release for Vulkan SDK 1.4.321.0 is missing
# a PR required for LLVM 21 support in SPIRV-LLVM-Translator;
# return to the `vulkan-sdk-*` tags on the next stable release.
rev = "28a883ba4c67f58a9540fb0651c647bb02883622";
hash = "sha256-yRzpEBGyTr9oovsh3TUnJsR/luHNAPkotcJFWh7R1Fc=";
};
# The cmake options are sufficient for turning on static building, but not
# for disabling shared building, just trim the shared lib from the CMake
# description
patches = lib.optional stdenv.hostPlatform.isStatic ./no-shared-libs.patch;
nativeBuildInputs = [
cmake
python3
];
cmakeFlags = [
"-DSPIRV-Headers_SOURCE_DIR=${spirv-headers.src}"
# Avoid blanket -Werror to evade build failures on less
# tested compilers.
"-DSPIRV_WERROR=OFF"
];
# https://github.com/KhronosGroup/SPIRV-Tools/issues/3905
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail '-P ''${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake' \
'-DCMAKE_INSTALL_FULL_LIBDIR=''${CMAKE_INSTALL_FULL_LIBDIR}
-DCMAKE_INSTALL_FULL_INCLUDEDIR=''${CMAKE_INSTALL_FULL_INCLUDEDIR}
-P ''${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake'
substituteInPlace cmake/SPIRV-Tools.pc.in \
--replace-fail '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace-fail '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
substituteInPlace cmake/SPIRV-Tools-shared.pc.in \
--replace-fail '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace-fail '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
'';
meta = with lib; {
description = "SPIR-V Tools project provides an API and commands for processing SPIR-V modules";
homepage = "https://github.com/KhronosGroup/SPIRV-Tools";
license = licenses.asl20;
platforms = with platforms; unix ++ windows;
maintainers = [ maintainers.ralith ];
};
}