nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 141 lines 3.8 kB view raw
1{ 2 lib, 3 stdenv, 4 5 fetchFromGitHub, 6 fetchpatch, 7 8 cmake, 9 ninja, 10 11 openssl, 12 gflags, 13 glog, 14 folly, 15 fizz, 16 wangle, 17 zlib, 18 zstd, 19 xxHash, 20 21 mvfst, 22 23 nix-update-script, 24}: 25 26stdenv.mkDerivation (finalAttrs: { 27 pname = "fbthrift"; 28 version = "2025.10.13.00"; 29 30 outputs = [ 31 # Trying to split this up further into `bin`, `out`, and `dev` 32 # causes issues with circular references due to the installed CMake 33 # files referencing the path to the compiler. 34 "out" 35 "lib" 36 ]; 37 38 src = fetchFromGitHub { 39 owner = "facebook"; 40 repo = "fbthrift"; 41 tag = "v${finalAttrs.version}"; 42 hash = "sha256-6Vlmb7PfPl9hyJkpH0vsF4mjNTOxd4lu8CWPE0rRvVo="; 43 }; 44 45 patches = [ 46 # Map `$NIX_BUILD_TOP` to `/build` in the Thrift compiler output to 47 # avoid reproducibility issues on Darwin. 48 ./scrub-build-directory-from-output.patch 49 50 # Remove a line that breaks the build due to the CMake classic of 51 # incorrect path concatenation. 52 ./remove-cmake-install-rpath.patch 53 54 ./glog-0.7.patch 55 ]; 56 57 nativeBuildInputs = [ 58 cmake 59 ninja 60 ]; 61 62 buildInputs = [ 63 openssl 64 gflags 65 glog 66 folly 67 fizz 68 wangle 69 zlib 70 zstd 71 ]; 72 73 propagatedBuildInputs = [ 74 mvfst 75 xxHash 76 ]; 77 78 cmakeFlags = [ 79 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) 80 81 (lib.cmakeBool "thriftpy" false) 82 83 # TODO: Can’t figure out where the C++ tests are wired up in the 84 # CMake build, if anywhere, and this requires Python. 85 #(lib.cmakeBool "enable_tests" finalAttrs.finalPackage.doCheck) 86 87 (lib.cmakeFeature "BIN_INSTALL_DIR" "${placeholder "out"}/bin") 88 (lib.cmakeFeature "INCLUDE_INSTALL_DIR" "${placeholder "out"}/include") 89 (lib.cmakeFeature "LIB_INSTALL_DIR" "${placeholder "lib"}/lib") 90 (lib.cmakeFeature "CMAKE_INSTALL_DIR" "${placeholder "out"}/lib/cmake/fbthrift") 91 ] 92 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 93 # Homebrew sets this, and the shared library build fails without 94 # it. I don’t know, either. It scares me. 95 (lib.cmakeFeature "CMAKE_SHARED_LINKER_FLAGS" "-Wl,-undefined,dynamic_lookup") 96 ]; 97 98 # Fix a typo introduced by the following commit that causes hundreds 99 # of pointless rebuilds when installing: 100 # <https://github.com/facebook/fbthrift/commit/58038399cefc0c2256ce4ef5444dee37147cbf07> 101 postPatch = '' 102 substituteInPlace ThriftLibrary.cmake \ 103 --replace-fail .tcch .tcc 104 ''; 105 106 # Copied from Homebrew; fixes the following build error: 107 # 108 # [ERROR:/nix/var/nix/b/5f3kn8spg6j0z0xlags8va6sq7/source/thrift/lib/thrift/RpcMetadata.thrift:1] unordered_map::at: key not found 109 # 110 # See: 111 # 112 # * <https://github.com/facebook/fbthrift/issues/618> 113 # * <https://github.com/facebook/fbthrift/issues/607> 114 # * <https://github.com/Homebrew/homebrew-core/blob/2135255c78d026541a4106fa98580795740db694/Formula/f/fbthrift.rb#L52-L55> 115 # 116 # I don’t know why we didn’t need this before the bump to 202 117 # to 2025.09.08.00 when we’d been on LLVM 19 for an entire release 118 # cycle already, or why we’re getting different errors to those 119 # reports, or why this fixes the build anyway. Most of what I do to 120 # maintain these packages is copy compilation flags from Homebrew 121 # that scare me. I don’t have very much fun with these libraries, to 122 # be honest with you. 123 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-fno-assume-unique-vtables"; 124 125 passthru.updateScript = nix-update-script { }; 126 127 meta = { 128 description = "Facebook's branch of Apache Thrift"; 129 mainProgram = "thrift1"; 130 homepage = "https://github.com/facebook/fbthrift"; 131 license = lib.licenses.asl20; 132 platforms = lib.platforms.unix; 133 maintainers = with lib.maintainers; [ 134 pierreis 135 kylesferrazza 136 emily 137 techknowlogick 138 lf- 139 ]; 140 }; 141})