2016-10-23 21:35:51 +01:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
|
|
|
|
# Build-time dependencies
|
|
|
|
, makeWrapper
|
|
|
|
, file
|
|
|
|
|
|
|
|
# Runtime dependencies
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, libX11
|
|
|
|
, libXext
|
|
|
|
, libXinerama
|
|
|
|
, libXrandr
|
|
|
|
, libXrender
|
2019-04-19 20:34:20 +01:00
|
|
|
, libGL
|
2016-10-23 21:35:51 +01:00
|
|
|
, openal}:
|
|
|
|
|
|
|
|
let
|
|
|
|
version = "1.0";
|
|
|
|
|
2018-08-20 20:11:29 +01:00
|
|
|
arch = if stdenv.hostPlatform.system == "x86_64-linux" then
|
2016-10-23 21:35:51 +01:00
|
|
|
"x64"
|
2018-08-20 20:11:29 +01:00
|
|
|
else if stdenv.hostPlatform.system == "i686-linux" then
|
2016-10-23 21:35:51 +01:00
|
|
|
"x86"
|
|
|
|
else
|
2018-08-20 20:11:29 +01:00
|
|
|
throw "Unsupported platform ${stdenv.hostPlatform.system}";
|
2016-10-23 21:35:51 +01:00
|
|
|
|
|
|
|
in
|
2016-12-16 10:22:24 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "unigine-valley";
|
|
|
|
inherit version;
|
2016-10-23 21:35:51 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://assets.unigine.com/d/Unigine_Valley-${version}.run";
|
|
|
|
sha256 = "5f0c8bd2431118551182babbf5f1c20fb14e7a40789697240dcaf546443660f4";
|
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = "Unigine_Valley-${version}";
|
2016-12-16 10:22:24 +00:00
|
|
|
instPath = "lib/unigine/valley";
|
2016-10-23 21:35:51 +01:00
|
|
|
|
|
|
|
buildInputs = [file makeWrapper];
|
|
|
|
|
|
|
|
libPath = stdenv.lib.makeLibraryPath [
|
|
|
|
stdenv.cc.cc # libstdc++.so.6
|
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXinerama
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
2019-04-19 20:34:20 +01:00
|
|
|
libGL
|
2016-10-23 21:35:51 +01:00
|
|
|
openal
|
|
|
|
];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
2017-06-05 19:08:07 +01:00
|
|
|
runHook preUnpack
|
|
|
|
|
2016-10-23 21:35:51 +01:00
|
|
|
cp $src extractor.run
|
|
|
|
chmod +x extractor.run
|
|
|
|
./extractor.run --target $sourceRoot
|
2017-06-05 19:08:07 +01:00
|
|
|
|
|
|
|
runHook postUnpack
|
2016-10-23 21:35:51 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
patchPhase = ''
|
2017-06-05 19:08:07 +01:00
|
|
|
runHook prePatch
|
|
|
|
|
2016-10-23 21:35:51 +01:00
|
|
|
# Patch ELF files.
|
|
|
|
elfs=$(find bin -type f | xargs file | grep ELF | cut -d ':' -f 1)
|
|
|
|
for elf in $elfs; do
|
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 $elf || true
|
|
|
|
done
|
2017-06-05 19:08:07 +01:00
|
|
|
|
|
|
|
runHook postPatch
|
2016-10-23 21:35:51 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-06-05 19:08:07 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
2016-12-16 10:22:24 +00:00
|
|
|
instdir=$out/${instPath}
|
2016-10-23 21:35:51 +01:00
|
|
|
|
|
|
|
# Install executables and libraries
|
|
|
|
mkdir -p $instdir/bin
|
|
|
|
install -m 0755 bin/browser_${arch} $instdir/bin
|
|
|
|
install -m 0755 bin/libApp{Stereo,Surround,Wall}_${arch}.so $instdir/bin
|
|
|
|
install -m 0755 bin/libGPUMonitor_${arch}.so $instdir/bin
|
|
|
|
install -m 0755 bin/libQt{Core,Gui,Network,WebKit,Xml}Unigine_${arch}.so.4 $instdir/bin
|
|
|
|
install -m 0755 bin/libUnigine_${arch}.so $instdir/bin
|
|
|
|
install -m 0755 bin/valley_${arch} $instdir/bin
|
|
|
|
install -m 0755 valley $instdir
|
|
|
|
|
|
|
|
# Install other files
|
|
|
|
cp -R data documentation $instdir
|
|
|
|
|
|
|
|
# Install and wrap executable
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install -m 0755 valley $out/bin/valley
|
|
|
|
wrapProgram $out/bin/valley \
|
|
|
|
--run "cd $instdir" \
|
|
|
|
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$instdir/bin:$libPath
|
2017-06-05 19:08:07 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
2016-10-23 21:35:51 +01:00
|
|
|
'';
|
|
|
|
|
2016-12-16 10:22:24 +00:00
|
|
|
stripDebugList = ["${instPath}/bin"];
|
2016-12-08 17:00:25 +00:00
|
|
|
|
2016-10-23 21:35:51 +01:00
|
|
|
meta = {
|
|
|
|
description = "The Unigine Valley GPU benchmarking tool";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://unigine.com/products/benchmarks/valley/";
|
2016-12-16 10:22:24 +00:00
|
|
|
license = stdenv.lib.licenses.unfree; # see also: $out/$instPath/documentation/License.pdf
|
2016-10-23 21:35:51 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.kierdavis ];
|
|
|
|
platforms = ["x86_64-linux" "i686-linux"];
|
|
|
|
};
|
|
|
|
}
|