Libc (macOS): detect libSystem version

This commit is contained in:
李通洲
2023-10-09 10:43:58 +08:00
parent 1188db9475
commit 430da1578d
2 changed files with 21 additions and 1 deletions
+8 -1
View File
@@ -546,7 +546,7 @@ elseif(APPLE)
src/detection/host/host_apple.c
src/detection/lm/lm_nosupport.c
src/detection/icons/icons_nosupport.c
src/detection/libc/libc_nosupport.c
src/detection/libc/libc_apple.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_apple.c
src/detection/media/media_apple.m
@@ -670,6 +670,13 @@ if(LINUX AND EXISTS "/lib/ld-musl-${CMAKE_HOST_SYSTEM_PROCESSOR}.so.1")
target_compile_definitions(libfastfetch PUBLIC FF_MUSL_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
if(APPLE AND EXISTS "/usr/bin/otool")
execute_process(COMMAND /usr/bin/otool -L /usr/bin/otool
OUTPUT_VARIABLE OTOOL_OTOOL_RESULT)
if("${OTOOL_OTOOL_RESULT}" MATCHES "libSystem\\.B\\.dylib \\(.*current version ([0-9]+\\.[0-9]+\\.[0-9]+)\\)")
target_compile_definitions(libfastfetch PUBLIC FF_LIBSYSTEM_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1)
if(WIN32)
+13
View File
@@ -0,0 +1,13 @@
#include "libc.h"
const char* ffDetectLibc(FFLibcResult* result)
{
result->name = "libSystem";
#ifdef FF_LIBSYSTEM_VERSION
result->version = FF_LIBSYSTEM_VERSION;
#else
result->version = NULL;
#endif
return NULL;
}