dftd4: add option to build with cmake in addition to meson

+38 -3
+13
pkgs/by-name/df/dftd4/cmake.patch
··· 1 + diff --git a/config/template.pc b/config/template.pc 2 + index 3d6efbb..e338a42 100644 3 + --- a/config/template.pc 4 + +++ b/config/template.pc 5 + @@ -1,6 +1,6 @@ 6 + prefix=@CMAKE_INSTALL_PREFIX@ 7 + -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 8 + -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 9 + +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 10 + +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 11 + 12 + Name: @PROJECT_NAME@ 13 + Description: @PROJECT_DESCRIPTION@
+25 -3
pkgs/by-name/df/dftd4/package.nix
··· 2 2 stdenv, 3 3 lib, 4 4 fetchFromGitHub, 5 + fetchpatch, 5 6 gfortran, 7 + buildType ? "meson", 8 + cmake, 6 9 meson, 7 10 ninja, 8 11 pkg-config, ··· 15 18 }: 16 19 17 20 assert !blas.isILP64 && !lapack.isILP64; 21 + assert ( 22 + builtins.elem buildType [ 23 + "meson" 24 + "cmake" 25 + ] 26 + ); 18 27 19 28 stdenv.mkDerivation rec { 20 29 pname = "dftd4"; ··· 30 39 patches = [ 31 40 # Make sure fortran headers are installed directly in /include 32 41 ./fortran-module-dir.patch 42 + 43 + # Fix wrong generation of package config include paths 44 + ./cmake.patch 33 45 ]; 34 46 35 47 nativeBuildInputs = [ 36 48 gfortran 37 - meson 38 - ninja 39 49 pkg-config 40 50 python3 41 - ]; 51 + ] 52 + ++ lib.optionals (buildType == "meson") [ 53 + meson 54 + ninja 55 + ] 56 + ++ lib.optional (buildType == "cmake") cmake; 42 57 43 58 buildInputs = [ 44 59 blas 45 60 lapack 61 + ]; 62 + 63 + propagatedBuildInputs = [ 46 64 mctc-lib 47 65 mstore 48 66 multicharge 67 + ]; 68 + 69 + cmakeFlags = [ 70 + (lib.strings.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) 49 71 ]; 50 72 51 73 outputs = [