cpufetch: fix x86_64-darwin build (add sysctl.c on darwin too) (#528322)

This commit is contained in:
Michael Daniels
2026-06-14 01:12:58 +00:00
committed by GitHub
2 changed files with 20 additions and 0 deletions
@@ -0,0 +1,11 @@
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@
HEADERS += $(SRC_DIR)freq/freq.h
CFLAGS += -pthread
endif
- ifeq ($(os), FreeBSD)
+ ifneq (,$(filter $(os),FreeBSD Darwin))
SOURCE += $(SRC_COMMON)sysctl.c
HEADERS += $(SRC_COMMON)sysctl.h
endif
+9
View File
@@ -20,6 +20,15 @@ stdenv.mkDerivation (finalAttrs: {
installShellFiles
];
# Upstream Makefile bug: for x86 builds, sysctl.c is only added to
# SOURCE on FreeBSD even though cpuid.c calls get_sys_info_by_name
# (defined there) on darwin too. Without this the x86_64-darwin
# build fails to link with "Undefined symbols: _get_sys_info_by_name".
# Widen the conditional to cover Darwin alongside FreeBSD.
patches = lib.optionals stdenv.hostPlatform.isDarwin [
./darwin-x86-sysctl.patch
];
installPhase = ''
runHook preInstall