at 23.11-beta 90 lines 2.0 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, boost 5, cmake 6, double-conversion 7, fetchpatch 8, fmt_8 9, gflags 10, glog 11, libevent 12, libiberty 13, libunwind 14, lz4 15, openssl 16, pkg-config 17, xz 18, zlib 19, zstd 20, jemalloc 21, follyMobile ? false 22}: 23 24stdenv.mkDerivation rec { 25 pname = "folly"; 26 version = "2023.02.27.00"; 27 28 src = fetchFromGitHub { 29 owner = "facebook"; 30 repo = "folly"; 31 rev = "v${version}"; 32 sha256 = "sha256-DfZiVxncpKSPn9BN25d8o0/tC27+HhSG/t53WgzAT/s="; 33 }; 34 35 nativeBuildInputs = [ 36 cmake 37 pkg-config 38 ]; 39 40 # See CMake/folly-deps.cmake in the Folly source tree. 41 buildInputs = [ 42 boost 43 double-conversion 44 glog 45 gflags 46 libevent 47 libiberty 48 openssl 49 lz4 50 xz 51 zlib 52 libunwind 53 fmt_8 54 zstd 55 ] ++ lib.optional stdenv.isLinux jemalloc; 56 57 # jemalloc headers are required in include/folly/portability/Malloc.h 58 propagatedBuildInputs = lib.optional stdenv.isLinux jemalloc; 59 60 env.NIX_CFLAGS_COMPILE = toString [ "-DFOLLY_MOBILE=${if follyMobile then "1" else "0"}" "-fpermissive" ]; 61 cmakeFlags = [ 62 "-DBUILD_SHARED_LIBS=ON" 63 64 # temporary hack until folly builds work on aarch64, 65 # see https://github.com/facebook/folly/issues/1880 66 "-DCMAKE_LIBRARY_ARCHITECTURE=${if stdenv.isx86_64 then "x86_64" else "dummy"}" 67 ]; 68 69 postFixup = '' 70 substituteInPlace "$out"/lib/pkgconfig/libfolly.pc \ 71 --replace '=''${prefix}//' '=/' \ 72 --replace '=''${exec_prefix}//' '=/' 73 ''; 74 75 # folly-config.cmake, will `find_package` these, thus there should be 76 # a way to ensure abi compatibility. 77 passthru = { 78 inherit boost; 79 fmt = fmt_8; 80 }; 81 82 meta = with lib; { 83 description = "An open-source C++ library developed and used at Facebook"; 84 homepage = "https://github.com/facebook/folly"; 85 license = licenses.asl20; 86 # 32bit is not supported: https://github.com/facebook/folly/issues/103 87 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ]; 88 maintainers = with maintainers; [ abbradar pierreis ]; 89 }; 90}