nfs-ganesha: Build with Ceph and DBus support (#432492)

This commit is contained in:
Markus Kowalewski
2025-09-03 21:21:36 +02:00
committed by GitHub
2 changed files with 77 additions and 3 deletions
@@ -0,0 +1,44 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 73276dff6..94027f5cb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -974,21 +974,27 @@ endif(USE_EFENCE)
gopt_test(USE_DBUS)
if(USE_DBUS)
- find_package(PkgConfig)
- # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves
- pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1)
- if(NOT DBUS_FOUND)
- if(USE_DBUS_REQUIRED)
- message(FATAL_ERROR "Cannot find DBUS libs but requested on command line")
- else(USE_DBUS_REQUIRED)
- message(WARNING "Cannot find DBUS libs. Disabling DBUS support")
- set(USE_DBUS OFF)
- endif(USE_DBUS_REQUIRED)
- else(NOT DBUS_FOUND)
+ if(DBUS_NO_PKGCONFIG)
set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES})
LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS})
link_directories (${DBUS_LIBRARY_DIRS})
- endif(NOT DBUS_FOUND)
+ else(DBUS_NO_PKGCONFIG)
+ find_package(PkgConfig)
+ # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves
+ pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1)
+ if(NOT DBUS_FOUND)
+ if(USE_DBUS_REQUIRED)
+ message(FATAL_ERROR "Cannot find DBUS libs but requested on command line")
+ else(USE_DBUS_REQUIRED)
+ message(WARNING "Cannot find DBUS libs. Disabling DBUS support")
+ set(USE_DBUS OFF)
+ endif(USE_DBUS_REQUIRED)
+ else(NOT DBUS_FOUND)
+ set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES})
+ LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS})
+ link_directories (${DBUS_LIBRARY_DIRS})
+ endif(NOT DBUS_FOUND)
+ endif(DBUS_NO_PKGCONFIG)
endif(USE_DBUS)
if(USE_CB_SIMULATOR AND NOT USE_DBUS)
+33 -3
View File
@@ -8,7 +8,6 @@
krb5,
xfsprogs,
jemalloc,
dbus,
libcap,
ntirpc,
liburcu,
@@ -16,6 +15,10 @@
flex,
nfs-utils,
acl,
useCeph ? false,
ceph,
useDbus ? true,
dbus,
}:
stdenv.mkDerivation rec {
@@ -35,6 +38,8 @@ stdenv.mkDerivation rec {
hash = "sha256-OHGmEzHu8y/TPQ70E2sicaLtNgvlf/bRq8JRs6S1tpY=";
};
patches = lib.optional useDbus ./allow-bypassing-dbus-pkg-config-test.patch;
preConfigure = "cd src";
cmakeFlags = [
@@ -44,6 +49,19 @@ stdenv.mkDerivation rec {
"-DUSE_ACL_MAPPING=ON"
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
"-DUSE_MAN_PAGE=ON"
]
++ lib.optionals useCeph [
"-DUSE_RADOS_RECOV=ON"
"-DRADOS_URLS=ON"
"-DUSE_FSAL_CEPH=ON"
"-DUSE_FSAL_RGW=ON"
]
++ lib.optionals useDbus [
"-DUSE_DBUS=ON"
"-DDBUS_NO_PKGCONFIG=ON"
"-DDBUS_LIBRARY_DIRS=${lib.getLib dbus}/lib"
"-DDBUS_INCLUDE_DIRS=${lib.getDev dbus}/include/dbus-1.0\\;${lib.getLib dbus}/lib/dbus-1.0/include"
"-DDBUS_LIBRARIES=dbus-1"
];
nativeBuildInputs = [
@@ -52,7 +70,8 @@ stdenv.mkDerivation rec {
bison
flex
sphinx
];
]
++ lib.optional useDbus dbus;
buildInputs = [
acl
@@ -64,7 +83,8 @@ stdenv.mkDerivation rec {
ntirpc
liburcu
nfs-utils
];
]
++ lib.optional useCeph ceph;
postPatch = ''
substituteInPlace src/tools/mount.9P --replace "/bin/mount" "/usr/bin/env mount"
@@ -72,10 +92,20 @@ stdenv.mkDerivation rec {
postFixup = ''
patchelf --add-rpath $out/lib $out/bin/ganesha.nfsd
patchelf --add-rpath $out/lib $out/lib/libganesha_nfsd.so
''
+ lib.optionalString useCeph ''
patchelf --add-rpath $out/lib $out/bin/ganesha-rados-grace
patchelf --add-rpath $out/lib $out/lib/libganesha_rados_recov.so
patchelf --add-rpath $out/lib $out/lib/libganesha_rados_urls.so
'';
postInstall = ''
install -Dm755 $src/src/tools/mount.9P $tools/bin/mount.9P
''
+ lib.optionalString useDbus ''
# Policy for D-Bus statistics interface
install -Dm644 $src/src/scripts/ganeshactl/org.ganesha.nfsd.conf $out/etc/dbus-1/system.d/org.ganesha.nfsd.conf
'';
meta = with lib; {