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