about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/amdvlk
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-10 07:13:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-12 14:07:16 +0000
commite2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch)
tree79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/development/libraries/amdvlk
parent1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff)
parent84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff)
downloadnixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/amdvlk')
-rw-r--r--nixpkgs/pkgs/development/libraries/amdvlk/default.nix99
1 files changed, 99 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/amdvlk/default.nix b/nixpkgs/pkgs/development/libraries/amdvlk/default.nix
new file mode 100644
index 000000000000..1f75892b9ac8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/amdvlk/default.nix
@@ -0,0 +1,99 @@
+{ stdenv
+, lib
+, fetchRepoProject
+, cmake
+, ninja
+, patchelf
+, perl
+, pkgconfig
+, 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.Q3.5";
+
+  src = fetchRepoProject {
+    name = "${pname}-src";
+    manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git";
+    rev = "refs/tags/v-${version}";
+    sha256 = "08fj3cg3axnwadlpfim23g5nyjl69044fqxdr57af6y79441njay";
+  };
+
+  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
+    pkgconfig
+    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"];
+
+  postPatch = stdenv.lib.optionalString stdenv.is32bit ''
+    substituteInPlace drivers/pal/cmake/PalCompilerOptions.cmake \
+      --replace "pal_setup_gcc_ipo()" ""
+  '';
+
+  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 ];
+  };
+}