2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-12-25 13:55:36 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, boost
|
2022-02-20 05:27:41 +00:00
|
|
|
, cmake
|
2020-12-25 13:55:36 +00:00
|
|
|
, double-conversion
|
2022-02-20 05:27:41 +00:00
|
|
|
, fetchpatch
|
|
|
|
, fmt_8
|
2020-12-25 13:55:36 +00:00
|
|
|
, gflags
|
2022-02-20 05:27:41 +00:00
|
|
|
, glog
|
|
|
|
, libevent
|
2020-12-25 13:55:36 +00:00
|
|
|
, libiberty
|
2022-02-20 05:27:41 +00:00
|
|
|
, libunwind
|
2020-12-25 13:55:36 +00:00
|
|
|
, lz4
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
2022-02-20 05:27:41 +00:00
|
|
|
, xz
|
|
|
|
, zlib
|
|
|
|
, zstd
|
2022-07-18 16:21:45 +00:00
|
|
|
, jemalloc
|
2022-02-20 05:27:41 +00:00
|
|
|
, follyMobile ? false
|
2020-12-25 13:55:36 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "folly";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "2022.09.05.00";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "folly";
|
|
|
|
rev = "v${version}";
|
2022-09-09 14:08:57 +00:00
|
|
|
sha256 = "sha256-V+CmsHPq+nIJrn7jPnwRls3ICW6JSqwOeDUQMvSyyrQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# See CMake/folly-deps.cmake in the Folly source tree.
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
double-conversion
|
|
|
|
glog
|
|
|
|
gflags
|
|
|
|
libevent
|
|
|
|
libiberty
|
|
|
|
openssl
|
2020-12-25 13:55:36 +00:00
|
|
|
lz4
|
2021-04-05 15:23:46 +00:00
|
|
|
xz
|
2020-12-25 13:55:36 +00:00
|
|
|
zlib
|
|
|
|
libunwind
|
2022-02-20 05:27:41 +00:00
|
|
|
fmt_8
|
|
|
|
zstd
|
2022-07-18 16:21:45 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux jemalloc;
|
|
|
|
|
|
|
|
# jemalloc headers are required in include/folly/portability/Malloc.h
|
|
|
|
propagatedBuildInputs = lib.optional stdenv.isLinux jemalloc;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
NIX_CFLAGS_COMPILE = [ "-DFOLLY_MOBILE=${if follyMobile then "1" else "0"}" "-fpermissive" ];
|
2020-12-25 13:55:36 +00:00
|
|
|
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
postFixup = ''
|
|
|
|
substituteInPlace "$out"/lib/pkgconfig/libfolly.pc \
|
|
|
|
--replace '=''${prefix}//' '=/' \
|
|
|
|
--replace '=''${exec_prefix}//' '=/'
|
|
|
|
'';
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
# folly-config.cmake, will `find_package` these, thus there should be
|
|
|
|
# a way to ensure abi compatibility.
|
|
|
|
passthru = {
|
|
|
|
inherit boost;
|
|
|
|
fmt = fmt_8;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An open-source C++ library developed and used at Facebook";
|
|
|
|
homepage = "https://github.com/facebook/folly";
|
|
|
|
license = licenses.asl20;
|
|
|
|
# 32bit is not supported: https://github.com/facebook/folly/issues/103
|
2022-05-18 14:49:53 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ abbradar pierreis ];
|
|
|
|
};
|
2022-02-20 05:27:41 +00:00
|
|
|
}
|