2021-02-05 17:12:51 +00:00
|
|
|
|
{ lib, stdenv
|
2021-01-09 10:05:03 +00:00
|
|
|
|
, fetchFromGitHub
|
2022-12-17 10:02:37 +00:00
|
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, bison
|
|
|
|
|
, cmake
|
|
|
|
|
, jq
|
|
|
|
|
, python3
|
|
|
|
|
, spirv-headers
|
|
|
|
|
, spirv-tools
|
|
|
|
|
}:
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "glslang";
|
2023-03-04 12:14:45 +00:00
|
|
|
|
version = "1.3.239.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
|
repo = "glslang";
|
2022-01-25 03:21:06 +00:00
|
|
|
|
rev = "sdk-${version}";
|
2023-03-04 12:14:45 +00:00
|
|
|
|
hash = "sha256-P2HG/oJXdB5nvU3zVnj2vSLJGQuDcZiQBfBBvuR66Kk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# These get set at all-packages, keep onto them for child drvs
|
|
|
|
|
passthru = {
|
2022-01-25 03:21:06 +00:00
|
|
|
|
spirv-tools = spirv-tools;
|
|
|
|
|
spirv-headers = spirv-headers;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake python3 bison jq ];
|
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
|
patches = [
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
name = "Use-CMAKE_INSTALL_FULL_LIBDIR-in-compat-cmake-files.patch";
|
|
|
|
|
url = "https://github.com/KhronosGroup/glslang/commit/7627bd89583c5aafb8b38c81c15494019271fabf.patch";
|
|
|
|
|
hash = "sha256-1Dwhn78PG4gAGgEwTXpC+mkZRyvy8sTIsEvihXFeNaQ=";
|
|
|
|
|
})
|
2023-03-04 12:14:45 +00:00
|
|
|
|
# Upstream tries to detect the Darwin linker by checking for AppleClang, but it’s just Clang in nixpkgs.
|
|
|
|
|
# Revert the commit to allow the build to work on Darwin with the nixpkg Darwin Clang toolchain.
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
name = "Fix-Darwin-linker-error.patch";
|
|
|
|
|
url = "https://github.com/KhronosGroup/glslang/commit/586baa35a47b3aa6ad3fa829a27f0f4206400668.patch";
|
|
|
|
|
hash = "sha256-paAl4E8GzogcxDEzn/XuhNH6XObp+i7WfArqAiuH4Mk=";
|
|
|
|
|
revert = true;
|
|
|
|
|
})
|
2022-12-17 10:02:37 +00:00
|
|
|
|
];
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
postPatch = ''
|
2022-01-25 03:21:06 +00:00
|
|
|
|
cp --no-preserve=mode -r "${spirv-tools.src}" External/spirv-tools
|
|
|
|
|
ln -s "${spirv-headers.src}" External/spirv-tools/external/spirv-headers
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
|
# This is a dirty fix for lib/cmake/SPIRVTargets.cmake:51 which includes this directory
|
|
|
|
|
postInstall = ''
|
|
|
|
|
mkdir $out/include/External
|
|
|
|
|
'';
|
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
|
# Fix the paths in .pc, even though it's unclear if these .pc are really useful.
|
|
|
|
|
postFixup = ''
|
|
|
|
|
substituteInPlace "$out"/lib/pkgconfig/SPIRV-Tools{,-shared}.pc \
|
|
|
|
|
--replace '=''${prefix}//' '=/'
|
|
|
|
|
'';
|
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
inherit (src.meta) homepage;
|
|
|
|
|
description = "Khronos reference front-end for GLSL and ESSL";
|
|
|
|
|
license = licenses.asl20;
|
2021-01-09 10:05:03 +00:00
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
maintainers = [ maintainers.ralith ];
|
|
|
|
|
};
|
|
|
|
|
}
|