Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions pkgs/by-name/sh/shaderc/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
lib,
stdenv,
fetchFromGitHub,
replaceVars,
versionCheckHook,
cmake,
python3,
darwin,
cctools,
glslang,
spirv-tools,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "shaderc";
version = "2025.5";

outputs = [
"out"
"lib"
"bin"
"dev"
"static"
];

src = fetchFromGitHub {
owner = "google";
repo = "shaderc";
rev = "v${finalAttrs.version}";
hash = "sha256-PmGRZDXblrBhZe16QfpHfRdsRhXnGsN7o+qh14nlOUQ=";
};

patches = [
(replaceVars ./unvendor-glslang.patch {
shaderc-version = finalAttrs.version;
spirv-tools-version = spirv-tools.version;
glslang-version = glslang.version;
})
];

postPatch = ''
patchShebangs --build utils/

substituteInPlace cmake/*.pc.in \
--replace-fail $'{prefix}/@CMAKE_INSTALL_' '@CMAKE_INSTALL_FULL_'
'';

nativeBuildInputs = [
cmake
python3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ cctools ]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
darwin.autoSignDarwinBinariesHook
];

propagatedBuildInputs = [
glslang
];

postInstall = ''
moveToOutput "lib/*.a" $static
'';

cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" ];

nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "--version";
doInstallCheck = true;

meta = {
description = "Collection of tools, libraries and tests for shader compilation";
inherit (finalAttrs.src.meta) homepage;
license = lib.licenses.asl20;
platforms = lib.platforms.all;
mainProgram = "glslc";
};
})
49 changes: 49 additions & 0 deletions pkgs/by-name/sh/shaderc/unvendor-glslang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06f5395..a23a573 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,7 +130,9 @@ endif(MSVC)

# Configure subdirectories.
# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
+find_package(glslang REQUIRED CONFIG)
+get_target_property(glslang_includes glslang::glslang INTERFACE_INCLUDE_DIRECTORIES)
+set(glslang_SOURCE_DIR "${glslang_includes}/glslang")

add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
@@ -142,7 +144,7 @@ endif()
add_custom_target(build-version
${Python_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc
+ dummy dummy dummy ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc
COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")

function(define_pkg_config_file NAME LIBS)
diff --git a/utils/update_build_version.py b/utils/update_build_version.py
index b7ce5b8..fcb0432 100755
--- a/utils/update_build_version.py
+++ b/utils/update_build_version.py
@@ -120,11 +120,15 @@ def get_version_string(project, directory):
"""Returns a detailed version string for a given project with its
directory, which consists of software version string and git description
string."""
- detailed_version_string_lst = [project]
- if project != 'glslang':
- detailed_version_string_lst.append(deduce_software_version(directory))
- detailed_version_string_lst.append(describe(directory).replace('"', '\\"'))
- return ' '.join(detailed_version_string_lst)
+ match project:
+ case "shaderc":
+ return "shaderc v@shaderc-version@"
+ case "spirv-tools":
+ return "spirv-tools v@spirv-tools-version@"
+ case "glslang":
+ return "glslang v@glslang-version@"
+ case _:
+ sys.exit(1)


def main():
93 changes: 0 additions & 93 deletions pkgs/development/compilers/shaderc/default.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10187,10 +10187,6 @@ with pkgs;
protobuf = protobuf_21; # https://github.com/blueprint-freespeech/ricochet-refresh/issues/178
};

shaderc = callPackage ../development/compilers/shaderc {
inherit (darwin) autoSignDarwinBinariesHook;
};

scheherazade-new = scheherazade.override {
version = "4.400";
};
Expand Down
Loading