2021-11-30 15:58:58 +01:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, lib
|
|
|
|
, cmake
|
|
|
|
, mpi
|
2023-05-30 16:44:39 +02:00
|
|
|
, fetchFromGitHub
|
|
|
|
, useGit ? false
|
2021-11-30 15:58:58 +01:00
|
|
|
, gitBranch ? "master"
|
2023-09-06 16:20:59 +02:00
|
|
|
, gitUrl ? "ssh://git@bscpm03.bsc.es/rarias/ovni.git"
|
2023-11-24 15:22:54 +01:00
|
|
|
, gitCommit ? "7a33deffb7aaae70527125d48428f22169c9d39e"
|
2023-05-30 16:44:39 +02:00
|
|
|
, enableDebug ? false
|
2021-11-30 15:58:58 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2023-05-30 16:44:39 +02:00
|
|
|
let
|
|
|
|
release = rec {
|
2023-11-24 15:22:54 +01:00
|
|
|
version = "1.4.1";
|
2023-05-30 16:44:39 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bsc-pm";
|
|
|
|
repo = "ovni";
|
|
|
|
rev = "${version}";
|
2023-11-24 15:22:54 +01:00
|
|
|
hash = "sha256-/vv7Yy6dzoxuHjMc0h/vFFwWzysPLXFZIN2rbLT/SC8=";
|
|
|
|
} // { shortRev = "7a33def"; };
|
2023-05-30 16:44:39 +02:00
|
|
|
};
|
2021-11-30 15:58:58 +01:00
|
|
|
|
2023-05-30 16:44:39 +02:00
|
|
|
git = rec {
|
|
|
|
version = src.shortRev;
|
|
|
|
src = builtins.fetchGit {
|
|
|
|
url = gitUrl;
|
|
|
|
ref = gitBranch;
|
|
|
|
rev = gitCommit;
|
|
|
|
};
|
|
|
|
};
|
2021-11-30 15:58:58 +01:00
|
|
|
|
2023-05-30 16:44:39 +02:00
|
|
|
source = if (useGit) then git else release;
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ovni";
|
|
|
|
inherit (source) src version;
|
2023-11-20 15:43:29 +01:00
|
|
|
dontStrip = true;
|
|
|
|
separateDebugInfo = true;
|
2023-10-04 13:44:03 +02:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs --build test/
|
|
|
|
'';
|
2023-05-30 16:44:39 +02:00
|
|
|
buildInputs = [ cmake mpi ];
|
|
|
|
cmakeBuildType = if (enableDebug) then "Debug" else "Release";
|
2023-09-19 10:33:32 +02:00
|
|
|
cmakeFlags = [ "-DOVNI_GIT_COMMIT=${src.shortRev}" ];
|
2023-10-04 13:40:02 +02:00
|
|
|
preCheck = ''
|
|
|
|
export CTEST_OUTPUT_ON_FAILURE=1
|
|
|
|
'';
|
2023-10-04 13:31:55 +02:00
|
|
|
doCheck = true;
|
|
|
|
checkTarget = "test";
|
|
|
|
hardeningDisable = [ "all" ];
|
2023-05-30 16:44:39 +02:00
|
|
|
}
|