504525a148
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
58 lines
1.5 KiB
Nix
58 lines
1.5 KiB
Nix
{ lib, stdenv
|
|
, fetchFromGitHub
|
|
, bison
|
|
, cmake
|
|
, jq
|
|
, python3
|
|
, spirv-headers
|
|
, spirv-tools
|
|
}:
|
|
stdenv.mkDerivation rec {
|
|
pname = "glslang";
|
|
version = "13.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "KhronosGroup";
|
|
repo = "glslang";
|
|
rev = version;
|
|
hash = "sha256-fuzNsVYdnThMzd4tLN/sTbCBXg6qXKLDJRziOKyOBGg=";
|
|
};
|
|
|
|
# These get set at all-packages, keep onto them for child drvs
|
|
passthru = {
|
|
spirv-tools = spirv-tools;
|
|
spirv-headers = spirv-headers;
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake python3 bison jq ];
|
|
|
|
# Workaround missing atomic ops with gcc <13
|
|
env.LDFLAGS = lib.optionalString stdenv.hostPlatform.isRiscV "-latomic";
|
|
|
|
postPatch = ''
|
|
cp --no-preserve=mode -r "${spirv-tools.src}" External/spirv-tools
|
|
ln -s "${spirv-headers.src}" External/spirv-tools/external/spirv-headers
|
|
'';
|
|
|
|
# This is a dirty fix for lib/cmake/SPIRVTargets.cmake:51 which includes this directory
|
|
postInstall = ''
|
|
mkdir $out/include/External
|
|
'';
|
|
|
|
# Fix the paths in .pc, even though it's unclear if these .pc are really useful.
|
|
postFixup = ''
|
|
substituteInPlace $out/lib/pkgconfig/*.pc \
|
|
--replace '=''${prefix}//' '=/'
|
|
|
|
# add a symlink for backwards compatibility
|
|
ln -s $out/bin/glslang $out/bin/glslangValidator
|
|
'';
|
|
|
|
meta = with lib; {
|
|
inherit (src.meta) homepage;
|
|
description = "Khronos reference front-end for GLSL and ESSL";
|
|
license = licenses.asl20;
|
|
platforms = platforms.unix;
|
|
maintainers = [ maintainers.ralith ];
|
|
};
|
|
}
|