Libc (DragonFly): add support

This commit is contained in:
李通洲
2024-11-03 11:47:24 +08:00
parent 9610912c1f
commit 743babda10
3 changed files with 19 additions and 3 deletions
+8 -1
View File
@@ -1124,12 +1124,19 @@ if(APPLE AND EXISTS "/usr/bin/otool")
endif()
endif()
if(FreeBSD AND EXISTS "/usr/local/bin/objdump")
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[^ )]*' -o | sort -Vru | head -1"
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")
target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
if(DragonFly AND EXISTS "/usr/local/bin/objdump")
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'DF[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "DF([0-9]+\\.[0-9]+)")
target_compile_definitions(libfastfetch PUBLIC FF_DF_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
if(LINUX)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE _ATFILE_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 _TIME_BITS=64) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
+9 -2
View File
@@ -2,11 +2,18 @@
const char* ffDetectLibc(FFLibcResult* result)
{
#ifdef __DragonFly__ // We define `__FreeBSD__` on DragonFly BSD for simplification
result->name = "DF";
#ifdef FF_DF_VERSION
result->version = FF_DF_VERSION;
#endif
#elif __FreeBSD__
result->name = "FBSD";
#ifdef FF_FBSD_VERSION
#ifdef FF_FBSD_VERSION
result->version = FF_FBSD_VERSION;
#endif
#else
result->name = "Unknown";
result->version = NULL;
#endif
return NULL;
+2
View File
@@ -26,6 +26,8 @@
#define FF_SYSNAME "Android"
#elif defined(__linux__)
#define FF_SYSNAME "Linux"
#elif defined(__DragonFly__) // We define `__FreeBSD__` on DragonFly BSD for simplification
#define FF_SYSNAME "DragonFly"
#elif defined(__FreeBSD__)
#define FF_SYSNAME "FreeBSD"
#elif defined(__APPLE__)