depot/third_party/nixpkgs/pkgs/by-name/ed/edencommon/package.nix

113 lines
2.5 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,
glog,
gflags,
folly,
fb303,
wangle,
fbthrift,
gtest,
apple-sdk_11,
darwinMinVersionHook,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "edencommon";
version = "2024.11.18.00";
outputs = [
"out"
"dev"
];
src = fetchFromGitHub {
owner = "facebookexperimental";
repo = "edencommon";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-pVPkH80vowdpwWv/h6ovEk335OeI6/0k0cAFhhFqSDM=";
};
patches = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
# Test discovery timeout is bizarrely flaky on `x86_64-darwin`
./increase-test-discovery-timeout.patch
];
nativeBuildInputs = [
cmake
ninja
removeReferencesTo
];
buildInputs =
[
glog
gflags
folly
fb303
wangle
fbthrift
gtest
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
apple-sdk_11
(darwinMinVersionHook "11.0")
];
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "CMAKE_INSTALL_RPATH_USE_LINK_PATH" true)
(lib.cmakeFeature "INCLUDE_INSTALL_DIR" "${placeholder "dev"}/include")
(lib.cmakeFeature "LIB_INSTALL_DIR" "${placeholder "out"}/lib")
(lib.cmakeFeature "CMAKE_INSTALL_DIR" "${placeholder "dev"}/lib/cmake/edencommon")
];
doCheck = true;
postPatch = ''
# The CMake build requires the FBThrift Python support even though
# its not used, presumably because of the relevant code having
# been moved in from another repository.
substituteInPlace CMakeLists.txt \
--replace-fail \
'find_package(FBThrift CONFIG REQUIRED COMPONENTS cpp2 py)' \
'find_package(FBThrift CONFIG REQUIRED COMPONENTS cpp2)'
'';
postFixup = ''
# Sanitize header paths to avoid runtime dependencies leaking in
# through `__FILE__`.
(
shopt -s globstar
for header in "$dev/include"/**/*.h; do
sed -i "1i#line 1 \"$header\"" "$header"
remove-references-to -t "$dev" "$header"
done
)
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Shared library for Meta's source control filesystem tools (EdenFS and Watchman)";
homepage = "https://github.com/facebookexperimental/edencommon";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
kylesferrazza
emily
techknowlogick
];
};
})