1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 gtest,
8 static ? stdenv.hostPlatform.isStatic,
9 cxxStandard ? null,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "abseil-cpp";
14 version = "20240116.3";
15
16 src = fetchFromGitHub {
17 owner = "abseil";
18 repo = "abseil-cpp";
19 tag = finalAttrs.version;
20 hash = "sha256-VfC8kQtGlOew9iVKxQ7kIgqFMvHiDpSBhvyNOfneuwo=";
21 };
22
23 patches = [
24 # Fixes: clang++: error: unsupported option '-msse4.1' for target 'aarch64-apple-darwin'
25 # https://github.com/abseil/abseil-cpp/pull/1707
26 (fetchpatch {
27 name = "fix-compile-breakage-on-darwin";
28 url = "https://github.com/abseil/abseil-cpp/commit/6dee153242d7becebe026a9bed52f4114441719d.patch";
29 hash = "sha256-r6QnHPnwPwOE/hv4kLNA3FqNq2vU/QGmwAc5q0/q1cs=";
30 })
31 ];
32
33 cmakeFlags = [
34 "-DABSL_BUILD_TEST_HELPERS=ON"
35 "-DABSL_USE_EXTERNAL_GOOGLETEST=ON"
36 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
37 ]
38 ++ lib.optionals (cxxStandard != null) [
39 "-DCMAKE_CXX_STANDARD=${cxxStandard}"
40 ];
41
42 strictDeps = true;
43
44 nativeBuildInputs = [ cmake ];
45
46 buildInputs = [ gtest ];
47
48 meta = {
49 description = "Open-source collection of C++ code designed to augment the C++ standard library";
50 homepage = "https://abseil.io/";
51 changelog = "https://github.com/abseil/abseil-cpp/releases/tag/${finalAttrs.version}";
52 license = lib.licenses.asl20;
53 platforms = lib.platforms.all;
54 maintainers = [ lib.maintainers.GaetanLepage ];
55 };
56})