at master 1.8 kB view raw
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 = "20240722.1"; 15 16 src = fetchFromGitHub { 17 owner = "abseil"; 18 repo = "abseil-cpp"; 19 tag = finalAttrs.version; 20 hash = "sha256-ir4hG2VIPv3se7JfWqCM/siLqFEFkmhMW/IGCocy6Pc="; 21 }; 22 23 patches = [ 24 # Don't match -Wnon-virtual-dtor in the "flags are needed to suppress 25 # Needed to cleanly apply the #1738 fix below. 26 # https://github.com/abseil/abseil-cpp/issues/1737 27 (fetchpatch { 28 url = "https://github.com/abseil/abseil-cpp/commit/9cb5e5d15c142e5cc43a2c1db87c8e4e5b6d38a5.patch"; 29 hash = "sha256-PTNmNJMk42Omwek0ackl4PjxifDP/+GaUitS60l+VB0="; 30 }) 31 32 # Fix shell option group handling in pkgconfig files 33 # https://github.com/abseil/abseil-cpp/pull/1738 34 (fetchpatch { 35 url = "https://github.com/abseil/abseil-cpp/commit/bd0c9c58cac4463d96b574de3097422bb78215a8.patch"; 36 hash = "sha256-fB9pvkyNBXoDKLrVaNwliqrWEPTa2Y6OJMe2xgl5IBc="; 37 }) 38 ]; 39 40 cmakeFlags = [ 41 "-DABSL_BUILD_TEST_HELPERS=ON" 42 "-DABSL_USE_EXTERNAL_GOOGLETEST=ON" 43 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" 44 ] 45 ++ lib.optionals (cxxStandard != null) [ 46 "-DCMAKE_CXX_STANDARD=${cxxStandard}" 47 ]; 48 49 strictDeps = true; 50 51 nativeBuildInputs = [ cmake ]; 52 53 buildInputs = [ gtest ]; 54 55 meta = { 56 description = "Open-source collection of C++ code designed to augment the C++ standard library"; 57 homepage = "https://abseil.io/"; 58 changelog = "https://github.com/abseil/abseil-cpp/releases/tag/${finalAttrs.version}"; 59 license = lib.licenses.asl20; 60 platforms = lib.platforms.all; 61 maintainers = [ lib.maintainers.GaetanLepage ]; 62 }; 63})