mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
78 lines
1.9 KiB
Nix
78 lines
1.9 KiB
Nix
{ lib
|
||
, stdenv
|
||
, fetchFromGitLab
|
||
, meson
|
||
, ninja
|
||
, pkg-config
|
||
, python3Packages
|
||
, vulkan-headers
|
||
, vulkan-loader
|
||
, shaderc
|
||
, lcms2
|
||
, libGL
|
||
, libX11
|
||
, libunwind
|
||
, libdovi
|
||
}:
|
||
|
||
stdenv.mkDerivation rec {
|
||
pname = "libplacebo";
|
||
version = "5.264.1";
|
||
|
||
src = fetchFromGitLab {
|
||
domain = "code.videolan.org";
|
||
owner = "videolan";
|
||
repo = pname;
|
||
rev = "v${version}";
|
||
hash = "sha256-YEefuEfJURi5/wswQKskA/J1UGzessQQkBpltJ0Spq8=";
|
||
};
|
||
|
||
nativeBuildInputs = [
|
||
meson
|
||
ninja
|
||
pkg-config
|
||
vulkan-headers
|
||
python3Packages.jinja2
|
||
python3Packages.glad2
|
||
];
|
||
|
||
buildInputs = [
|
||
vulkan-loader
|
||
shaderc
|
||
lcms2
|
||
libGL
|
||
libX11
|
||
libunwind
|
||
libdovi
|
||
];
|
||
|
||
mesonFlags = [
|
||
(lib.mesonOption "vulkan-registry" "${vulkan-headers}/share/vulkan/registry/vk.xml")
|
||
(lib.mesonBool "demos" false) # Don't build and install the demo programs
|
||
(lib.mesonEnable "d3d11" false) # Disable the Direct3D 11 based renderer
|
||
(lib.mesonEnable "glslang" false) # rely on shaderc for GLSL compilation instead
|
||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||
(lib.mesonEnable "unwind" false) # libplacebo doesn’t build with `darwin.libunwind`
|
||
];
|
||
|
||
postPatch = ''
|
||
substituteInPlace meson.build \
|
||
--replace 'python_env.append' '#'
|
||
'';
|
||
|
||
meta = with lib; {
|
||
description = "Reusable library for GPU-accelerated video/image rendering primitives";
|
||
longDescription = ''
|
||
Reusable library for GPU-accelerated image/view processing primitives and
|
||
shaders, as well a batteries-included, extensible, high-quality rendering
|
||
pipeline (similar to mpv's vo_gpu). Supports Vulkan, OpenGL and Metal (via
|
||
MoltenVK).
|
||
'';
|
||
homepage = "https://code.videolan.org/videolan/libplacebo";
|
||
changelog = "https://code.videolan.org/videolan/libplacebo/-/tags/v${version}";
|
||
license = licenses.lgpl21Plus;
|
||
maintainers = with maintainers; [ primeos ];
|
||
platforms = platforms.all;
|
||
};
|
||
}
|