107 lines
2.5 KiB
Nix
107 lines
2.5 KiB
Nix
|
{
|
||
|
stdenv
|
||
|
, libarchive
|
||
|
, xz
|
||
|
, gnutar
|
||
|
, gfortran
|
||
|
, coreutils
|
||
|
, requireFile
|
||
|
, autoPatchelfHook
|
||
|
, libxcrypt-legacy
|
||
|
, glibc
|
||
|
, lib
|
||
|
}:
|
||
|
|
||
|
stdenv.mkDerivation rec {
|
||
|
pname = "spec-cpu-tools";
|
||
|
version = "1.1.7";
|
||
|
|
||
|
src = requireFile {
|
||
|
name = "cpu2017-1.1.7.iso";
|
||
|
sha256 = "02630819h64dyy57wkj33fhwwqgbw6mqc5awh1zm48pkvvl0l600";
|
||
|
message = ''
|
||
|
Missing SPEC CPU 2017 1.1.7.
|
||
|
|
||
|
Add it to the store with:
|
||
|
|
||
|
$ nix-prefetch-url file:/path/to/cpu2017-1.1.7.iso
|
||
|
/nix/store/mk4hr8xwd62akp7iw5khq638ssba8qz0-cpu2017-1.1.7.iso
|
||
|
|
||
|
Notice that the name must match exactly "cpu2017-1.1.7.iso".
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
unpackPhase = ''
|
||
|
set -x
|
||
|
mkdir iso
|
||
|
bsdtar -C iso -xf $src
|
||
|
chmod +w -R iso
|
||
|
|
||
|
#for f in iso/install_archives/benchball/*; do
|
||
|
# bsdtar -xf $f
|
||
|
#done
|
||
|
#mkdir src
|
||
|
#bsdtar -C src -xf iso/install_archives/benchball/cpu2017-1.1.7.base.tar.xz
|
||
|
#bsdtar -C src -xf iso/install_archives/benchball/519.lbm_r-1.000503.tar.xz
|
||
|
|
||
|
sourceRoot="$PWD/iso"
|
||
|
set +x
|
||
|
'';
|
||
|
|
||
|
# We need a working specxz binary
|
||
|
configurePhase = ''
|
||
|
patchShebangs install.sh
|
||
|
|
||
|
set -x
|
||
|
|
||
|
# Replace "spec*" tools by symlinks to working binaries
|
||
|
pushd tools/bin/linux-x86_64
|
||
|
ln -fs ${xz}/bin/xz specxz
|
||
|
ln -fs ${gnutar}/bin/tar spectar
|
||
|
patchelf \
|
||
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||
|
specsha512sum
|
||
|
ls -l spec*
|
||
|
./specxz -h
|
||
|
./spectar --help
|
||
|
ldd ./specsha512sum
|
||
|
./specsha512sum --help
|
||
|
popd
|
||
|
|
||
|
# sha512sum requires -e, not provided by coreutils
|
||
|
|
||
|
export SPEC="$sourceRoot"
|
||
|
|
||
|
# Don't run the tests
|
||
|
sed -i 's/^.*shrc will.*$/exit 0/g' install.sh
|
||
|
|
||
|
set +x
|
||
|
'';
|
||
|
|
||
|
installPhase = ''
|
||
|
bash -x install.sh -f -d $out -u linux-x86_64
|
||
|
'';
|
||
|
|
||
|
preFixup = ''
|
||
|
# Fix temporary directory creation
|
||
|
sed -i '/^sub get_tmp_directory/a\ return tempdir(CLEANUP => 1);' \
|
||
|
$out/bin/common/util_common.pl
|
||
|
|
||
|
sed -i '/my $dir = jp($top, $config->resultdir, $subdir);/c\ my $dir = ::get_tmp_directory($config, 1);' \
|
||
|
$out/bin/harness/log.pl
|
||
|
'';
|
||
|
|
||
|
# Missing libdb-4.7.so
|
||
|
autoPatchelfIgnoreMissingDeps = true;
|
||
|
|
||
|
nativeBuildInputs = [ libxcrypt-legacy libarchive autoPatchelfHook ];
|
||
|
#buildInputs = [ libxcrypt-legacy ];
|
||
|
|
||
|
enableParallelBuilding = false;
|
||
|
hardeningDisable = [ "all" ];
|
||
|
dontStrip = true;
|
||
|
meta.broken = (stdenv.buildPlatform.config != "x86_64-unknown-linux-gnu") ||
|
||
|
(stdenv.hostPlatform.config != "x86_64-unknown-linux-gnu") ||
|
||
|
(stdenv.targetPlatform.config != "riscv64-unknown-linux-gnu");
|
||
|
}
|