protobuf: change build system to cmake

Autotools support has been removed and replaced completely by CMake.

See related issues for details:
https://github.com/protocolbuffers/protobuf/issues/7911
https://github.com/protocolbuffers/protobuf/pull/10132

Drop autotools patches too.

Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Vyacheslav Yurkov
2022-08-26 08:59:23 +02:00
committed by Khem Raj
parent 61e3493c53
commit 4db814180c
3 changed files with 16 additions and 68 deletions
@@ -1,30 +0,0 @@
From 76980e1c84374e8bfa4dffcca78c5050783e83b9 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Thu, 27 Jun 2019 13:27:18 +0000
Subject: [PATCH] Makefile.am: include descriptor.pb.cc when building
libprotoc.so
* otherwise plugin.pb.o has undefined symbol scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
and build with gold fails with:
core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr/bin/i686-oe-linux/../../libexec/i686-oe-linux/gcc/i686-oe-linux/9.1.0/ld.bfd: ./.libs/libprotoc.so: undefined reference to `descriptor_table_google_2fprotobuf_2fdescriptor_2eproto'
core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr/bin/i686-oe-linux/../../libexec/i686-oe-linux/gcc/i686-oe-linux/9.1.0/ld.bfd: ./.libs/libprotoc.so: undefined reference to `scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto'
Upstream-Status: Pending
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
src/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index e6a7dc7fd..6b0fe6686 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -326,6 +326,7 @@ libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map
EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map
endif
libprotoc_la_SOURCES = \
+ google/protobuf/descriptor.pb.cc \
google/protobuf/compiler/code_generator.cc \
google/protobuf/compiler/command_line_interface.cc \
google/protobuf/compiler/cpp/enum.cc \
@@ -1,31 +0,0 @@
From 2649fe191ad3f086274a9bf1520212a4c715c944 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Wed, 18 Jul 2018 17:52:34 +0800
Subject: [PATCH] protobuf: fix configure error
fix below error:
gnu-configize: 'configure.ac' or 'configure.in' is required
third_party/googletest is git submodule of protobuf. Above error
caused by missing submodule googletest.
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
configure.ac | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 375a79d93..1d73cd73f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,7 +241,6 @@ AC_SUBST([LIBLOG_LIBS])
# too.
export CFLAGS
export CXXFLAGS
-AC_CONFIG_SUBDIRS([third_party/googletest])
AC_CONFIG_FILES([Makefile src/Makefile benchmarks/Makefile conformance/Makefile protobuf.pc protobuf-lite.pc])
AC_OUTPUT
@@ -14,8 +14,6 @@ SRCREV = "ab840345966d0fa8e7100d771c92a73bfbadd25c"
SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=21.x;protocol=https \
file://run-ptest \
file://0001-protobuf-fix-configure-error.patch \
file://0001-Makefile.am-include-descriptor.cc-when-building-libp.patch \
file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
file://0001-Fix-linking-error-with-ld-gold.patch \
"
@@ -24,12 +22,17 @@ SRC_URI:append:mipsel:toolchain-clang = " file://0001-Fix-build-on-mips-clang.pa
S = "${WORKDIR}/git"
inherit autotools-brokensep pkgconfig ptest
inherit cmake pkgconfig ptest
PACKAGECONFIG ??= ""
PACKAGECONFIG[python] = ",,"
EXTRA_OECONF += "--with-protoc=echo"
EXTRA_OECMAKE += "\
-Dprotobuf_BUILD_SHARED_LIBS=ON \
-Dprotobuf_BUILD_LIBPROTOC=ON \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_EXAMPLES=OFF \
"
TEST_SRC_DIR = "examples"
LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
@@ -40,9 +43,15 @@ do_compile_ptest() {
# Add the location of the cross-compiled header and library files
# which haven't been installed yet.
cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
cp ${S}/${TEST_SRC_DIR}/*.cc "${B}/${TEST_SRC_DIR}/"
cp ${S}/${TEST_SRC_DIR}/*.proto "${B}/${TEST_SRC_DIR}/"
cp ${S}/${TEST_SRC_DIR}/*.py "${B}/${TEST_SRC_DIR}/"
cp ${S}/${TEST_SRC_DIR}/Makefile "${B}/${TEST_SRC_DIR}/"
sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
sed -e 's|Libs:|Libs: -L${B}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
# Until out-of-tree build of examples is supported, we have to use this approach
sed -e 's|../src/google/protobuf/.libs/timestamp.pb.o|${B}/CMakeFiles/libprotobuf.dir/src/google/protobuf/timestamp.pb.cc.o|' -i "${B}/${TEST_SRC_DIR}/Makefile"
export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
# Save the pkgcfg sysroot variable, and update it to nothing so
@@ -54,7 +63,7 @@ do_compile_ptest() {
# Compile the tests
for lang in ${LANG_SUPPORT}; do
oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
oe_runmake -C "${B}/${TEST_SRC_DIR}" ${lang}
done
# Restore the pkgconfig sysroot variable
@@ -71,7 +80,7 @@ do_install_ptest() {
install "$i" "${D}/${PTEST_PATH}"
fi
done
cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
cp "${B}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
cd "$olddir"
}