1{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, static ? stdenv.hostPlatform.isStatic }:
2
3stdenv.mkDerivation rec {
4 pname = "abseil-cpp";
5 version = "20210324.1";
6
7 src = fetchFromGitHub {
8 owner = "abseil";
9 repo = "abseil-cpp";
10 rev = version;
11 sha256 = "16w63brfwgiayiyhvawsnr14xyy5hpp68k8fj0z6yk0bjzw6jvjw";
12 };
13
14 patches = [
15 # Use CMAKE_INSTALL_FULL_{LIBDIR,INCLUDEDIR}
16 # https://github.com/abseil/abseil-cpp/pull/963
17 (fetchpatch {
18 url = "https://github.com/abseil/abseil-cpp/commit/5bfa70c75e621c5d5ec095c8c4c0c050dcb2957e.patch";
19 sha256 = "0nhjxqfxpi2pkfinnqvd5m4npf9l1kg39mjx9l3087ajhadaywl5";
20 })
21 ];
22
23 cmakeFlags = [
24 "-DCMAKE_CXX_STANDARD=17"
25 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
26 ];
27
28 nativeBuildInputs = [ cmake ];
29
30 meta = with lib; {
31 description = "An open-source collection of C++ code designed to augment the C++ standard library";
32 homepage = "https://abseil.io/";
33 license = licenses.asl20;
34 platforms = platforms.all;
35 maintainers = [ maintainers.andersk ];
36 };
37}