Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / abseil-cpp / 202103.nix
blob59294496f80aeb608e6ec885cdeab82c00770c69
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , static ? stdenv.hostPlatform.isStatic
7 , cxxStandard ? null
8 }:
10 stdenv.mkDerivation rec {
11   pname = "abseil-cpp";
12   version = "20210324.2";
14   src = fetchFromGitHub {
15     owner = "abseil";
16     repo = "abseil-cpp";
17     rev = version;
18     sha256 = "sha256-fcxPhuI2eL/fnd6nT11p8DpUNwGNaXZmd03yOiZcOT0=";
19   };
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     })
29     # Bacport gcc-13 fix:
30     #   https://github.com/abseil/abseil-cpp/pull/1187
31     (fetchpatch {
32       name = "gcc-13.patch";
33       url = "https://github.com/abseil/abseil-cpp/commit/36a4b073f1e7e02ed7d1ac140767e36f82f09b7c.patch";
34       hash = "sha256-aA7mwGEtv/cQINcawjkukmCvfNuqwUeDFssSiNKPdgg=";
35     })
36   ] ++ lib.optionals stdenv.hostPlatform.isLoongArch64 [
37     # https://github.com/abseil/abseil-cpp/pull/1110
38     (fetchpatch {
39       url = "https://github.com/abseil/abseil-cpp/commit/808bc202fc13e85a7948db0d7fb58f0f051200b1.patch";
40       sha256 = "sha256-ayY/aV/xWOdEyFSDqV7B5WDGvZ0ASr/aeBeYwP5RZVc=";
41     })
42   ] ++ lib.optionals stdenv.isDarwin [
43     # Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
44     # that require a different SDK other than the default one.
45     ./cmake-core-foundation.patch
46   ];
48   cmakeFlags = [
49     "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
50   ] ++ lib.optionals (cxxStandard != null) [
51     "-DCMAKE_CXX_STANDARD=${cxxStandard}"
52   ];
54   nativeBuildInputs = [ cmake ];
56   meta = with lib; {
57     description = "An open-source collection of C++ code designed to augment the C++ standard library";
58     homepage = "https://abseil.io/";
59     license = licenses.asl20;
60     platforms = platforms.all;
61     maintainers = [ maintainers.andersk ];
62   };