blob: 073dfaef05a1428bd2c16c64e80a62626205afbe [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "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"
8
9PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
10
11DEPENDS = "zlib"
12DEPENDS_append_class-target = " protobuf-native"
13RDEPENDS_${PN}-compiler = "${PN}"
14RDEPENDS_${PN}-dev += "${PN}-compiler"
Brad Bishop757e94a2018-09-07 18:58:51 +000015RDEPENDS_${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-protobuf', '', d)}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040016
17LIC_FILES_CHKSUM = "file://LICENSE;md5=35953c752efc9299b184f91bef540095"
18
19SRCREV = "106ffc04be1abf3ff3399f54ccf149815b287dd9"
20
21PV = "3.5.1+git${SRCPV}"
22
23SRC_URI = "git://github.com/google/protobuf.git;branch=3.5.x \
24 file://run-ptest \
25 "
26
Brad Bishop757e94a2018-09-07 18:58:51 +000027PACKAGECONFIG ??= ""
28PACKAGECONFIG[python] = ",,"
29
Brad Bishop316dfdd2018-06-25 12:45:53 -040030EXTRA_OECONF += " --with-protoc=echo"
31
32inherit autotools-brokensep pkgconfig ptest
33
34S = "${WORKDIR}/git"
35TEST_SRC_DIR="examples"
Brad Bishop757e94a2018-09-07 18:58:51 +000036LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040037
38do_compile_ptest() {
39 # Modify makefile to use the cross-compiler
40 sed -e "s|c++|${CXX} \$(LDFLAGS)|g" -i "${S}/${TEST_SRC_DIR}/Makefile"
41
42 mkdir -p "${B}/${TEST_SRC_DIR}"
43
44 # Add the location of the cross-compiled header and library files
45 # which haven't been installed yet.
46 cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
47 sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
48 sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
49 sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
50 export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
51
52 # Save the pkgcfg sysroot variable, and update it to nothing so
53 # that it doesn't append the sysroot to the beginning of paths.
54 # The header and library files aren't installed to the target
55 # system yet. So the absolute paths were specified above.
56 save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR
57 export PKG_CONFIG_SYSROOT_DIR=
58
59 # Compile the tests
60 for lang in ${LANG_SUPPORT}; do
61 oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
62 done
63
64 # Restore the pkgconfig sysroot variable
65 export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir
66}
67
68do_install_ptest() {
69 local olddir=`pwd`
70
71 cd "${S}/${TEST_SRC_DIR}"
72 install -d "${D}/${PTEST_PATH}"
73 for i in add_person* list_people*; do
74 if [ -x "$i" ]; then
75 install "$i" "${D}/${PTEST_PATH}"
76 fi
77 done
78 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
79 cd "$olddir"
80}
81
82FILES_${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
83FILES_${PN}-lite = "${bindir} ${libdir}/libprotobuf-lite${SOLIBS}"
84
85MIPS_INSTRUCTION_SET = "mips"
86
87BBCLASSEXTEND = "native nativesdk"