diff --git a/pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch b/pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch new file mode 100644 index 000000000000..0f83ba51870c --- /dev/null +++ b/pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch @@ -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) diff --git a/pkgs/by-name/nf/nfs-ganesha/package.nix b/pkgs/by-name/nf/nfs-ganesha/package.nix index c3b65eb37243..8825d169e0da 100644 --- a/pkgs/by-name/nf/nfs-ganesha/package.nix +++ b/pkgs/by-name/nf/nfs-ganesha/package.nix @@ -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; {