2021-10-31 10:02:34 +00:00
|
|
|
|
{ lib
|
|
|
|
|
, stdenv
|
|
|
|
|
, fetchFromGitHub
|
|
|
|
|
, fetchpatch
|
|
|
|
|
, cmake
|
|
|
|
|
, static ? stdenv.hostPlatform.isStatic
|
|
|
|
|
, cxxStandard ? null
|
|
|
|
|
}:
|
2019-03-27 00:02:15 +00:00
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
|
pname = "abseil-cpp";
|
2021-09-01 04:20:00 +00:00
|
|
|
|
version = "20210324.2";
|
2019-03-27 00:02:15 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "abseil";
|
|
|
|
|
repo = "abseil-cpp";
|
2020-05-04 10:11:55 +00:00
|
|
|
|
rev = version;
|
2022-02-05 21:41:23 +00:00
|
|
|
|
sha256 = "sha256-fcxPhuI2eL/fnd6nT11p8DpUNwGNaXZmd03yOiZcOT0=";
|
2019-03-27 00:02:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-05-22 13:11:44 +00:00
|
|
|
|
patches = [
|
|
|
|
|
# Use CMAKE_INSTALL_FULL_{LIBDIR,INCLUDEDIR}
|
|
|
|
|
# https://github.com/abseil/abseil-cpp/pull/963
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
url = "https://github.com/abseil/abseil-cpp/commit/5bfa70c75e621c5d5ec095c8c4c0c050dcb2957e.patch";
|
|
|
|
|
sha256 = "0nhjxqfxpi2pkfinnqvd5m4npf9l1kg39mjx9l3087ajhadaywl5";
|
|
|
|
|
})
|
2023-05-29 21:13:37 +00:00
|
|
|
|
|
|
|
|
|
# Bacport gcc-13 fix:
|
|
|
|
|
# https://github.com/abseil/abseil-cpp/pull/1187
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
name = "gcc-13.patch";
|
|
|
|
|
url = "https://github.com/abseil/abseil-cpp/commit/36a4b073f1e7e02ed7d1ac140767e36f82f09b7c.patch";
|
|
|
|
|
hash = "sha256-aA7mwGEtv/cQINcawjkukmCvfNuqwUeDFssSiNKPdgg=";
|
|
|
|
|
})
|
2023-05-01 15:39:25 +00:00
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLoongArch64 [
|
|
|
|
|
# https://github.com/abseil/abseil-cpp/pull/1110
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
url = "https://github.com/abseil/abseil-cpp/commit/808bc202fc13e85a7948db0d7fb58f0f051200b1.patch";
|
|
|
|
|
sha256 = "sha256-ayY/aV/xWOdEyFSDqV7B5WDGvZ0ASr/aeBeYwP5RZVc=";
|
|
|
|
|
})
|
2023-10-31 01:53:57 +00:00
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
|
# Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
|
|
|
|
|
# that require a different SDK other than the default one.
|
|
|
|
|
./cmake-core-foundation.patch
|
2021-05-22 13:11:44 +00:00
|
|
|
|
];
|
|
|
|
|
|
2021-02-13 19:58:22 +00:00
|
|
|
|
cmakeFlags = [
|
2021-03-20 04:20:00 +00:00
|
|
|
|
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
|
2021-10-31 10:02:08 +00:00
|
|
|
|
] ++ lib.optionals (cxxStandard != null) [
|
2021-10-31 10:06:06 +00:00
|
|
|
|
"-DCMAKE_CXX_STANDARD=${cxxStandard}"
|
2021-02-13 19:58:22 +00:00
|
|
|
|
];
|
|
|
|
|
|
2019-03-27 00:02:15 +00:00
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
|
meta = with lib; {
|
2019-03-27 00:02:15 +00:00
|
|
|
|
description = "An open-source collection of C++ code designed to augment the C++ standard library";
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "https://abseil.io/";
|
2019-03-27 00:02:15 +00:00
|
|
|
|
license = licenses.asl20;
|
2020-05-04 10:11:55 +00:00
|
|
|
|
platforms = platforms.all;
|
2019-03-27 00:02:15 +00:00
|
|
|
|
maintainers = [ maintainers.andersk ];
|
|
|
|
|
};
|
|
|
|
|
}
|