From a79dd7911b2092e2130d1f96dfc0e4318fe75521 Mon Sep 17 00:00:00 2001 From: Vyacheslav Yurkov Date: Fri, 26 Aug 2022 08:59:23 +0200 Subject: [PATCH] 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 Signed-off-by: Khem Raj --- ...ude-descriptor.cc-when-building-libp.patch | 30 ------------------ .../0001-protobuf-fix-configure-error.patch | 31 ------------------- .../protobuf/protobuf_3.21.5.bb | 23 +++++++++----- 3 files changed, 16 insertions(+), 68 deletions(-) delete mode 100644 meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch delete mode 100644 meta-oe/recipes-devtools/protobuf/protobuf/0001-protobuf-fix-configure-error.patch diff --git a/meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch b/meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch deleted file mode 100644 index 59d43072c7f..00000000000 --- a/meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 76980e1c84374e8bfa4dffcca78c5050783e83b9 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -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 - ---- - 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 \ diff --git a/meta-oe/recipes-devtools/protobuf/protobuf/0001-protobuf-fix-configure-error.patch b/meta-oe/recipes-devtools/protobuf/protobuf/0001-protobuf-fix-configure-error.patch deleted file mode 100644 index 7c87dbe262c..00000000000 --- a/meta-oe/recipes-devtools/protobuf/protobuf/0001-protobuf-fix-configure-error.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2649fe191ad3f086274a9bf1520212a4c715c944 Mon Sep 17 00:00:00 2001 -From: Changqing Li -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 - ---- - 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 diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb index 26ac8dd1c04..88bef2c06d3 100644 --- a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb +++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb @@ -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" }