Skip to content

Commit

Permalink
privatize grpc_unsecure linkage as well
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Aug 16, 2022
1 parent ed44ce8 commit 78a0672
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ source:
patches:
- force-protoc-executable.patch
- patches-grpc/0001-Link-libraries-privately.patch
- patches-grpc/0002-privatize-dlls-for-grpc_unsecure-as-well.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
2 changes: 1 addition & 1 deletion recipe/patches-grpc/0001-Link-libraries-privately.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 83c00ca57c5328b8f5ab1202bfaf2a9f43857d15 Mon Sep 17 00:00:00 2001
From: Mark Harfouche <[email protected]>
Date: Mon, 15 Aug 2022 15:24:27 -0400
Subject: [PATCH] Link libraries privately
Subject: [PATCH 1/2] Link libraries privately

---
CMakeLists.txt | 46 ++++++++++++++++++++++++++++------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From 6a10b878747d9bcdb12b298612ea986d63cf997a Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Tue, 16 Aug 2022 17:55:55 +0200
Subject: [PATCH 2/2] privatize dlls for grpc_unsecure as well

---
CMakeLists.txt | 44 +++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0523d72316..8a7a34996d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2729,25 +2729,35 @@ 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
+ PRIVATE ${_gRPC_BASELIB_LIBRARIES}
+ PRIVATE ${_gRPC_ZLIB_LIBRARIES}
+ PRIVATE ${_gRPC_CARES_LIBRARIES}
+ PRIVATE ${_gRPC_ADDRESS_SORTING_LIBRARIES}
+ PRIVATE ${_gRPC_RE2_LIBRARIES}
+ PRIVATE ${_gRPC_UPB_LIBRARIES}
+ PRIVATE ${_gRPC_ALLTARGETS_LIBRARIES}
+ PRIVATE absl::flat_hash_map
+ PRIVATE absl::inlined_vector
+ PRIVATE absl::bind_front
+ PRIVATE absl::hash
+ PRIVATE absl::statusor
+ PRIVATE absl::variant
+ PRIVATE absl::utility
+ PRIVATE gpr
+ PRIVATE address_sorting
)
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC)
- target_link_libraries(grpc_unsecure "-framework CoreFoundation")
+ find_library(FRAMEWORK_CoreFoundation
+ NAMES CoreFoundation
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library
+ PATH_SUFFIXES Frameworks
+ NO_DEFAULT_PATH)
+ if( ${FRAMEWORK_CoreFoundation} STREQUAL FRAMEWORK_CoreFoundation-NOTFOUND)
+ MESSAGE(ERROR ": Framework CoreFoundation not found")
+ else()
+ target_link_libraries(grpc_unsecure PUBLIC "${FRAMEWORK_CoreFoundation}")
+ MESSAGE(STATUS "Framework CoreFoundation found at ${FRAMEWORK_CoreFoundation}")
+ endif()
endif()

foreach(_hdr
--
2.37.0.windows.1

0 comments on commit 78a0672

Please sign in to comment.