Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtest: Add pkgconfig support #49310

Merged
merged 2 commits into from Oct 28, 2018
Merged

Conversation

periklis
Copy link
Contributor

@periklis periklis commented Oct 27, 2018

Motivation for this change

Googletest generated some nice pkg-config files, which are cool for pkg_check_modules checks.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@periklis periklis mentioned this pull request Oct 27, 2018
9 tasks
@dywedir
Copy link
Member

dywedir commented Oct 27, 2018

Could you please rename commit message to gtest: Add pkgconfig support?

@hartwork
Copy link
Contributor

I wonder why make install is avoided here. It works well with gtest 1.8.1 for me.

@jtojnar
Copy link
Contributor

jtojnar commented Oct 27, 2018

--- a/pkgs/development/libraries/gtest/default.nix
+++ b/pkgs/development/libraries/gtest/default.nix
@@ -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 @@
     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";

screenshot from 2018-10-28 01-06-05

@periklis
Copy link
Contributor Author

@jtojnar Thanks for looking at the builder. It looked also strange to me, but i didn't dig deeper due to my narrow focus on having pkgconfig running for uriparser

@periklis periklis changed the title googletest: Add pkgconfig support gtest: Add pkgconfig support Oct 28, 2018
@jtojnar
Copy link
Contributor

jtojnar commented Oct 28, 2018

@GrahamcOfBorg build gtest

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: gtest

Partial log (click to expand)

-- Installing: /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1/include/gtest/internal/gtest-type-util.h.pump
-- Installing: /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1/lib/libgtest.a
-- Installing: /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1/lib/libgtest_main.a
-- Installing: /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1/lib/pkgconfig/gtest.pc
-- Installing: /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1/lib/pkgconfig/gtest_main.pc
post-installation fixup
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1/lib
patching script interpreter paths in /nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1
/nix/store/l9an0m1fz9kzsjs3fbvjsa15zpg6fzf3-gtest-1.8.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: gtest

Partial log (click to expand)

-- Installing: /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1/lib/libgtest_main.a
-- Installing: /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1/lib/pkgconfig/gtest.pc
-- Installing: /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1/lib/pkgconfig/gtest_main.pc
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1/lib
patching script interpreter paths in /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1
checking for references to /build in /nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1...
/nix/store/q2q3kq71ggd8w10rhca1qhab08gjj7m5-gtest-1.8.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: gtest

Partial log (click to expand)

-- Installing: /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1/lib/libgtest_main.a
-- Installing: /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1/lib/pkgconfig/gtest.pc
-- Installing: /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1/lib/pkgconfig/gtest_main.pc
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1/lib
patching script interpreter paths in /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1
checking for references to /build in /nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1...
/nix/store/gzl4h0xq0x5rf65yd781q5ckkng4ylpg-gtest-1.8.1

@jtojnar jtojnar merged commit 9ac64e5 into NixOS:master Oct 28, 2018
@periklis periklis deleted the gtest-pkgconfig-support branch October 28, 2018 10:27
@periklis periklis mentioned this pull request Nov 1, 2018
9 tasks
orivej added a commit to orivej/nixpkgs that referenced this pull request Nov 19, 2018
edolstra pushed a commit that referenced this pull request Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants