2023-02-09 06:33:11 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-12-21 18:32:25 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, boost
|
2022-02-10 03:25:19 +00:00
|
|
|
, cmake
|
2020-12-21 18:32:25 +00:00
|
|
|
, double-conversion
|
2022-02-10 03:25:19 +00:00
|
|
|
, fetchpatch
|
|
|
|
, fmt_8
|
2020-12-21 18:32:25 +00:00
|
|
|
, gflags
|
2022-02-10 03:25:19 +00:00
|
|
|
, glog
|
|
|
|
, libevent
|
2020-12-21 18:32:25 +00:00
|
|
|
, libiberty
|
2022-02-10 03:25:19 +00:00
|
|
|
, libunwind
|
2020-12-21 18:32:25 +00:00
|
|
|
, lz4
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
2022-02-10 03:25:19 +00:00
|
|
|
, xz
|
|
|
|
, zlib
|
|
|
|
, zstd
|
2022-05-24 05:17:28 +00:00
|
|
|
, jemalloc
|
2022-02-10 03:25:19 +00:00
|
|
|
, follyMobile ? false
|
2020-12-21 18:32:25 +00:00
|
|
|
}:
|
2014-11-08 00:48:54 +00:00
|
|
|
|
2022-02-10 03:25:19 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "folly";
|
2023-03-02 10:08:57 +00:00
|
|
|
version = "2023.02.27.00";
|
2015-02-02 17:31:30 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "folly";
|
2016-08-13 00:08:10 +00:00
|
|
|
rev = "v${version}";
|
2023-03-02 10:08:57 +00:00
|
|
|
sha256 = "sha256-DfZiVxncpKSPn9BN25d8o0/tC27+HhSG/t53WgzAT/s=";
|
2014-11-08 00:48:54 +00:00
|
|
|
};
|
|
|
|
|
2020-12-21 18:32:25 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
];
|
2014-11-08 00:48:54 +00:00
|
|
|
|
2018-11-02 20:03:35 +00:00
|
|
|
# See CMake/folly-deps.cmake in the Folly source tree.
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
double-conversion
|
|
|
|
glog
|
2019-07-25 09:04:55 +00:00
|
|
|
gflags
|
2018-11-02 20:03:35 +00:00
|
|
|
libevent
|
|
|
|
libiberty
|
|
|
|
openssl
|
2020-12-21 18:32:25 +00:00
|
|
|
lz4
|
2021-03-14 18:12:53 +00:00
|
|
|
xz
|
2020-12-21 18:32:25 +00:00
|
|
|
zlib
|
|
|
|
libunwind
|
2022-02-10 03:25:19 +00:00
|
|
|
fmt_8
|
|
|
|
zstd
|
2022-05-24 05:17:28 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux jemalloc;
|
|
|
|
|
|
|
|
# jemalloc headers are required in include/folly/portability/Malloc.h
|
|
|
|
propagatedBuildInputs = lib.optional stdenv.isLinux jemalloc;
|
2014-11-08 00:48:54 +00:00
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-DFOLLY_MOBILE=${if follyMobile then "1" else "0"}" "-fpermissive" ];
|
2023-02-09 06:33:11 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
|
|
|
|
|
|
|
# temporary hack until folly builds work on aarch64,
|
|
|
|
# see https://github.com/facebook/folly/issues/1880
|
|
|
|
"-DCMAKE_LIBRARY_ARCHITECTURE=${if stdenv.isx86_64 then "x86_64" else "dummy"}"
|
|
|
|
];
|
2014-11-08 00:48:54 +00:00
|
|
|
|
2022-09-28 15:48:17 +00:00
|
|
|
postFixup = ''
|
|
|
|
substituteInPlace "$out"/lib/pkgconfig/libfolly.pc \
|
|
|
|
--replace '=''${prefix}//' '=/' \
|
|
|
|
--replace '=''${exec_prefix}//' '=/'
|
|
|
|
'';
|
|
|
|
|
2022-07-12 00:52:55 +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-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2015-03-29 02:02:02 +00:00
|
|
|
description = "An open-source C++ library developed and used at Facebook";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/facebook/folly";
|
2016-08-24 23:30:28 +00:00
|
|
|
license = licenses.asl20;
|
2014-12-11 08:49:52 +00:00
|
|
|
# 32bit is not supported: https://github.com/facebook/folly/issues/103
|
2022-05-15 08:06:46 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
2019-05-31 20:18:05 +00:00
|
|
|
maintainers = with maintainers; [ abbradar pierreis ];
|
2014-11-08 00:48:54 +00:00
|
|
|
};
|
2022-02-10 03:25:19 +00:00
|
|
|
}
|