mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
parent
a312d7310b
commit
84dcdc352c
@ -6,6 +6,7 @@
|
||||
|
||||
cmake,
|
||||
ninja,
|
||||
removeReferencesTo,
|
||||
|
||||
openssl,
|
||||
gflags,
|
||||
@ -27,6 +28,14 @@ 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";
|
||||
@ -34,9 +43,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
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 =
|
||||
@ -69,6 +85,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# TODO: Can’t 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
|
||||
@ -76,6 +97,18 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
(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
|
||||
)
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Facebook's branch of Apache Thrift";
|
||||
mainProgram = "thrift1";
|
||||
|
12
pkgs/by-name/fb/fbthrift/remove-cmake-install-rpath.patch
Normal file
12
pkgs/by-name/fb/fbthrift/remove-cmake-install-rpath.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c6b2b2a810..497dcd3d94 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -39,7 +39,6 @@
|
||||
set(CMAKE_INSTALL_DIR lib/cmake/fbthrift CACHE STRING
|
||||
"The subdirectory where CMake package config files should be installed")
|
||||
|
||||
-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
# Add root dir so qualified includes work, e.g. #include "thrift/compiler/*.h".
|
Loading…
Reference in New Issue
Block a user