From 77c096db792d8e4f39d2e5e2493813606bff8170 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?=
<1175054+carlossanlop@users.noreply.github.com>
Date: Thu, 11 Jul 2024 20:41:23 -0700
Subject: [PATCH] zlib-ng patch for build failure caught in sdk but not in
runtime
---
...build-failure-caught-in-the-sdk-repo.patch | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 src/SourceBuild/patches/runtime/0001-Fix-zlib-ng-build-failure-caught-in-the-sdk-repo.patch
diff --git a/src/SourceBuild/patches/runtime/0001-Fix-zlib-ng-build-failure-caught-in-the-sdk-repo.patch b/src/SourceBuild/patches/runtime/0001-Fix-zlib-ng-build-failure-caught-in-the-sdk-repo.patch
new file mode 100644
index 000000000000..f107d5692068
--- /dev/null
+++ b/src/SourceBuild/patches/runtime/0001-Fix-zlib-ng-build-failure-caught-in-the-sdk-repo.patch
@@ -0,0 +1,57 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?=
+ <1175054+carlossanlop@users.noreply.github.com>
+Date: Thu, 11 Jul 2024 11:28:54 -0700
+Subject: [PATCH] Fix zlib-ng build failure caught in the sdk repo.
+
+---
+ .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 4 ++--
+ .../libs/System.IO.Compression.Native/CMakeLists.txt | 7 ++++++-
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
+index 3ff044e94d9..107e7b1209e 100644
+--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
++++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
+@@ -24,7 +24,7 @@ The .NET Foundation licenses this file to you under the MIT license.
+ lld
+ bfd
+ 1572864
+- true
++ true
+
+
+
+@@ -130,13 +130,13 @@ The .NET Foundation licenses this file to you under the MIT license.
+
+
+
+-
+
+
+
+
+
+
++
+
+
+
+diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt
+index 69d333ae53f..7fa92062d8e 100644
+--- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt
++++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt
+@@ -184,7 +184,12 @@ else ()
+ endif ()
+
+ if((NOT CLR_CMAKE_USE_SYSTEM_ZLIB) AND STATIC_LIBS_ONLY)
+- install_static_library(zlib aotsdk nativeaot)
++ if (CLR_CMAKE_TARGET_UNIX)
++ # zlib on Unix needs to be installed in the same location as System.IO.Compression.Native so that we can then treat is as a 'z' native library.
++ install_static_library(zlib ${STATIC_LIB_DESTINATION} nativeaot)
++ else()
++ install_static_library(zlib aotsdk nativeaot)
++ endif()
+ endif()
+
+ install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs)