nixpkgs/pkgs/development/libraries/amdvlk/default.nix
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00

95 lines
2.0 KiB
Nix

{ stdenv
, lib
, fetchRepoProject
, cmake
, ninja
, patchelf
, perl
, pkg-config
, python3
, expat
, libdrm
, ncurses
, openssl
, wayland
, xorg
, zlib
}:
let
suffix = if stdenv.system == "x86_64-linux" then "64" else "32";
in stdenv.mkDerivation rec {
pname = "amdvlk";
version = "2020.Q4.6";
src = fetchRepoProject {
name = "${pname}-src";
manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git";
rev = "refs/tags/v-${version}";
sha256 = "wminJxfku8Myag+SI7iLSvS+VzHlUd4c86BbpF/cr1w=";
};
buildInputs = [
expat
ncurses
openssl
wayland
xorg.libX11
xorg.libxcb
xorg.xcbproto
xorg.libXext
xorg.libXrandr
xorg.libXft
xorg.libxshmfence
zlib
];
nativeBuildInputs = [
cmake
ninja
patchelf
perl
pkg-config
python3
];
rpath = lib.makeLibraryPath [
libdrm
openssl
stdenv.cc.cc.lib
xorg.libX11
xorg.libxcb
xorg.libxshmfence
];
cmakeDir = "../drivers/xgl";
# LTO is disabled in gcc for i686 as of #66528
cmakeFlags = stdenv.lib.optionals stdenv.is32bit ["-DXGL_ENABLE_LTO=OFF"];
installPhase = ''
install -Dm755 -t $out/lib icd/amdvlk${suffix}.so
install -Dm644 -t $out/share/vulkan/icd.d ../drivers/AMDVLK/json/Redhat/amd_icd${suffix}.json
substituteInPlace $out/share/vulkan/icd.d/amd_icd${suffix}.json --replace \
"/usr/lib64" "$out/lib"
substituteInPlace $out/share/vulkan/icd.d/amd_icd${suffix}.json --replace \
"/usr/lib" "$out/lib"
patchelf --set-rpath "$rpath" $out/lib/amdvlk${suffix}.so
'';
# Keep the rpath, otherwise vulkaninfo and vkcube segfault
dontPatchELF = true;
meta = with stdenv.lib; {
description = "AMD Open Source Driver For Vulkan";
homepage = "https://github.com/GPUOpen-Drivers/AMDVLK";
changelog = "https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-${version}";
license = licenses.mit;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = with maintainers; [ danieldk Flakebi ];
};
}