Files
nixpkgs/pkgs/by-name/cp/cpufetch/darwin-x86-sysctl.patch
phibkro 2a1cae7c67 cpufetch: fix x86_64-darwin build (add sysctl.c on Darwin too)
The Hydra failure on x86_64-darwin (build 330211579) bails at link
time with:

    Undefined symbols for architecture x86_64:
      "_get_sys_info_by_name", referenced from:
          _get_frequency_info in cpuid-XXX.o

`get_sys_info_by_name` is defined in `src/common/sysctl.c` and called
from `src/x86/cpuid.c:979` (for CPU-frequency detection via sysctl).
Upstream's Makefile adds `sysctl.c` to SOURCE only inside the
`ifeq ($(os), FreeBSD)` block of the x86 branch — Darwin x86_64
falls through without the source, so the link breaks.

Widen the conditional to `$(filter $(os),FreeBSD Darwin)`. Patched
via a small .patch file (cleaner than escaping `$$` through nix +
bash + make). Build now compiles `src/common/sysctl.c` and links
cleanly; `cpufetch` runs on macOS 15.6.1 Sequoia and prints the
Intel banner.

x86_64-linux unaffected — `patches` only applies on darwin.

Fixes https://hydra.nixos.org/build/330211579

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-05 11:49:36 +02:00

12 lines
267 B
Diff

--- 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