blob: b948e66ae282ab56950410c92e5a37ce1429bba1 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001SUMMARY = "protobuf"
2DESCRIPTION = "Protocol Buffers are a way of encoding structured data in \
3an efficient yet extensible format. Google uses Protocol Buffers for \
4almost all of its internal RPC protocols and file formats."
5HOMEPAGE = "http://code.google.com/p/protobuf/"
6SECTION = "console/tools"
7LICENSE = "BSD-3-Clause"
8
9LIC_FILES_CHKSUM = "file://LICENSE;md5=35953c752efc9299b184f91bef540095"
10
11PR = "r0"
12EXCLUDE_FROM_WORLD = "1"
13
14SRC_URI[md5sum] = "14a532a7538551d5def317bfca41dace"
15SRC_URI[sha256sum] = "0a0ae63cbffc274efb573bdde9a253e3f32e458c41261df51c5dbc5ad541e8f7"
16SRC_URI = "https://github.com/google/protobuf/archive/v3.1.0.tar.gz;downloadfilename=protobuf-3.1.0.tar.gz\
17 file://protobuf-allow-running-python-scripts-from-anywhere.patch \
18 file://run-ptest \
19 "
20
21COMPATIBLE_HOST = "(x86_64|arm|aarch64).*-linux"
22
23EXTRA_OECONF += " --with-protoc=${STAGING_BINDIR_NATIVE}/protoc"
24inherit autotools setuptools ptest
25
26DEPENDS += "protobuf-native"
27RDEPENDS_${PN}-ptest = "bash"
28
29PYTHON_SRC_DIR="python"
30TEST_SRC_DIR="examples"
31LANG_SUPPORT="cpp python"
32
33do_compile() {
34 # Compile protoc compiler
35 base_do_compile
36}
37
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() {
69 local olddir=`pwd`
70
71 # Install protoc compiler
72 autotools_do_install
73
74 # Install header files
75 export PROTOC="${STAGING_BINDIR_NATIVE}/protoc"
76 cd "${S}/${PYTHON_SRC_DIR}"
77 distutils_do_install
78
79 cd "$olddir"
80}
81
82do_install_ptest() {
83 local olddir=`pwd`
84
85 cd "${S}/${TEST_SRC_DIR}"
86 install -d "${D}/${PTEST_PATH}"
87 for i in add_person* list_people*; do
88 if [ -x "$i" ]; then
89 install "$i" "${D}/${PTEST_PATH}"
90 fi
91 done
92 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
93
94 cd "$olddir"
95}
96
97BBCLASSEXTEND = "nativesdk"
98