blob: 94d8def775d5d4934f6decf6f473d898900c40b3 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "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
Brad Bishop26bdd442019-08-16 17:08:17 -040013SRCREV = "655310ca192a6e3a050e0ca0b7084a2968072260"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014
Brad Bishop26bdd442019-08-16 17:08:17 -040015SRC_URI = "git://github.com/google/protobuf.git;branch=3.9.x \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016 file://run-ptest \
17 file://0001-protobuf-fix-configure-error.patch \
Brad Bishop26bdd442019-08-16 17:08:17 -040018 file://0001-Makefile.am-include-descriptor.cc-when-building-libp.patch \
19 file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020"
21S = "${WORKDIR}/git"
22
23inherit autotools-brokensep pkgconfig ptest
24
25PACKAGECONFIG ??= ""
26PACKAGECONFIG[python] = ",,"
27
28EXTRA_OECONF += "--with-protoc=echo"
29
30TEST_SRC_DIR = "examples"
31LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
32
33do_compile_ptest() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034 mkdir -p "${B}/${TEST_SRC_DIR}"
35
36 # Add the location of the cross-compiled header and library files
37 # which haven't been installed yet.
38 cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
39 sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
40 sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
41 sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
42 export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
43
44 # Save the pkgcfg sysroot variable, and update it to nothing so
45 # that it doesn't append the sysroot to the beginning of paths.
46 # The header and library files aren't installed to the target
47 # system yet. So the absolute paths were specified above.
48 save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR
49 export PKG_CONFIG_SYSROOT_DIR=
50
51 # Compile the tests
52 for lang in ${LANG_SUPPORT}; do
53 oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
54 done
55
56 # Restore the pkgconfig sysroot variable
57 export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir
58}
59
60do_install_ptest() {
61 local olddir=`pwd`
62
63 cd "${S}/${TEST_SRC_DIR}"
64 install -d "${D}/${PTEST_PATH}"
65 for i in add_person* list_people*; do
66 if [ -x "$i" ]; then
67 install "$i" "${D}/${PTEST_PATH}"
68 fi
69 done
70 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
71 cd "$olddir"
72}
73
74PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
75
76FILES_${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
77FILES_${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
78
79RDEPENDS_${PN}-compiler = "${PN}"
80RDEPENDS_${PN}-dev += "${PN}-compiler"
81RDEPENDS_${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-protobuf', '', d)}"
82
83MIPS_INSTRUCTION_SET = "mips"
84
85BBCLASSEXTEND = "native nativesdk"
86
87LDFLAGS_append_arm = " -latomic"
88LDFLAGS_append_mips = " -latomic"
89LDFLAGS_append_powerpc = " -latomic"
90LDFLAGS_append_mipsel = " -latomic"