Skip to content

Commit

Permalink
Ensure that zlib & abseil are linked privately
Browse files Browse the repository at this point in the history
take status of patches for 1.46.x from conda-forge#213
  • Loading branch information
hmaarrfk authored and h-vetinari committed Aug 23, 2022
1 parent 0761e97 commit 0df1806
Show file tree
Hide file tree
Showing 4 changed files with 875 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ source:
sha256: ba7c36989ad8a52c813adeebb0c65869283448f496dbb2868c75f69941dec6a9
patches:
- force-protoc-executable.patch
# no point in marking baselibs or vendored libs (e.g. upb) as private
- patches-grpc/0001-mark-linkage-of-c-ares-openssl-re2-zlib-as-private.patch
# since grpc uses internal abseil targets and we're already building
# against shared abseil on unix anyway, only make private on win
- patches-grpc/0002-mark-abseil-linkage-as-private.patch # [win]
- patches-grpc/0003-add-missing-gpr-linkage-for-grpc_csharp_ext.patch
- patches-grpcio/0001-Monkey-patch-distutils.ccompiler.spawn-to-elide-std-.patch
- patches-grpcio/0002-Link-against-grpc.patch
- patches-grpcio/0003-windows-ssl-lib-names.patch # [win]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
From bea431a8728ddd3a02337caee5765298bb9cf00b Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Tue, 23 Aug 2022 11:45:20 +0200
Subject: [PATCH 1/3] mark linkage of c-ares/openssl/re2/zlib as private

Co-Authored-By: Mark Harfouche <[email protected]>
---
CMakeLists.txt | 78 ++++++++++++++++++++++++++++----------------------
1 file changed, 43 insertions(+), 35 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bfbcd4c6b..c28168f050 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2137,26 +2137,30 @@ target_include_directories(grpc
${_gRPC_ZLIB_INCLUDE_DIR}
)
target_link_libraries(grpc
- ${_gRPC_BASELIB_LIBRARIES}
- ${_gRPC_ZLIB_LIBRARIES}
- ${_gRPC_CARES_LIBRARIES}
- ${_gRPC_ADDRESS_SORTING_LIBRARIES}
- ${_gRPC_RE2_LIBRARIES}
- ${_gRPC_UPB_LIBRARIES}
- ${_gRPC_ALLTARGETS_LIBRARIES}
- absl::flat_hash_map
- absl::inlined_vector
- absl::bind_front
- absl::hash
- absl::statusor
- absl::variant
- absl::utility
- gpr
- ${_gRPC_SSL_LIBRARIES}
- address_sorting
+ # core libs
+ PUBLIC ${_gRPC_ALLTARGETS_LIBRARIES}
+ PUBLIC ${_gRPC_BASELIB_LIBRARIES}
+ # vendored libs
+ PUBLIC ${_gRPC_ADDRESS_SORTING_LIBRARIES}
+ PUBLIC ${_gRPC_UPB_LIBRARIES}
+ # external dependencies used within grpc
+ PRIVATE ${_gRPC_CARES_LIBRARIES}
+ PRIVATE ${_gRPC_RE2_LIBRARIES}
+ PRIVATE ${_gRPC_SSL_LIBRARIES}
+ PRIVATE ${_gRPC_ZLIB_LIBRARIES}
+ # external dependencies that need to available at runtime
+ PUBLIC absl::flat_hash_map
+ PUBLIC absl::inlined_vector
+ PUBLIC absl::bind_front
+ PUBLIC absl::hash
+ PUBLIC absl::statusor
+ PUBLIC absl::variant
+ PUBLIC absl::utility
+ # targets which belong to grpc anyway
+ PUBLIC gpr
)
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC)
- target_link_libraries(grpc "-framework CoreFoundation")
+ target_link_libraries(grpc PUBLIC "-framework CoreFoundation")
endif()

foreach(_hdr
@@ -2719,25 +2723,29 @@ target_include_directories(grpc_unsecure
${_gRPC_ZLIB_INCLUDE_DIR}
)
target_link_libraries(grpc_unsecure
- ${_gRPC_BASELIB_LIBRARIES}
- ${_gRPC_ZLIB_LIBRARIES}
- ${_gRPC_CARES_LIBRARIES}
- ${_gRPC_ADDRESS_SORTING_LIBRARIES}
- ${_gRPC_RE2_LIBRARIES}
- ${_gRPC_UPB_LIBRARIES}
- ${_gRPC_ALLTARGETS_LIBRARIES}
- absl::flat_hash_map
- absl::inlined_vector
- absl::bind_front
- absl::hash
- absl::statusor
- absl::variant
- absl::utility
- gpr
- address_sorting
+ # core libs
+ PUBLIC ${_gRPC_ALLTARGETS_LIBRARIES}
+ PUBLIC ${_gRPC_BASELIB_LIBRARIES}
+ # vendored libs
+ PUBLIC ${_gRPC_ADDRESS_SORTING_LIBRARIES}
+ PUBLIC ${_gRPC_UPB_LIBRARIES}
+ # external dependencies used within grpc
+ PRIVATE ${_gRPC_CARES_LIBRARIES}
+ PRIVATE ${_gRPC_RE2_LIBRARIES}
+ PRIVATE ${_gRPC_ZLIB_LIBRARIES}
+ # external dependencies that need to available at runtime
+ PUBLIC absl::flat_hash_map
+ PUBLIC absl::inlined_vector
+ PUBLIC absl::bind_front
+ PUBLIC absl::hash
+ PUBLIC absl::statusor
+ PUBLIC absl::variant
+ PUBLIC absl::utility
+ # targets which belong to grpc anyway
+ PUBLIC gpr
)
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC)
- target_link_libraries(grpc_unsecure "-framework CoreFoundation")
+ target_link_libraries(grpc_unsecure PUBLIC "-framework CoreFoundation")
endif()

foreach(_hdr
--
2.37.0.windows.1

Loading

0 comments on commit 0df1806

Please sign in to comment.