From 04cdb56ec932c2e6b500fec40d0e5c6c91c19e40 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 10 Mar 2023 20:48:56 +0000 Subject: [PATCH] geekbench4: use autoPatchelfHook and do not hardcode CUDA lib --- pkgs/tools/misc/geekbench/4.nix | 34 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/pkgs/tools/misc/geekbench/4.nix b/pkgs/tools/misc/geekbench/4.nix index d7b6152e0785..83ac15a37c70 100644 --- a/pkgs/tools/misc/geekbench/4.nix +++ b/pkgs/tools/misc/geekbench/4.nix @@ -1,4 +1,12 @@ -{ lib, stdenv, fetchurl, makeWrapper, ocl-icd, vulkan-loader, linuxPackages }: +{ lib +, stdenv +, fetchurl +, autoPatchelfHook +, addOpenGLRunpath +, makeWrapper +, ocl-icd +, vulkan-loader +}: stdenv.mkDerivation rec { pname = "geekbench"; @@ -12,23 +20,25 @@ stdenv.mkDerivation rec { dontConfigure = true; dontBuild = true; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; + buildInputs = [ stdenv.cc.cc ]; installPhase = '' - mkdir -p $out/bin $out/lib + runHook preInstall + + mkdir -p $out/bin cp -r geekbench.plar geekbench4 geekbench_x86_64 $out/bin - # needed for compute benchmark - ln -s ${linuxPackages.nvidia_x11}/lib/libcuda.so $out/lib/ - ln -s ${ocl-icd}/lib/libOpenCL.so $out/lib/ - ln -s ${ocl-icd}/lib/libOpenCL.so.1 $out/lib/ - ln -s ${vulkan-loader}/lib/libvulkan.so $out/lib/ - ln -s ${vulkan-loader}/lib/libvulkan.so.1 $out/lib/ - for f in geekbench4 geekbench_x86_64 ; do - patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) $out/bin/$f - wrapProgram $out/bin/$f --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$out/lib/" + wrapProgram $out/bin/$f \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ + addOpenGLRunpath.driverLink + ocl-icd + vulkan-loader + ]}" done + + runHook postInstall ''; meta = with lib; {