nixpkgs/pkgs/development/tools/spirv-tools/default.nix
K900 2c8f7f3911 spirv-tools: 1.3.243.0 -> 2023.2, remove spirv-headers version check
Upstream versioning isn't consistent in the first place.
2023-05-01 15:10:06 +03:00

46 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, python3, spirv-headers }:
stdenv.mkDerivation rec {
pname = "spirv-tools";
version = "2023.2";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
rev = "v${version}";
hash = "sha256-l44Ru0WjROQEDNU/2YQJGti1uDZP9osRdfsXus5EGX0=";
};
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 '-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 '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
substituteInPlace cmake/SPIRV-Tools-shared.pc.in \
--replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
'';
meta = with lib; {
description = "The 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 = platforms.unix;
maintainers = [ maintainers.ralith ];
};
}