authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-18 04:35:34+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-18 04:35:34+02:00
log4812a98ce535e5c3f27c081b94153612cd4817ac
treef175ad9bd4b4574ba1d8c385f63bd0a75cae648c
parent3a5777b6b10927eca53ae1e607011a9779f2e7b1
parent1797101fdacc6b56c0778501d076cb75bb6434d6

Merge pull request 'cmake: detect glibc and set `ZIG_HOST_TARGET_ABI` accordingly' (#37305) from alexrp/zig:cmake-glibc into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37305

2 files changed, 16 insertions(+), 3 deletions(-)

CMakeLists.txt+11
...@@ -601,6 +601,17 @@ elseif(ZIG_HOST_TARGET_IS_ANDROID)...@@ -601,6 +601,17 @@ elseif(ZIG_HOST_TARGET_IS_ANDROID)
601 else()601 else()
602 set(ZIG_HOST_TARGET_ABI "-android")602 set(ZIG_HOST_TARGET_ABI "-android")
603 endif()603 endif()
604else()
605 check_symbol_exists(__GLIBC__ "features.h" ZIG_HOST_TARGET_IS_GLIBC)
606 if(ZIG_HOST_TARGET_IS_GLIBC)
607 if(ZIG_HOST_TARGET_ARCH MATCHES "^arm(eb)?$" OR ZIG_HOST_TARGET_ARCH MATCHES "^thumb(eb)?$" OR ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(le)?$")
608 set(ZIG_HOST_TARGET_ABI "-gnueabihf")
609 elseif(ZIG_HOST_TARGET_ARCH MATCHES "^mips(el)?$")
610 set(ZIG_HOST_TARGET_ABI "-gnueabi")
611 else()
612 set(ZIG_HOST_TARGET_ABI "-gnu")
613 endif()
614 endif()
604endif()615endif()
605616
606set(ZIG_HOST_TARGET_TRIPLE "${ZIG_HOST_TARGET_ARCH}-${ZIG_HOST_TARGET_OS}${ZIG_HOST_TARGET_ABI}" CACHE STRING "Host zig target triple.")617set(ZIG_HOST_TARGET_TRIPLE "${ZIG_HOST_TARGET_ARCH}-${ZIG_HOST_TARGET_OS}${ZIG_HOST_TARGET_ABI}" CACHE STRING "Host zig target triple.")
lib/std/Target.zig+5-3
...@@ -859,6 +859,8 @@ pub const Abi = enum {...@@ -859,6 +859,8 @@ pub const Abi = enum {
859 .armeb,859 .armeb,
860 .powerpc,860 .powerpc,
861 .powerpcle,861 .powerpcle,
862 .sh,
863 .sheb,
862 .thumb,864 .thumb,
863 .thumbeb,865 .thumbeb,
864 => .musleabihf,866 => .musleabihf,
...@@ -873,21 +875,21 @@ pub const Abi = enum {...@@ -873,21 +875,21 @@ pub const Abi = enum {
873 .alpha,875 .alpha,
874 .arc,876 .arc,
875 .arceb,877 .arceb,
876 .or1k,878 .loongarch32,
877 .sparc,879 .sparc,
878 .sparc64,880 .sparc64,
879 => .gnu,881 => .gnu,
880 .csky,882 .csky,
881 => .gnueabi,883 => .gnueabi,
882 .hppa,884 .hppa,
883 .sh,
884 .sheb,
885 => .gnueabihf,885 => .gnueabihf,
886886
887 // No glibc or musl support.887 // No glibc or musl support.
888 .xtensa,888 .xtensa,
889 .xtensaeb,889 .xtensaeb,
890 => .none,890 => .none,
891 .hppa64,
892 => .eabihf,
891893
892 else => .musl,894 else => .musl,
893 },895 },