-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgyre-0.nix
61 lines (54 loc) · 1.42 KB
/
gyre-0.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
version,
hash,
}: {
lib,
stdenv,
fetchgit,
gfortran,
hdf5-fortran,
lapack,
lapack95,
fpx3,
fpx3_deps,
pkg-config,
crlibm-fortran,
withCrlibm ? true,
}: let
helpers = import ./helpers.nix {inherit lib;};
makeFiles = "src/tide/Makefile src/mesa/Makefile src/build/Make.inc src/build/Makefile";
linkProgs = {
"mesasdk_hdf5_link" = "pkg-config --libs hdf5_fortran";
"mesasdk_lapack95_link" = "pkg-config --libs lapack95 lapack crlibm-fortran";
"mesasdk_odepack_link" = "pkg-config --libs odepack";
};
in
stdenv.mkDerivation {
pname = "gyre";
inherit version;
src = fetchgit {
url = "https://github.com/rhdtownsend/gyre";
rev = "v${version}";
inherit hash;
};
patches = [./gyre.patch];
CRMATH =
if withCrlibm
then "yes"
else "no";
FFLAGS = [" -I${hdf5-fortran.dev}/include" " -I${lapack95}/include"]
++ lib.optional withCrlibm " -I${crlibm-fortran}/include";
nativeBuildInputs = [gfortran pkg-config fpx3 fpx3_deps];
buildInputs = [hdf5-fortran lapack lapack95]
++ lib.optional withCrlibm crlibm-fortran;
configurePhase = ''
${helpers.patchLinkProgs makeFiles linkProgs}
echo "echo passed" > src/build/check_sdk_version
sed -i "s|NIX_GYRE_DIR|$out|" src/common/gyre_constants.fpp
'';
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin
cp -r data $out
'';
}