blob: 00f1e99d356341a4c10466e1ef1b9ac58cd56f67 [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"
11DEPENDS_append_class-target = " protobuf-native"
12
Andrew Geissler4b7c1152020-11-30 19:55:29 -060013SRCREV = "2514f0bd7da7e2af1bed4c5d1b84f031c4d12c10"
Andrew Geissler82c905d2020-04-13 13:39:40 -050014
Andrew Geisslerc87764f2020-06-27 00:16:32 -050015SRC_URI = "git://github.com/protocolbuffers/protobuf.git \
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 Geisslereef63862021-01-29 15:58:13 -060020 file://0001-fix-m4-pthread-update.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050021"
22S = "${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
77FILES_${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
78FILES_${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
79
80RDEPENDS_${PN}-compiler = "${PN}"
81RDEPENDS_${PN}-dev += "${PN}-compiler"
82RDEPENDS_${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-protobuf', '', d)}"
83
84MIPS_INSTRUCTION_SET = "mips"
85
86BBCLASSEXTEND = "native nativesdk"
87
88LDFLAGS_append_arm = " -latomic"
89LDFLAGS_append_mips = " -latomic"
90LDFLAGS_append_powerpc = " -latomic"
91LDFLAGS_append_mipsel = " -latomic"