blob: 46ebef978522e6c6ac0d027c5922de6403fb0728 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "Protocol Buffers - structured data serialisation mechanism"
2DESCRIPTION = "Protocol Buffers are a way of encoding structured data in an \
3efficient yet extensible format. Google uses Protocol Buffers for almost \
4all of its internal RPC protocols and file formats."
5HOMEPAGE = "https://github.com/google/protobuf"
6SECTION = "console/tools"
7LICENSE = "BSD-3-Clause"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b"
9
10DEPENDS = "zlib"
Patrick Williams213cb262021-08-07 19:21:33 -050011DEPENDS:append:class-target = " protobuf-native"
Andrew Geissler82c905d2020-04-13 13:39:40 -050012
Andrew Geissler5199d832021-09-24 16:47:35 -050013SRCREV = "89b14b1d16eba4d44af43256fc45b24a6a348557"
Andrew Geissler82c905d2020-04-13 13:39:40 -050014
Andrew Geissler5199d832021-09-24 16:47:35 -050015SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=3.18.x \
Andrew Geissler82c905d2020-04-13 13:39:40 -050016 file://run-ptest \
17 file://0001-protobuf-fix-configure-error.patch \
18 file://0001-Makefile.am-include-descriptor.cc-when-building-libp.patch \
19 file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
Andrew Geisslereff27472021-10-29 15:35:00 -050020 file://0001-Fix-linking-error-with-ld-gold.patch \
Andrew Geissler5199d832021-09-24 16:47:35 -050021 "
Andrew Geissler82c905d2020-04-13 13:39:40 -050022S = "${WORKDIR}/git"
23
24inherit autotools-brokensep pkgconfig ptest
25
26PACKAGECONFIG ??= ""
27PACKAGECONFIG[python] = ",,"
28
29EXTRA_OECONF += "--with-protoc=echo"
30
31TEST_SRC_DIR = "examples"
32LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
33
34do_compile_ptest() {
35 mkdir -p "${B}/${TEST_SRC_DIR}"
36
37 # Add the location of the cross-compiled header and library files
38 # which haven't been installed yet.
39 cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
40 sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
41 sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
42 sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
43 export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
44
45 # Save the pkgcfg sysroot variable, and update it to nothing so
46 # that it doesn't append the sysroot to the beginning of paths.
47 # The header and library files aren't installed to the target
48 # system yet. So the absolute paths were specified above.
49 save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR
50 export PKG_CONFIG_SYSROOT_DIR=
51
52 # Compile the tests
53 for lang in ${LANG_SUPPORT}; do
54 oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
55 done
56
57 # Restore the pkgconfig sysroot variable
58 export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir
59}
60
61do_install_ptest() {
62 local olddir=`pwd`
63
64 cd "${S}/${TEST_SRC_DIR}"
65 install -d "${D}/${PTEST_PATH}"
66 for i in add_person* list_people*; do
67 if [ -x "$i" ]; then
68 install "$i" "${D}/${PTEST_PATH}"
69 fi
70 done
71 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
72 cd "$olddir"
73}
74
75PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
76
Patrick Williams213cb262021-08-07 19:21:33 -050077FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
78FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050079
Patrick Williams213cb262021-08-07 19:21:33 -050080RDEPENDS:${PN}-compiler = "${PN}"
81RDEPENDS:${PN}-dev += "${PN}-compiler"
82RDEPENDS:${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-protobuf', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050083
84MIPS_INSTRUCTION_SET = "mips"
85
86BBCLASSEXTEND = "native nativesdk"
87
Patrick Williams213cb262021-08-07 19:21:33 -050088LDFLAGS:append:arm = " -latomic"
89LDFLAGS:append:mips = " -latomic"
90LDFLAGS:append:powerpc = " -latomic"
91LDFLAGS:append:mipsel = " -latomic"