firestarter: 1.7.4 -> 2.0 (#134992)

* firestarter: 1.7.4 -> 2.0

* Apply suggestions from code review

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Markus Schmidl 2021-08-20 22:10:21 +02:00 committed by GitHub
parent 6a29f7f504
commit 3bf574a9e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,32 +1,83 @@
{ lib, stdenv, fetchFromGitHub, glibc, python3, cudatoolkit,
withCuda ? true
{ stdenv
, lib
, fetchFromGitHub
, fetchzip
, cmake
, glibc_multi
, glibc
, git
, pkg-config
, cudatoolkit
, withCuda ? false
, linuxPackages
}:
with lib;
let
hwloc = stdenv.mkDerivation rec {
pname = "hwloc";
version = "2.2.0";
src = fetchzip {
url = "https://download.open-mpi.org/release/hwloc/v${lib.versions.majorMinor version}/hwloc-${version}.tar.gz";
sha256 = "1ibw14h9ppg8z3mmkwys8vp699n85kymdz20smjd2iq9b67y80b6";
};
configureFlags = [
"--enable-static"
"--disable-libudev"
"--disable-shared"
"--disable-doxygen"
"--disable-libxml2"
"--disable-cairo"
"--disable-io"
"--disable-pci"
"--disable-opencl"
"--disable-cuda"
"--disable-nvml"
"--disable-gl"
"--disable-libudev"
"--disable-plugin-dlopen"
"--disable-plugin-ltdl"
];
nativeBuildInputs = [ pkg-config ];
enableParallelBuilding = true;
outputs = [ "out" "lib" "dev" "doc" "man" ];
};
in
stdenv.mkDerivation rec {
pname = "firestarter";
version = "1.7.4";
version = "2.0";
src = fetchFromGitHub {
owner = "tud-zih-energy";
repo = "FIRESTARTER";
rev = "v${version}";
sha256 = "0zqfqb7hf48z39g1qhbl1iraf8rz4d629h1q6ikizckpzfq23kd0";
sha256 = "1ik6j1lw5nldj4i3lllrywqg54m9i2vxkxsb2zr4q0d2rfywhn23";
fetchSubmodules = true;
};
nativeBuildInputs = [ python3 ];
buildInputs = [ glibc.static ] ++ optionals withCuda [ cudatoolkit ];
preBuild = ''
mkdir -p build
cd build
python ../code-generator.py ${optionalString withCuda "--enable-cuda"}
'';
makeFlags = optionals withCuda [ "LINUX_CUDA_PATH=${cudatoolkit}" ];
enableParallelBuilding = true;
nativeBuildInputs = [ cmake git pkg-config ];
buildInputs = [ hwloc ] ++ (if withCuda then
[ glibc_multi cudatoolkit linuxPackages.nvidia_x11 ]
else
[ glibc.static ]);
cmakeFlags = [
"-DFIRESTARTER_BUILD_HWLOC=OFF"
"-DCMAKE_C_COMPILER_WORKS=1"
"-DCMAKE_CXX_COMPILER_WORKS=1"
] ++ lib.optionals withCuda [
"-DFIRESTARTER_BUILD_TYPE=FIRESTARTER_CUDA"
];
installPhase = ''
mkdir -p $out/bin
cp FIRESTARTER $out/bin/firestarter
cp src/FIRESTARTER${lib.optionalString withCuda "_CUDA"} $out/bin/
'';
meta = with lib; {