shaderc: refactor

This commit is contained in:
DontEatOreo
2025-04-29 19:38:06 +03:00
committed by Masum Reza
parent cd11f730ea
commit 720370cb40

View File

@@ -7,11 +7,13 @@
autoSignDarwinBinariesHook,
cctools,
}:
# Like many google projects, shaderc doesn't gracefully support separately compiled dependencies, so we can't easily use
# the versions of glslang and spirv-tools used by vulkan-loader. Exact revisions are taken from
# Like many google projects, shaderc doesn't gracefully support separately
# compiled dependencies, so we can't easily use the versions of glslang and
# spirv-tools used by vulkan-loader. Exact revisions are taken from
# https://github.com/google/shaderc/blob/known-good/known_good.json
# Future work: extract and fetch all revisions automatically based on a revision of shaderc's known-good branch.
# Future work: extract and fetch all revisions automatically based on a revision
# of shaderc's known-good branch.
let
glslang = fetchFromGitHub {
owner = "KhronosGroup";
@@ -32,7 +34,7 @@ let
hash = "sha256-Q1i6i5XimULuGufP6mimwDW674anAETUiIEvDQwvg5Y=";
};
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "shaderc";
version = "2025.2";
@@ -47,7 +49,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "google";
repo = "shaderc";
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-u3gmH2lrkwBTZg9j4jInQceXK4MUWhKZPSPsN98mEkk=";
};
@@ -77,14 +79,14 @@ stdenv.mkDerivation rec {
# Fix the paths in .pc, even though it's unclear if all these .pc are really useful.
postFixup = ''
substituteInPlace "$dev"/lib/pkgconfig/*.pc \
--replace '=''${prefix}//' '=/' \
--replace "$dev/$dev/" "$dev/"
--replace-fail '=''${prefix}//' '=/' \
--replace-fail "$dev/$dev/" "$dev/"
'';
meta = with lib; {
inherit (src.meta) homepage;
meta = {
description = "Collection of tools, libraries and tests for shader compilation";
platforms = platforms.all;
license = [ licenses.asl20 ];
inherit (finalAttrs.src.meta) homepage;
license = lib.licenses.asl20;
platforms = lib.platforms.all;
};
}
})