test-drive: add option to build with cmake in addition to meson

+31 -3
+13
pkgs/by-name/te/test-drive/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@
+18 -3
pkgs/by-name/te/test-drive/package.nix
··· 3 3 lib, 4 4 fetchFromGitHub, 5 5 gfortran, 6 + buildType ? "meson", 6 7 meson, 7 8 ninja, 9 + cmake, 8 10 mesonEmulatorHook, 9 11 }: 10 12 13 + assert ( 14 + builtins.elem buildType [ 15 + "meson" 16 + "cmake" 17 + ] 18 + ); 19 + 11 20 stdenv.mkDerivation rec { 12 21 pname = "test-drive"; 13 22 version = "0.5.0"; ··· 19 28 hash = "sha256-xRx8ErIN9xjxZt/nEsdIQkIGFRltuELdlI8lXA+M030="; 20 29 }; 21 30 31 + patches = [ 32 + # Fix wrong generation of package config include paths 33 + ./cmake.patch 34 + ]; 35 + 22 36 nativeBuildInputs = [ 23 37 gfortran 38 + ] 39 + ++ lib.optionals (buildType == "meson") [ 24 40 meson 25 41 ninja 26 42 ] 27 - ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 28 - mesonEmulatorHook 29 - ]; 43 + ++ lib.optional (buildType == "cmake") cmake 44 + ++ lib.optional (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) mesonEmulatorHook; 30 45 31 46 mesonAutoFeatures = "auto"; 32 47