gtest: Use native cmake/ninja builder

Clean up the expression and add pkgconfig support
This commit is contained in:
Periklis Tsirakidis 2018-10-28 11:25:13 +01:00 committed by Jan Tojnar
parent e5ce19f6ab
commit 9ac64e5bb6

View File

@ -1,4 +1,4 @@
{ stdenv, cmake, fetchFromGitHub }:
{ stdenv, cmake, ninja, fetchFromGitHub }:
stdenv.mkDerivation rec {
name = "gtest-${version}";
version = "1.8.1";
@ -10,24 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "0270msj6n7mggh4xqqjp54kswbl7mkcc8px1p5dqdpmw5ngh9fzk";
};
buildInputs = [ cmake ];
configurePhase = ''
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=$out
'';
installPhase = ''
mkdir -p $out/lib
cp -v googlemock/gtest/libgtest.a googlemock/gtest/libgtest_main.a googlemock/libgmock.a googlemock/libgmock_main.a $out/lib
ln -s $out/lib/libgmock.a $out/lib/libgoogletest.a
mkdir -p $out/include
cp -v -r ../googlemock/include/gmock $out/include
cp -v -r ../googletest/include/gtest $out/include
mkdir -p $out/src
cp -v -r ../googlemock/src/* ../googletest/src/* $out/src
'';
nativeBuildInputs = [ cmake ninja ];
meta = with stdenv.lib; {
description = "Google's framework for writing C++ tests";