Skip to content

Commit

Permalink
Merge pull request #243 from h-vetinari/private
Browse files Browse the repository at this point in the history
Privatize zlib + friends; build shared on win; bump to 1.55, build with protobuf 4.23
  • Loading branch information
h-vetinari committed May 24, 2023
2 parents 6d4933a + 0a8c556 commit 04dcf68
Show file tree
Hide file tree
Showing 21 changed files with 684 additions and 88 deletions.
6 changes: 3 additions & 3 deletions .ci_support/linux_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ c_ares:
c_compiler:
- gcc
c_compiler_version:
- '11'
- '12'
cdt_name:
- cos6
channel_sources:
Expand All @@ -13,13 +13,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '11'
- '12'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
libabseil:
- '20230125'
libprotobuf:
- '3.21'
- '4.23'
openssl:
- '3'
pin_run_as_build:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_aarch64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ c_ares:
c_compiler:
- gcc
c_compiler_version:
- '11'
- '12'
cdt_arch:
- aarch64
cdt_name:
Expand All @@ -17,13 +17,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '11'
- '12'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
libabseil:
- '20230125'
libprotobuf:
- '3.21'
- '4.23'
openssl:
- '3'
pin_run_as_build:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_ppc64le_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ c_ares:
c_compiler:
- gcc
c_compiler_version:
- '11'
- '12'
cdt_name:
- cos7
channel_sources:
Expand All @@ -13,13 +13,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '11'
- '12'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
libabseil:
- '20230125'
libprotobuf:
- '3.21'
- '4.23'
openssl:
- '3'
pin_run_as_build:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cxx_compiler_version:
libabseil:
- '20230125'
libprotobuf:
- '3.21'
- '4.23'
macos_machine:
- x86_64-apple-darwin13.4.0
openssl:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cxx_compiler_version:
libabseil:
- '20230125'
libprotobuf:
- '3.21'
- '4.23'
macos_machine:
- arm64-apple-darwin20.0.0
openssl:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/win_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cxx_compiler:
libabseil:
- '20230125'
libprotobuf:
- '3.21'
- '4.23'
openssl:
- '3'
pin_run_as_build:
Expand Down
2 changes: 1 addition & 1 deletion conda-forge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bot:
abi_migration_branches:
- 1.52.x
- 1.54.x
build_platform:
linux_aarch64: linux_64
linux_ppc64le: linux_64
Expand Down
4 changes: 4 additions & 0 deletions recipe/build-cpp.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ cd build-cpp

cmake .. ^
-GNinja ^
-DBUILD_SHARED_LIBS=ON ^
-DCMAKE_CXX_STANDARD=17 ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%CONDA_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ^
-DProtobuf_PROTOC_EXECUTABLE=%LIBRARY_BIN%\protoc.exe ^
-DgRPC_MSVC_STATIC_RUNTIME=OFF ^
-DgRPC_ABSL_PROVIDER="package" ^
-DgRPC_CARES_PROVIDER="package" ^
-DgRPC_GFLAGS_PROVIDER="package" ^
Expand Down
6 changes: 2 additions & 4 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
c_compiler_version: # [linux]
- '11' # [linux]
cxx_compiler_version: # [linux]
- '11' # [linux]
libprotobuf:
- "4.23"
37 changes: 18 additions & 19 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "1.54.2" %}
{% set version = "1.55.0" %}

# core package & vendored libs use different version scheme than CPP libs, see
# https://github.com/grpc/grpc/blob/v1.48.1/CMakeLists.txt#L28-L32
Expand All @@ -18,18 +18,26 @@ package:
version: {{ version }}

source:
url: https://github.com/grpc/grpc/archive/v{{ version }}.tar.gz
sha256: 3c305f0ca5f98919bc104448f59177e7b936acd5c69c144bf4a548cad723e1e4
url: https://github.com/grpc/grpc/archive/v{{ version.replace(".pre", "-pre") }}.tar.gz
sha256: 9cf1a69a921534ac0b760dcbefb900f3c2f735f56070bf0536506913bb5bfd74
patches:
- patches/0001-windows-ssl-lib-names.patch # [win]
- patches/0002-fix-win-setup-cmds.patch # [win]
- patches/0003-Link-against-grpc.patch
- patches/0004-force-protoc-executable.patch
- patches/0005-switch-to-C-17-for-grpcio.patch
- patches/0006-fix-abseil-setup.patch
# mark c-ares, re2 & zlib as private, so they don't need to be found
# at runtime just to link to grp, see grpc/grpc#30838;
# not much point in marking baselibs or vendored libs (e.g. upb) as private
- patches/0007-mark-linkage-of-c-ares-re2-zlib-as-private.patch
# oh windows...
- patches/0008-add-GPR-GRPC-GRPCXX-UBP-_DLL-mechanism-for-missing-s.patch # [win]
- patches/0009-fix-support_enabled-for-windows.patch # [win]
- patches/0010-Fix-data-with-thread-storage-duration-may-not-have-d.patch # [win]

build:
number: 2
number: 0

outputs:
- name: libgrpc
Expand Down Expand Up @@ -61,8 +69,6 @@ outputs:
- zlib
run:
- ucrt # [win]
- openssl
- zlib
run_constrained:
# make sure we don't co-install with old version of previous package name
- grpc-cpp ={{ version }}
Expand All @@ -75,6 +81,8 @@ outputs:
- cmake
- ninja
- pkg-config
# only required for pkg-config test (which wants to find zlib.pc)
- zlib # [win]
files:
- hello.proto
- test_grpc.sh
Expand All @@ -84,15 +92,14 @@ outputs:
commands:
# libraries
{% for each_lib in core_libs + core_cpp_libs + vendored_libs %}
# presence of shared libs (unix)
# presence of shared libs
- test -f $PREFIX/lib/lib{{ each_lib }}.so # [linux]
- test -f $PREFIX/lib/lib{{ each_lib }}.dylib # [osx]
- if not exist %LIBRARY_BIN%\{{ each_lib }}.dll exit 1 # [win]
- if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win]

# absence of static libs (unix)
- test ! -f $PREFIX/lib/lib{{ each_lib }}.a # [unix]

# static libs on windows
- if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win]
{% endfor %}

# binaries
Expand All @@ -110,7 +117,6 @@ outputs:
{% endfor %}

# final CMake test to compile examples
# partially disabled on unix until libprotobuf-feedstock#127 & 128 are merged
- ./test_grpc.sh # [unix]
- ./test_grpc.bat # [win]

Expand All @@ -131,14 +137,7 @@ outputs:
- cython
- {{ pin_subpackage('libgrpc', exact=True) }}
- pthread-stubs # [linux]
# because the windows builds of libgrpc is static, we need _its_
# host dependencies here to be able to link correctly
- c-ares # [win]
- libabseil # [win]
- libprotobuf # [win]
- openssl # [win]
- re2 # [win]
- zlib # [win]
- zlib
run:
- python
- {{ pin_subpackage('libgrpc', exact=True) }}
Expand Down
11 changes: 4 additions & 7 deletions recipe/patches/0001-windows-ssl-lib-names.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From e0240fc049a39c26a277bee7271e52c5b8a3821f Mon Sep 17 00:00:00 2001
From 59ed62d5a90cc65599854f52f92918222e23ff8c Mon Sep 17 00:00:00 2001
From: Jonathan Helmus <jjhelmus@gmail.com>
Date: Mon, 17 Feb 2020 15:45:06 -0600
Subject: [PATCH 1/6] windows ssl lib names
Subject: [PATCH 01/10] windows ssl lib names

Co-Authored-By: Julien Schueller <schueller@phimeca.com>
Co-Authored-By: Nicholas Bollweg <nick.bollweg@gmail.com>
Expand All @@ -11,10 +11,10 @@ Co-Authored-By: Marius van Niekerk <marius.v.niekerk@gmail.com>
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 6501b43d61..2fb22df98c 100644
index c654d7d1c2..4c88c792cf 100644
--- a/setup.py
+++ b/setup.py
@@ -328,10 +328,10 @@ if "win32" in sys.platform:
@@ -330,10 +330,10 @@ if "win32" in sys.platform:
'ws2_32',
)
if BUILD_WITH_SYSTEM_OPENSSL:
Expand All @@ -29,6 +29,3 @@ index 6501b43d61..2fb22df98c 100644
if BUILD_WITH_SYSTEM_ZLIB:
EXTENSION_LIBRARIES += ('z',)
if BUILD_WITH_SYSTEM_CARES:
--
2.38.1.windows.1

15 changes: 6 additions & 9 deletions recipe/patches/0002-fix-win-setup-cmds.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ea69ffecf7e5af9c185ed627b091f36b8de75d41 Mon Sep 17 00:00:00 2001
From 8762068e71fd84e91c1fc4b7c47e79ab80cd027d Mon Sep 17 00:00:00 2001
From: Mike Sarahan <msarahan@gmail.com>
Date: Tue, 18 Feb 2020 13:53:05 -0600
Subject: [PATCH 2/6] fix win setup cmds
Subject: [PATCH 02/10] fix win setup cmds

Co-Authored-By: Julien Schueller <schueller@phimeca.com>
Co-Authored-By: Nicholas Bollweg <nick.bollweg@gmail.com>
Expand All @@ -13,7 +13,7 @@ Co-Authored-By: H. Vetinari <h.vetinari@gmx.com>
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/setup.py b/setup.py
index 2fb22df98c..633240302a 100644
index 4c88c792cf..e2e4fd3451 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,6 @@ from distutils.unixccompiler import UnixCCompiler
Expand All @@ -24,7 +24,7 @@ index 2fb22df98c..633240302a 100644
from distutils import extension as _extension
from distutils import util
import os
@@ -202,6 +201,9 @@ ENABLE_DOCUMENTATION_BUILD = _env_bool_value(
@@ -203,6 +202,9 @@ ENABLE_DOCUMENTATION_BUILD = _env_bool_value(


def check_linker_need_libatomic():
Expand All @@ -34,7 +34,7 @@ index 2fb22df98c..633240302a 100644
"""Test if linker on system needs libatomic."""
code_test = (b'#include <atomic>\n' +
b'int main() { return std::atomic<int64_t>{}; }')
@@ -246,10 +248,6 @@ if EXTRA_ENV_COMPILE_ARGS is None:
@@ -247,10 +249,6 @@ if EXTRA_ENV_COMPILE_ARGS is None:
EXTRA_ENV_COMPILE_ARGS += ' -D_ftime=_ftime32 -D_timeb=__timeb32 -D_ftime_s=_ftime32_s'
else:
EXTRA_ENV_COMPILE_ARGS += ' -D_ftime=_ftime64 -D_timeb=__timeb64'
Expand All @@ -45,7 +45,7 @@ index 2fb22df98c..633240302a 100644
elif "linux" in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv -fno-exceptions'
elif "darwin" in sys.platform:
@@ -262,6 +260,7 @@ if EXTRA_ENV_LINK_ARGS is None:
@@ -263,6 +261,7 @@ if EXTRA_ENV_LINK_ARGS is None:
if check_linker_need_libatomic():
EXTRA_ENV_LINK_ARGS += ' -latomic'
elif "win32" in sys.platform and sys.version_info < (3, 5):
Expand All @@ -66,6 +66,3 @@ index 6d8228ffa0..150bd70b6c 100644
try:
# TODO(lidiz) Remove the generated a.out for success tests.
cc = os.environ.get('CC', 'cc')
--
2.38.1.windows.1

15 changes: 6 additions & 9 deletions recipe/patches/0003-Link-against-grpc.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 2f7de924bad393e31bee46774c75378f9855d0f6 Mon Sep 17 00:00:00 2001
From 7ec86cc8780ad9b769c1b90ec0b85985e7ef3530 Mon Sep 17 00:00:00 2001
From: Marius van Niekerk <marius.v.niekerk@gmail.com>
Date: Mon, 13 Jun 2022 17:13:07 -0400
Subject: [PATCH 3/6] Link against grpc
Subject: [PATCH 03/10] Link against grpc

---
setup.py | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/setup.py b/setup.py
index 633240302a..776b190967 100644
index e2e4fd3451..2ba46090f7 100644
--- a/setup.py
+++ b/setup.py
@@ -170,6 +170,8 @@ BUILD_WITH_SYSTEM_ABSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ABSL', False)
@@ -171,6 +171,8 @@ BUILD_WITH_SYSTEM_ABSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ABSL', False)
BUILD_WITH_STATIC_LIBSTDCXX = _env_bool_value(
'GRPC_PYTHON_BUILD_WITH_STATIC_LIBSTDCXX', 'False')

Expand All @@ -20,7 +20,7 @@ index 633240302a..776b190967 100644
# For local development use only: This skips building gRPC Core and its
# dependencies, including protobuf and boringssl. This allows "incremental"
# compilation by first building gRPC Core using make, then building only the
@@ -340,6 +342,11 @@ if BUILD_WITH_SYSTEM_RE2:
@@ -342,6 +344,11 @@ if BUILD_WITH_SYSTEM_RE2:
if BUILD_WITH_SYSTEM_ABSL:
EXTENSION_LIBRARIES += tuple(
lib.stem[3:] for lib in pathlib.Path('/usr').glob('lib*/libabsl_*.so'))
Expand All @@ -32,7 +32,7 @@ index 633240302a..776b190967 100644

DEFINE_MACROS = (('_WIN32_WINNT', 0x600),)
asm_files = []
@@ -448,6 +455,9 @@ def cython_extensions_and_necessity():
@@ -450,6 +457,9 @@ def cython_extensions_and_necessity():
prefix + 'libgpr.a', prefix + 'libgrpc.a'
]
core_c_files = []
Expand All @@ -42,6 +42,3 @@ index 633240302a..776b190967 100644
else:
core_c_files = list(CORE_C_FILES)
extra_objects = []
--
2.38.1.windows.1

13 changes: 5 additions & 8 deletions recipe/patches/0004-force-protoc-executable.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 4f607605de2986861a59ceec2e26a17b9d9f6fcd Mon Sep 17 00:00:00 2001
From f1f45c4abb00ef7556371cc9bb3fcba56eea4f69 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <uwe.korn@quantco.com>
Date: Fri, 11 Sep 2020 14:20:04 +0200
Subject: [PATCH 4/6] force protoc executable
Subject: [PATCH 04/10] force protoc executable

---
cmake/protobuf.cmake | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/cmake/protobuf.cmake b/cmake/protobuf.cmake
index aff1d36526..0d295b5886 100644
index 80181c6218..96213e7523 100644
--- a/cmake/protobuf.cmake
+++ b/cmake/protobuf.cmake
@@ -75,21 +75,8 @@ elseif(gRPC_PROTOBUF_PROVIDER STREQUAL "package")
@@ -71,21 +71,8 @@ elseif(gRPC_PROTOBUF_PROVIDER STREQUAL "package")
set(_gRPC_PROTOBUF_PROTOC_LIBRARIES ${PROTOBUF_PROTOC_LIBRARIES})
set(_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIRS})
endif()
Expand All @@ -32,9 +32,6 @@ index aff1d36526..0d295b5886 100644
- endif()
+ set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE})
+ set(_gRPC_PROTOBUF_PROTOC ${Protobuf_PROTOC_EXECUTABLE})
set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()")
set(_gRPC_FIND_PROTOBUF "find_dependency(Protobuf CONFIG)")
endif()
endif()
--
2.38.1.windows.1

Loading

0 comments on commit 04dcf68

Please sign in to comment.