protobuf now uses bazel as it's primary build system, but also provides
a CMake build system. As PTXdist doesn't support bazel, use CMake.

Also protobuf now depends on the abseil-cpp library. But it doesn't
depend on the host protoc executable anymore, as it's only required
when tests or examples are built [1].

Compiling the protoc binary also needs libupb to be enabled, as the
compilation otherwise fails. Therefore it is enabled on the host side.

Protobuf now also depends on a UTF-8 Range library. This previously had
it's own repository, but is now developed inside of the protobuf
repository [2]. As the library is probably only used by protobuf and
has to keep in sync with the protobuf sources, avoid the effort of
separating it into a separate rule.

[1] 
https://github.com/protocolbuffers/protobuf/blob/a79f2d2e9fadd75e94f3fe40a0399bf0a5d90551/CMakeLists.txt#L317-L320
[2] 
https://github.com/protocolbuffers/utf8_range/blob/1d1ea7e3fedf482d4a12b473c1ed25fe0f371a45/README.md?plain=1#L1-L4

Signed-off-by: Sven Püschel <[email protected]>
---
 patches/protobuf-all-3.7.1/autogen.sh |  1 -
 rules/host-protobuf.in                |  2 ++
 rules/host-protobuf.make              | 25 +++++++++++++------
 rules/protobuf.in                     |  3 ++-
 rules/protobuf.make                   | 35 ++++++++++++++++++---------
 5 files changed, 44 insertions(+), 22 deletions(-)
 delete mode 120000 patches/protobuf-all-3.7.1/autogen.sh

diff --git a/patches/protobuf-all-3.7.1/autogen.sh 
b/patches/protobuf-all-3.7.1/autogen.sh
deleted file mode 120000
index 9f8a4cb7d..000000000
--- a/patches/protobuf-all-3.7.1/autogen.sh
+++ /dev/null
@@ -1 +0,0 @@
-../autogen.sh
\ No newline at end of file
diff --git a/rules/host-protobuf.in b/rules/host-protobuf.in
index 00de2ad25..6c48438c7 100644
--- a/rules/host-protobuf.in
+++ b/rules/host-protobuf.in
@@ -2,4 +2,6 @@
 
 config HOST_PROTOBUF
        tristate
+       select HOST_ABSEIL_CPP
+       select HOST_CMAKE
        default y if ALLYES
diff --git a/rules/host-protobuf.make b/rules/host-protobuf.make
index 862aa4c7a..7a205018f 100644
--- a/rules/host-protobuf.make
+++ b/rules/host-protobuf.make
@@ -15,14 +15,23 @@ HOST_PACKAGES-$(PTXCONF_HOST_PROTOBUF) += host-protobuf
 # Prepare
 # ----------------------------------------------------------------------------
 
-#
-# autoconf
-#
-HOST_PROTOBUF_CONF_TOOL        := autoconf
+HOST_PROTOBUF_CONF_TOOL        := cmake
 HOST_PROTOBUF_CONF_OPT := \
-       $(HOST_AUTOCONF) \
-       --disable-64bit-solaris \
-       --disable-static \
-       --without-zlib
+       $(HOST_CMAKE_OPT) \
+       -Dprotobuf_BUILD_CONFORMANCE=OFF \
+       -Dprotobuf_BUILD_EXAMPLES=OFF \
+       -Dprotobuf_BUILD_LIBPROTOC=OFF \
+       -Dprotobuf_BUILD_LIBUPB=ON \
+       -Dprotobuf_BUILD_PROTOBUF_BINARIES=ON \
+       -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
+       -Dprotobuf_BUILD_SHARED_LIBS=OFF \
+       -Dprotobuf_BUILD_TESTS=OFF \
+       -Dprotobuf_DISABLE_RTTI=OFF \
+       -Dprotobuf_FORCE_FETCH_DEPENDENCIES=OFF \
+       -Dprotobuf_INSTALL=ON \
+       -Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON \
+       -Dprotobuf_WITH_ZLIB=OFF \
+       -Dutf8_range_ENABLE_INSTALL=ON \
+       -Dutf8_range_ENABLE_TESTS=OFF
 
 # vim: syntax=make
diff --git a/rules/protobuf.in b/rules/protobuf.in
index 667c6404d..e01fdfab3 100644
--- a/rules/protobuf.in
+++ b/rules/protobuf.in
@@ -2,11 +2,12 @@
 
 menuconfig PROTOBUF
        tristate
+       select ABSEIL_CPP
        select LIBC_M
        select LIBC_PTHREAD
        select GCCLIBS_CXX
        select GCCLIBS_GCC_S
-       select HOST_PROTOBUF
+       select HOST_CMAKE
        select ZLIB             if PROTOBUF_ZLIB
        prompt "protobuf                      "
        help
diff --git a/rules/protobuf.make b/rules/protobuf.make
index f66811b26..b99943141 100644
--- a/rules/protobuf.make
+++ b/rules/protobuf.make
@@ -14,29 +14,39 @@ PACKAGES-$(PTXCONF_PROTOBUF) += protobuf
 #
 # Paths and names
 #
-PROTOBUF_VERSION       := 3.7.1
-PROTOBUF_MD5           := cda6ae370a5df941f8aa837c8a0292ba
-PROTOBUF               := protobuf-all-$(PROTOBUF_VERSION)
+PROTOBUF_VERSION       := 33.0
+PROTOBUF_MD5           := 936b48fdf816b0341c74ba73a42348c0
+PROTOBUF               := protobuf-$(PROTOBUF_VERSION)
 PROTOBUF_SUFFIX                := tar.gz
 PROTOBUF_URL           := 
https://github.com/google/protobuf/releases/download/v$(PROTOBUF_VERSION)/$(PROTOBUF).$(PROTOBUF_SUFFIX)
 PROTOBUF_SOURCE                := $(SRCDIR)/$(PROTOBUF).$(PROTOBUF_SUFFIX)
 PROTOBUF_DIR           := $(BUILDDIR)/$(PROTOBUF)
 PROTOBUF_LICENSE       := BSD-3-Clause
+PROTOBUF_LICENSE_FILES := \
+       file://LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b
 
 # ----------------------------------------------------------------------------
 # Prepare
 # ----------------------------------------------------------------------------
 
-#
-# autoconf
-#
-PROTOBUF_CONF_TOOL     := autoconf
+PROTOBUF_CONF_TOOL     := cmake
 PROTOBUF_CONF_OPT      := \
-       $(CROSS_AUTOCONF_USR) \
-       --disable-64bit-solaris \
-       --disable-static \
-       --$(call ptx/wwo, PTXCONF_PROTOBUF_ZLIB)-zlib \
-       --with-protoc=$(PTXDIST_SYSROOT_HOST)/usr/bin/protoc
+       $(CROSS_CMAKE_USR) \
+       -Dprotobuf_BUILD_CONFORMANCE=OFF \
+       -Dprotobuf_BUILD_EXAMPLES=OFF \
+       -Dprotobuf_BUILD_LIBPROTOC=OFF \
+       -Dprotobuf_BUILD_LIBUPB=OFF \
+       -Dprotobuf_BUILD_PROTOBUF_BINARIES=ON \
+       -Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
+       -Dprotobuf_BUILD_SHARED_LIBS=ON \
+       -Dprotobuf_BUILD_TESTS=OFF \
+       -Dprotobuf_DISABLE_RTTI=OFF \
+       -Dprotobuf_FORCE_FETCH_DEPENDENCIES=OFF \
+       -Dprotobuf_INSTALL=ON \
+       -Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON \
+       -Dprotobuf_WITH_ZLIB=$(call ptx/onoff, PTXCONF_PROTOBUF_ZLIB) \
+       -Dutf8_range_ENABLE_INSTALL=ON \
+       -Dutf8_range_ENABLE_TESTS=OFF
 
 # ----------------------------------------------------------------------------
 # Target-Install
@@ -51,6 +61,7 @@ $(STATEDIR)/protobuf.targetinstall:
        @$(call install_fixup, protobuf,AUTHOR,"Adrian Baumgarth 
<[email protected]>")
        @$(call install_fixup, protobuf,DESCRIPTION,missing)
 
+       @$(call install_lib, protobuf, 0, 0, 0644, libutf8_validity)
        @$(call install_lib, protobuf, 0, 0, 0644, libprotobuf-lite)
        @$(call install_lib, protobuf, 0, 0, 0644, libprotobuf)
 
-- 
2.47.3


Reply via email to