Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame^] | 1 | SUMMARY = "protobuf" |
| 2 | DESCRIPTION = "Protocol Buffers are a way of encoding structured data in \ |
| 3 | an efficient yet extensible format. Google uses Protocol Buffers for \ |
| 4 | almost all of its internal RPC protocols and file formats." |
| 5 | HOMEPAGE = "http://code.google.com/p/protobuf/" |
| 6 | SECTION = "console/tools" |
| 7 | LICENSE = "BSD-3-Clause" |
| 8 | |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=af6809583bfde9a31595a58bb4a24514" |
| 10 | |
| 11 | PR = "r0" |
| 12 | EXCLUDE_FROM_WORLD = "1" |
| 13 | |
| 14 | SRC_URI[md5sum] = "af05b2cca289f7b86eef2734a0cdc8b9" |
| 15 | SRC_URI[sha256sum] = "2667b7cda4a6bc8a09e5463adf3b5984e08d94e72338277affa8594d8b6e5cd1" |
| 16 | SRC_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 | |
| 21 | COMPATIBLE_HOST = "(x86_64|arm|aarch64).*-linux" |
| 22 | |
| 23 | EXTRA_OECONF += " --with-protoc=${STAGING_BINDIR_NATIVE}/protoc" |
| 24 | inherit autotools setuptools ptest |
| 25 | |
| 26 | DEPENDS += "protobuf-native" |
| 27 | |
| 28 | PYTHON_SRC_DIR="python" |
| 29 | TEST_SRC_DIR="examples" |
| 30 | LANG_SUPPORT="cpp python" |
| 31 | |
| 32 | do_compile() { |
| 33 | # Compile protoc compiler |
| 34 | base_do_compile |
| 35 | } |
| 36 | |
| 37 | do_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 | |
| 67 | do_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 | |
| 81 | do_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 | |
| 96 | BBCLASSEXTEND = "nativesdk" |
| 97 | |