blob: cf72d9ca7fda7938c81704d9b34affb3d0cc116c [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
13PV .= "+git${SRCPV}"
14
15SRCREV = "48cb18e5c419ddd23d9badcfe4e9df7bde1979b2"
16
17SRC_URI = "git://github.com/google/protobuf.git;branch=3.6.x \
18 file://run-ptest \
19 file://0001-protobuf-fix-configure-error.patch \
20"
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() {
34 # Modify makefile to use the cross-compiler
35 sed -e "s|c++|${CXX} \$(LDFLAGS)|g" -i "${S}/${TEST_SRC_DIR}/Makefile"
36
37 mkdir -p "${B}/${TEST_SRC_DIR}"
38
39 # Add the location of the cross-compiled header and library files
40 # which haven't been installed yet.
41 cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
42 sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
43 sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
44 sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
45 export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
46
47 # Save the pkgcfg sysroot variable, and update it to nothing so
48 # that it doesn't append the sysroot to the beginning of paths.
49 # The header and library files aren't installed to the target
50 # system yet. So the absolute paths were specified above.
51 save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR
52 export PKG_CONFIG_SYSROOT_DIR=
53
54 # Compile the tests
55 for lang in ${LANG_SUPPORT}; do
56 oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
57 done
58
59 # Restore the pkgconfig sysroot variable
60 export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir
61}
62
63do_install_ptest() {
64 local olddir=`pwd`
65
66 cd "${S}/${TEST_SRC_DIR}"
67 install -d "${D}/${PTEST_PATH}"
68 for i in add_person* list_people*; do
69 if [ -x "$i" ]; then
70 install "$i" "${D}/${PTEST_PATH}"
71 fi
72 done
73 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
74 cd "$olddir"
75}
76
77PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
78
79FILES_${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
80FILES_${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
81
82RDEPENDS_${PN}-compiler = "${PN}"
83RDEPENDS_${PN}-dev += "${PN}-compiler"
84RDEPENDS_${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-protobuf', '', d)}"
85
86MIPS_INSTRUCTION_SET = "mips"
87
88BBCLASSEXTEND = "native nativesdk"
89
90LDFLAGS_append_arm = " -latomic"
91LDFLAGS_append_mips = " -latomic"
92LDFLAGS_append_powerpc = " -latomic"
93LDFLAGS_append_mipsel = " -latomic"