blob: 1b7ab2011eb6353c89344a60754330f680853330 [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -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=af6809583bfde9a31595a58bb4a24514"
10
11PR = "r0"
12EXCLUDE_FROM_WORLD = "1"
13
14SRC_URI[md5sum] = "af05b2cca289f7b86eef2734a0cdc8b9"
15SRC_URI[sha256sum] = "2667b7cda4a6bc8a09e5463adf3b5984e08d94e72338277affa8594d8b6e5cd1"
16SRC_URI = "https://github.com/google/protobuf/archive/v2.6.1.tar.gz;downloadfilename=protobuf-2.6.1.tar.gz\
17 file://protobuf-allow-running-python-scripts-from-anywhere.patch \
18 file://Omit-google-apputils-dependency.patch \
19 file://run-ptest"
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"
27
28PYTHON_SRC_DIR="python"
29TEST_SRC_DIR="examples"
30LANG_SUPPORT="cpp python"
31
32do_compile() {
33 # Compile protoc compiler
34 base_do_compile
35}
36
37do_compile_ptest() {
38 # Modify makefile to use the cross-compiler
39 sed -e "s|c++|${CXX}|g" -i "${S}/${TEST_SRC_DIR}/Makefile"
40
41 mkdir -p "${B}/${TEST_SRC_DIR}"
42
43 # Add the location of the cross-compiled header and library files
44 # which haven't been installed yet.
45 cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
46 sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
47 sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
48 sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
49 export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
50
51 # Save the pkgcfg sysroot variable, and update it to nothing so
52 # that it doesn't append the sysroot to the beginning of paths.
53 # The header and library files aren't installed to the target
54 # system yet. So the absolute paths were specified above.
55 save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR
56 export PKG_CONFIG_SYSROOT_DIR=
57
58 # Compile the tests
59 for lang in ${LANG_SUPPORT}; do
60 oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
61 done
62
63 # Restore the pkgconfig sysroot variable
64 export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir
65}
66
67do_install() {
68 local olddir=`pwd`
69
70 # Install protoc compiler
71 autotools_do_install
72
73 # Install header files
74 export PROTOC="${STAGING_BINDIR_NATIVE}/protoc"
75 cd "${S}/${PYTHON_SRC_DIR}"
76 distutils_do_install
77
78 cd "$olddir"
79}
80
81do_install_ptest() {
82 local olddir=`pwd`
83
84 cd "${S}/${TEST_SRC_DIR}"
85 install -d "${D}/${PTEST_PATH}"
86 for i in add_person* list_people*; do
87 if [ -x "$i" ]; then
88 install "$i" "${D}/${PTEST_PATH}"
89 fi
90 done
91 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
92
93 cd "$olddir"
94}
95
96BBCLASSEXTEND = "nativesdk"
97