-- Enable darwin build and disable TUN-based features on FreeBSD.
--
-- This patch ensures GOOS is correctly set for macOS and that features
-- requiring TUN/TAP or gVisor are disabled on FreeBSD as they are not yet
-- fully supported or integrated in the same way.
--- core/CMakeLists.txt.orig	2026-06-04 03:56:20 UTC
+++ core/CMakeLists.txt
@@ -42,6 +42,8 @@ if (GOOS STREQUAL "")
         set(GOOS "linux")
     elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
         set(GOOS "freebsd")
+    elseif(APPLE)
+        set(GOOS "darwin")
     else()
         set(GOOS "")
     endif()
@@ -184,13 +186,15 @@ message(STATUS "DESTINATION IS ${DESTDIR} FOR MACHINE 
 # ----------------------------
 # Tags
 # ----------------------------
-set(TAGS "with_clash_api,with_quic,with_wireguard,with_utls,with_dhcp,with_tailscale,with_shadowtls,with_grpc,with_acme,with_awg")
+set(TAGS "with_clash_api,with_quic,with_utls,with_grpc,with_acme")
 
 if(NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
-    set(TAGS "${TAGS},with_gvisor")
+    set(TAGS "${TAGS},with_gvisor,with_wireguard,with_dhcp,with_tailscale,with_shadowtls,with_awg")
     if(GOARCH STREQUAL "arm64" OR GOARCH STREQUAL "amd64")
         set(TAGS "${TAGS},with_naive,with_naive_outbound,with_purego")
     endif()
+else()
+    message(STATUS "FreeBSD: disabling TUN-based and gVisor features")
 endif()
 
 file(MAKE_DIRECTORY "${DESTDIR}")
