Zpool: allows disabling module

This commit is contained in:
李通洲
2025-12-01 17:17:46 +08:00
parent 5e27ee0f57
commit ce7455d8f0
2 changed files with 21 additions and 1 deletions
+10 -1
View File
@@ -106,6 +106,7 @@ option(INSTALL_LICENSE "Install license into /usr/share/licenses" ON)
option(ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF)
option(ENABLE_EMBEDDED_AMDGPUIDS "Embed amdgpu.ids into fastfetch, requires `python`" OFF)
option(ENABLE_WORDEXP "Enable using of wordexp(3) if available, instead of glob(3)" ON)
option(ENABLE_ZFS "Enable libzfs" ON)
set(BINARY_LINK_TYPE_OPTIONS dlopen dynamic static)
set(BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch")
@@ -1615,6 +1616,15 @@ endif()
if(ENABLE_EMBEDDED_AMDGPUIDS)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_EMBEDDED_AMDGPUIDS=1)
endif()
if(ENABLE_LIBZFS)
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
target_link_libraries(libfastfetch
PRIVATE "zfs"
)
endif()
endif()
if(LINUX)
target_link_libraries(libfastfetch
@@ -1705,7 +1715,6 @@ elseif(SunOS)
PRIVATE "socket"
PRIVATE "kstat"
PRIVATE "proc"
PRIVATE "nvpair"
PRIVATE "devinfo"
)
elseif(GNU)
+11
View File
@@ -1,5 +1,7 @@
#include "zpool.h"
#if FF_HAVE_LIBZFS
#include "util/kmod.h"
#ifdef __sun
@@ -113,3 +115,12 @@ const char* ffDetectZpool(FFlist* result /* list of FFZpoolResult */)
return NULL;
}
#else
const char* ffDetectZpool(FF_MAYBE_UNUSED FFlist* result)
{
return "fastfetch was compiled without libzfs support";
}
#endif