nixpkgs/pkgs/by-name/fb/fbthrift/package.nix
Emily 21d5e06f9b
fbthrift: add techknowlogick to maintainers
(cherry picked from commit 143f253756)
(cherry picked from commit 245f8fc341)
2024-11-30 15:11:27 +01:00

129 lines
2.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
stdenv,
fetchFromGitHub,
cmake,
ninja,
removeReferencesTo,
openssl,
gflags,
glog,
folly,
fizz,
wangle,
zlib,
zstd,
xxHash,
apple-sdk_11,
darwinMinVersionHook,
mvfst,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "fbthrift";
version = "2024.11.18.00";
outputs = [
# Trying to split this up further into `bin`, `out`, and `dev`
# causes issues with circular references due to the installed CMake
# files referencing the path to the compiler.
"out"
"lib"
];
src = fetchFromGitHub {
owner = "facebook";
repo = "fbthrift";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-dJf4vaIcat24WiKLFNEqeCnJYiO+c5YkuFu+hrS6cPE=";
};
patches = [
# Remove a line that breaks the build due to the CMake classic of
# incorrect path concatenation.
./remove-cmake-install-rpath.patch
];
nativeBuildInputs = [
cmake
ninja
removeReferencesTo
];
buildInputs =
[
openssl
gflags
glog
folly
fizz
wangle
zlib
zstd
xxHash
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
apple-sdk_11
(darwinMinVersionHook "11.0")
];
propagatedBuildInputs = [
mvfst
];
cmakeFlags =
[
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "thriftpy" false)
# TODO: Cant figure out where the C++ tests are wired up in the
# CMake build, if anywhere, and this requires Python.
#(lib.cmakeBool "enable_tests" finalAttrs.finalPackage.doCheck)
(lib.cmakeFeature "BIN_INSTALL_DIR" "${placeholder "out"}/bin")
(lib.cmakeFeature "INCLUDE_INSTALL_DIR" "${placeholder "out"}/include")
(lib.cmakeFeature "LIB_INSTALL_DIR" "${placeholder "lib"}/lib")
(lib.cmakeFeature "CMAKE_INSTALL_DIR" "${placeholder "out"}/lib/cmake/fbthrift")
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Homebrew sets this, and the shared library build fails without
# it. I dont know, either. It scares me.
(lib.cmakeFeature "CMAKE_SHARED_LINKER_FLAGS" "-Wl,-undefined,dynamic_lookup")
];
postFixup = ''
# Sanitize header paths to avoid runtime dependencies leaking in
# through `__FILE__`.
(
shopt -s globstar
for header in "$out/include"/**/*.h; do
sed -i "1i#line 1 \"$header\"" "$header"
remove-references-to -t "$out" "$header"
done
)
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Facebook's branch of Apache Thrift";
mainProgram = "thrift1";
homepage = "https://github.com/facebook/fbthrift";
license = lib.licenses.asl20;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
pierreis
kylesferrazza
emily
techknowlogick
];
};
})