Skip to content

Commit

Permalink
Merge pull request #213 from hmaarrfk/1.46.x_with-zlib_private
Browse files Browse the repository at this point in the history
1.46.x with zlib & abseil as private
  • Loading branch information
h-vetinari authored Aug 28, 2022
2 parents 006fe4d + 636eb6e commit 1d65621
Show file tree
Hide file tree
Showing 4 changed files with 885 additions and 13 deletions.
29 changes: 16 additions & 13 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ source:
sha256: e266aa0d9d9cddb876484a370b94f468248594a96ca0b6f87c21f969db2b8c5b
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]
- patches-grpcio/0001-fix-win-commands.patch # [win]
- patches-grpcio/0001-fix-win-setup.patch # [win]

build:
number: 3
number: 4

outputs:
- name: grpc-cpp
Expand All @@ -34,28 +40,24 @@ outputs:
- libprotobuf
- ninja
# We need all host deps also in build for cross-compiling
- libabseil 20211102.0 # [build_platform != target_platform]
- libabseil # [build_platform != target_platform]
- c-ares # [build_platform != target_platform]
- re2 # [build_platform != target_platform]
- openssl # [build_platform != target_platform]
- zlib # [build_platform != target_platform]
host:
- libabseil 20211102.0 # [unix]
- libabseil # [unix]
# windows not ready for C++17 of shared abseil builds yet;
# keep one line unpinned for migrator to pick it up
- libabseil-static 20211102.0 # [win]
- libabseil-static =20211102.0=cxx11* # [win]
- libabseil-static # [win]
- libabseil-static =*=cxx11* # [win]
- c-ares
- libprotobuf
- re2
- openssl
- zlib
run:
- ucrt # [win]
# the following should not be necessary, but grpc currently
# sets zlib & abseil as non-private
- libabseil-static =20211102.0=cxx11* # [win]
- zlib
test:
requires:
# cmake needs compiler to be able to run package detection, see
Expand All @@ -78,7 +80,7 @@ outputs:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- cython # [build_platform != target_platform]
- libabseil 20211102.0 # [build_platform != target_platform]
- libabseil # [build_platform != target_platform]
- {{ compiler('c') }}
- {{ compiler('cxx') }}
host:
Expand All @@ -87,16 +89,17 @@ outputs:
- setuptools
- cython
- six >=1.6.0
- libabseil 20211102.0 # [unix]
- libabseil # [unix]
# windows not ready for C++17 of shared abseil builds yet;
# keep one line unpinned for migrator to pick it up
- libabseil-static 20211102.0 # [win]
- libabseil-static =20211102.0=cxx11* # [win]
- libabseil-static # [win]
- libabseil-static =*=cxx11* # [win]
- {{ pin_subpackage('grpc-cpp', exact=True) }}
- c-ares
- libprotobuf
- re2
- openssl
- zlib
- pthread-stubs # [linux]
run:
- python
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 1d65621

Please sign in to comment.