[zlib] Add -fno-define-target-os-macros

Bug: 321109569
Change-Id: I789de0a91ac072eeadc29f736edf06452de10f17
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/zlib/+/982300
Reviewed-by: Gulfem Savrun Yeniceri <gulfem@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 390daae..6e80b7a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -41,6 +41,13 @@
   ]
 }
 
+# TODO(https://fxbug.dev/321109569): Remove once the build issue in zlib is resolved.
+config("zlib_mac_config") {
+  if (host_os == "mac") {
+    cflags = [ "-fno-define-target-os-macros" ]
+  }
+}
+
 # TODO(36315): Remove workaround for Rust host_toolchain
 config("zlib_config_for_rust_host") {
   # Without `-fPIC`, we get the error:
@@ -101,7 +108,10 @@
       "zutil.h",
     ]
 
-    configs += [ ":zlib_warnings" ]
+    configs += [
+      ":zlib_warnings",
+      ":zlib_mac_config",
+    ]
     configs -= [ "//build/config:symbol_visibility_hidden" ]
 
     public_configs = [ ":zlib_config" ]