Skip to content

Commit 743babd

Browse files
committed
Libc (DragonFly): add support
1 parent 9610912 commit 743babd

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,12 +1124,19 @@ if(APPLE AND EXISTS "/usr/bin/otool")
11241124
endif()
11251125
endif()
11261126
if(FreeBSD AND EXISTS "/usr/local/bin/objdump")
1127-
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[^ )]*' -o | sort -Vru | head -1"
1127+
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"
11281128
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
11291129
if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")
11301130
target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")
11311131
endif()
11321132
endif()
1133+
if(DragonFly AND EXISTS "/usr/local/bin/objdump")
1134+
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"
1135+
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
1136+
if("${OBJDUMP_T_RESULT}" MATCHES "DF([0-9]+\\.[0-9]+)")
1137+
target_compile_definitions(libfastfetch PUBLIC FF_DF_VERSION="${CMAKE_MATCH_1}")
1138+
endif()
1139+
endif()
11331140

11341141
if(LINUX)
11351142
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>"

src/detection/libc/libc_bsd.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
const char* ffDetectLibc(FFLibcResult* result)
44
{
5+
#ifdef __DragonFly__ // We define `__FreeBSD__` on DragonFly BSD for simplification
6+
result->name = "DF";
7+
#ifdef FF_DF_VERSION
8+
result->version = FF_DF_VERSION;
9+
#endif
10+
#elif __FreeBSD__
511
result->name = "FBSD";
6-
7-
#ifdef FF_FBSD_VERSION
12+
#ifdef FF_FBSD_VERSION
813
result->version = FF_FBSD_VERSION;
14+
#endif
915
#else
16+
result->name = "Unknown";
1017
result->version = NULL;
1118
#endif
1219
return NULL;

src/detection/version/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#define FF_SYSNAME "Android"
2727
#elif defined(__linux__)
2828
#define FF_SYSNAME "Linux"
29+
#elif defined(__DragonFly__) // We define `__FreeBSD__` on DragonFly BSD for simplification
30+
#define FF_SYSNAME "DragonFly"
2931
#elif defined(__FreeBSD__)
3032
#define FF_SYSNAME "FreeBSD"
3133
#elif defined(__APPLE__)

0 commit comments

Comments
 (0)