Merge pull request #220554 from thiagokokada/geekbench-refactor

geekbench{4,5}: use autoPatchelfHook and do not hardcode CUDA lib,  geekbench6: init at 6.0.1
This commit is contained in:
Thiago Kenji Okada 2023-03-11 10:36:05 +00:00 committed by GitHub
commit fff9f6b1f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 133 additions and 57 deletions

View file

@ -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; {
@ -38,5 +48,6 @@ stdenv.mkDerivation rec {
license = licenses.unfree;
maintainers = [ maintainers.michalrus ];
platforms = [ "x86_64-linux" ];
mainProgram = "geekbench4";
};
}

View file

@ -0,0 +1,52 @@
{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, addOpenGLRunpath
, makeWrapper
, ocl-icd
, vulkan-loader
}:
stdenv.mkDerivation rec {
pname = "geekbench";
version = "5.5.1";
src = fetchurl {
url = "https://cdn.geekbench.com/Geekbench-${version}-Linux.tar.gz";
sha256 = "sha256-MgN+VcPcjzYP4Wt/uxiNMTh+p1mA5I2M8CgzDjI5xAQ=";
};
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r geekbench.plar geekbench5 geekbench_x86_64 $out/bin
for f in geekbench5 geekbench_x86_64 ; do
wrapProgram $out/bin/$f \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
addOpenGLRunpath.driverLink
ocl-icd
vulkan-loader
]}"
done
runHook postInstall
'';
meta = with lib; {
description = "Cross-platform benchmark";
homepage = "https://geekbench.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = [ maintainers.michalrus ];
platforms = [ "x86_64-linux" ];
mainProgram = "geekbench5";
};
}

View file

@ -0,0 +1,52 @@
{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, addOpenGLRunpath
, makeWrapper
, ocl-icd
, vulkan-loader
}:
stdenv.mkDerivation rec {
pname = "geekbench";
version = "6.0.1";
src = fetchurl {
url = "https://cdn.geekbench.com/Geekbench-${version}-Linux.tar.gz";
hash = "sha256-RrfyB7RvYWkVCbjblLIPOFcZjUR/fJHk1Em1HP74kmY=";
};
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r geekbench.plar geekbench-workload.plar geekbench6 geekbench_x86_64 geekbench_avx2 $out/bin
for f in geekbench6 geekbench_x86_64 geekbench_avx2 ; do
wrapProgram $out/bin/$f \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
addOpenGLRunpath.driverLink
ocl-icd
vulkan-loader
]}"
done
runHook postInstall
'';
meta = with lib; {
description = "Cross-platform benchmark";
homepage = "https://geekbench.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = [ maintainers.michalrus ];
platforms = [ "x86_64-linux" ];
mainProgram = "geekbench6";
};
}

View file

@ -1,42 +0,0 @@
{ lib, stdenv, fetchurl, makeWrapper, ocl-icd, vulkan-loader, linuxPackages }:
stdenv.mkDerivation rec {
pname = "geekbench";
version = "5.4.6";
src = fetchurl {
url = "https://cdn.geekbench.com/Geekbench-${version}-Linux.tar.gz";
sha256 = "sha256-fCS6cSD3w2EbLL1yNfH+NKxswRUY4zyCR07gKGXW4Yc=";
};
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin $out/lib
cp -r geekbench.plar geekbench5 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 geekbench5 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/"
done
'';
meta = with lib; {
description = "Cross-platform benchmark";
homepage = "https://geekbench.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = [ maintainers.michalrus ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -511,6 +511,8 @@ mapAliases ({
gdal_1_11 = throw "gdal_1_11 was removed. Use gdal instead"; # Added 2021-04-03
gdb-multitarget = throw "'gdb-multitarget' has been renamed to/replaced by 'gdb'"; # Converted to throw 2022-02-22
gdk_pixbuf = throw "'gdk_pixbuf' has been renamed to/replaced by 'gdk-pixbuf'"; # Converted to throw 2022-02-22
geekbench4 = throw "'geekbench4' has been renamed to 'geekbench_4'"; # Added 2023-03-10
geekbench5 = throw "'geekbench5' has been renamed to 'geekbench_5'"; # Added 2023-03-10
getmail = throw "getmail has been removed from nixpkgs, migrate to getmail6"; # Added 2022-01-12
gettextWithExpat = throw "'gettextWithExpat' has been renamed to/replaced by 'gettext'"; # Converted to throw 2022-02-22
gfm = throw "gfm has been removed"; # Added 2021-01-15

View file

@ -4839,9 +4839,10 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Security;
};
geekbench4 = callPackage ../tools/misc/geekbench/4.nix { };
geekbench5 = callPackage ../tools/misc/geekbench { };
geekbench = geekbench5;
geekbench_4 = callPackage ../tools/misc/geekbench/4.nix { };
geekbench_5 = callPackage ../tools/misc/geekbench/5.nix { };
geekbench_6 = callPackage ../tools/misc/geekbench/6.nix { };
geekbench = geekbench_6;
gencfsm = callPackage ../tools/security/gencfsm { };