From 7722b75808c719ef5d79bec3adca805ffdd7337f Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 13 Sep 2024 02:01:11 +0200 Subject: [PATCH] depends: protobuf: update to 29.3 --- CMakeLists.txt | 3 ++ contrib/depends/packages/abseil.mk | 27 +++++++++++++++++ contrib/depends/packages/native_abseil.mk | 18 +++++++++++ contrib/depends/packages/native_protobuf.mk | 30 +++++++++++-------- contrib/depends/packages/packages.mk | 4 +-- contrib/depends/packages/protobuf.mk | 26 +++++++++------- contrib/depends/patches/abseil/no_librt.patch | 12 ++++++++ contrib/depends/toolchain.cmake.in | 7 ++--- 8 files changed, 98 insertions(+), 29 deletions(-) create mode 100644 contrib/depends/packages/abseil.mk create mode 100644 contrib/depends/packages/native_abseil.mk create mode 100644 contrib/depends/patches/abseil/no_librt.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1bf1a94..20e0e233f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,9 @@ include(CheckFunctionExists) if (POLICY CMP0148) cmake_policy(SET CMP0148 OLD) # https://cmake.org/cmake/help/latest/policy/CMP0148.html endif() +if (POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0074.html +endif() include(FindPythonInterp) if (IOS) diff --git a/contrib/depends/packages/abseil.mk b/contrib/depends/packages/abseil.mk new file mode 100644 index 000000000..f0f2f3ff9 --- /dev/null +++ b/contrib/depends/packages/abseil.mk @@ -0,0 +1,27 @@ +package=abseil +$(package)_version=$(native_$(package)_version) +$(package)_download_path=$(native_$(package)_download_path) +$(package)_download_file=$(native_$(package)_download_file) +$(package)_file_name=$(native_$(package)_file_name) +$(package)_sha256_hash=$(native_$(package)_sha256_hash) +$(package)_patches=no_librt.patch + +define $(package)_set_vars + $(package)_cxxflags+=-std=c++17 +endef + +define $(package)_preprocess_cmds + patch -p1 -i $($(package)_patch_dir)/no_librt.patch +endef + +define $(package)_config_cmds + $($(package)_cmake) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef diff --git a/contrib/depends/packages/native_abseil.mk b/contrib/depends/packages/native_abseil.mk new file mode 100644 index 000000000..d914fe12a --- /dev/null +++ b/contrib/depends/packages/native_abseil.mk @@ -0,0 +1,18 @@ +package=native_abseil +$(package)_version=20240722.0 +$(package)_download_path=https://github.com/abseil/abseil-cpp/archive/refs/tags/ +$(package)_download_file=$($(package)_version).tar.gz +$(package)_file_name=abseil-$($(package)_version).tar.gz +$(package)_sha256_hash=f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3 + +define $(package)_config_cmds + $($(package)_cmake) +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef diff --git a/contrib/depends/packages/native_protobuf.mk b/contrib/depends/packages/native_protobuf.mk index 8d7649b67..a134ca03e 100644 --- a/contrib/depends/packages/native_protobuf.mk +++ b/contrib/depends/packages/native_protobuf.mk @@ -1,28 +1,34 @@ package=native_protobuf -$(package)_version=21.12 -$(package)_version_protobuf_cpp=3.21.12 -$(package)_download_path=https://github.com/protocolbuffers/protobuf/releases/download/v$($(package)_version)/ -$(package)_file_name=protobuf-cpp-$($(package)_version_protobuf_cpp).tar.gz -$(package)_sha256_hash=4eab9b524aa5913c6fffb20b2a8abf5ef7f95a80bc0701f3a6dbb4c607f73460 -$(package)_cxxflags=-std=c++11 +$(package)_version=29.3 +$(package)_download_path=https://github.com/protocolbuffers/protobuf/releases/download/v$($(package)_version) +$(package)_file_name=protobuf-$($(package)_version).tar.gz +$(package)_sha256_hash=008a11cc56f9b96679b4c285fd05f46d317d685be3ab524b2a310be0fbad987e +$(package)_dependencies=native_abseil define $(package)_set_vars - $(package)_config_opts=--disable-shared --prefix=$(build_prefix) - $(package)_config_opts_linux=--with-pic + $(package)_cxxflags+=-std=c++17 + $(package)_config_opts=-Dprotobuf_BUILD_TESTS=OFF + $(package)_config_opts+=-Dprotobuf_ABSL_PROVIDER=package + $(package)_config_opts+=-Dprotobuf_BUILD_SHARED_LIBS=OFF +endef + +# Remove blobs +define $(package)_preprocess_cmds + rm -rf examples docs php/src/GPBMetadata compatibility objectivec/Tests csharp/keys php/tests src/google/protobuf/testdata csharp/src/Google.Protobuf.Test endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_cmake) endef define $(package)_build_cmds - $(MAKE) -C src protoc + $(MAKE) endef define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) -C src install-binPROGRAMS install-nobase_dist_protoDATA + $(MAKE) DESTDIR=$($(package)_staging_dir) install endef define $(package)_postprocess_cmds - rm -rf lib/ + rm -rf lib64 endef diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index a5352cfe0..48427341c 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -1,5 +1,5 @@ -native_packages := native_protobuf -packages := boost openssl zeromq expat unbound sodium protobuf +native_packages := native_abseil native_protobuf +packages := boost openssl zeromq expat unbound sodium abseil protobuf ifneq ($(host_os),android) packages += libusb diff --git a/contrib/depends/packages/protobuf.mk b/contrib/depends/packages/protobuf.mk index 9702506d0..d7193c393 100644 --- a/contrib/depends/packages/protobuf.mk +++ b/contrib/depends/packages/protobuf.mk @@ -1,27 +1,33 @@ package=protobuf $(package)_version=$(native_$(package)_version) -$(package)_version_protobuf_cpp=$(native_$(package)_version_protobuf_cpp) $(package)_download_path=$(native_$(package)_download_path) $(package)_file_name=$(native_$(package)_file_name) $(package)_sha256_hash=$(native_$(package)_sha256_hash) -$(package)_dependencies=native_$(package) -$(package)_cxxflags=-std=c++11 +$(package)_dependencies=abseil define $(package)_set_vars - $(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc - $(package)_config_opts_linux=--with-pic + $(package)_cxxflags+=-std=c++17 + $(package)_config_opts=-Dprotobuf_ABSL_PROVIDER=package + $(package)_config_opts+=-Dprotobuf_BUILD_TESTS=OFF + $(package)_config_opts+=-Dprotobuf_BUILD_SHARED_LIBS=OFF + $(package)_config_opts+=-Dprotobuf_BUILD_PROTOC_BINARIES=OFF + $(package)_config_opts+=-Dprotobuf_WITH_ZLIB=OFF + $(package)_config_opts+=-Dprotobuf_BUILD_LIBUPB=OFF +endef + +# Remove blobs +define $(package)_preprocess_cmds + rm -rf docs php/src/GPBMetadata compatibility objectivec/Tests csharp/keys php/tests src/google/protobuf/testdata csharp/src/Google.Protobuf.Test endef define $(package)_config_cmds - $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) + $($(package)_cmake) endef define $(package)_build_cmds - $(MAKE) -C src libprotobuf.la + $(MAKE) endef define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) -C src install-nobase_includeHEADERS &&\ - $(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA &&\ - cp src/.libs/libprotobuf.a $($(package)_staging_prefix_dir)/lib/ + $(MAKE) DESTDIR=$($(package)_staging_dir) install endef diff --git a/contrib/depends/patches/abseil/no_librt.patch b/contrib/depends/patches/abseil/no_librt.patch new file mode 100644 index 000000000..8fdd1657f --- /dev/null +++ b/contrib/depends/patches/abseil/no_librt.patch @@ -0,0 +1,12 @@ +diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt +index 97994fc6..06ab426c 100644 +--- a/absl/base/CMakeLists.txt ++++ b/absl/base/CMakeLists.txt +@@ -240,7 +240,6 @@ absl_cc_library( + ${ABSL_DEFAULT_COPTS} + LINKOPTS + ${ABSL_DEFAULT_LINKOPTS} +- $<$:-lrt> + $<$:-ladvapi32> + DEPS + absl::atomic_hook diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 8c19acab2..c6d0aa51b 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -26,11 +26,7 @@ SET(UNBOUND_LIBRARIES @prefix@/lib/libunbound.a) SET(LIBUSB-1.0_LIBRARY @prefix@/lib/libusb-1.0.a) SET(LIBUDEV_LIBRARY @prefix@/lib/libudev.a) -SET(Protobuf_FOUND 1) -SET(Protobuf_PROTOC_EXECUTABLE @prefix@/native/bin/protoc CACHE FILEPATH "Path to the native protoc") -SET(Protobuf_INCLUDE_DIR @prefix@/include CACHE PATH "Protobuf include dir") -SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir") -SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library") +SET(absl_ROOT @prefix@) SET(Boost_IGNORE_SYSTEM_PATH ON) SET(BOOST_ROOT @prefix@) @@ -48,6 +44,7 @@ SET(ARCHITECTURE @arch@) set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target +SET (CMAKE_FIND_USE_PACKAGE_ROOT_PATH ON) # specify the cross compiler to be used. Darwin uses clang provided by the SDK. if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")