Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 1 | SUMMARY = "Protocol Buffers - structured data serialisation mechanism" |
| 2 | DESCRIPTION = "Protocol Buffers are a way of encoding structured data in an \ |
| 3 | efficient yet extensible format. Google uses Protocol Buffers for almost \ |
| 4 | all of its internal RPC protocols and file formats." |
| 5 | HOMEPAGE = "https://github.com/google/protobuf" |
| 6 | SECTION = "console/tools" |
| 7 | LICENSE = "BSD-3-Clause" |
| 8 | LIC_FILES_CHKSUM = "file://LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b" |
| 9 | |
| 10 | DEPENDS = "zlib" |
| 11 | DEPENDS:append:class-target = " protobuf-native" |
| 12 | |
| 13 | SRCREV = "22d0e265de7d2b3d2e9a00d071313502e7d4cccf" |
| 14 | |
| 15 | SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=3.19.x;protocol=https \ |
| 16 | file://run-ptest \ |
| 17 | file://0001-protobuf-fix-configure-error.patch \ |
| 18 | file://0001-Makefile.am-include-descriptor.cc-when-building-libp.patch \ |
| 19 | file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \ |
| 20 | file://0001-Fix-linking-error-with-ld-gold.patch \ |
| 21 | file://0001-Lower-init-prio-for-extension-attributes.patch \ |
| 22 | " |
| 23 | SRC_URI:append:mips:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch " |
| 24 | SRC_URI:append:mipsel:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch " |
| 25 | |
| 26 | S = "${WORKDIR}/git" |
| 27 | |
| 28 | inherit autotools-brokensep pkgconfig ptest |
| 29 | |
| 30 | PACKAGECONFIG ??= "" |
| 31 | PACKAGECONFIG[python] = ",," |
| 32 | |
| 33 | EXTRA_OECONF += "--with-protoc=echo" |
| 34 | |
| 35 | TEST_SRC_DIR = "examples" |
| 36 | LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}" |
| 37 | |
| 38 | do_compile_ptest() { |
| 39 | mkdir -p "${B}/${TEST_SRC_DIR}" |
| 40 | |
| 41 | # Add the location of the cross-compiled header and library files |
| 42 | # which haven't been installed yet. |
| 43 | cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc" |
| 44 | sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc" |
| 45 | sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc" |
| 46 | sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc" |
| 47 | export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}" |
| 48 | |
| 49 | # Save the pkgcfg sysroot variable, and update it to nothing so |
| 50 | # that it doesn't append the sysroot to the beginning of paths. |
| 51 | # The header and library files aren't installed to the target |
| 52 | # system yet. So the absolute paths were specified above. |
| 53 | save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR |
| 54 | export PKG_CONFIG_SYSROOT_DIR= |
| 55 | |
| 56 | # Compile the tests |
| 57 | for lang in ${LANG_SUPPORT}; do |
| 58 | oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang} |
| 59 | done |
| 60 | |
| 61 | # Restore the pkgconfig sysroot variable |
| 62 | export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir |
| 63 | } |
| 64 | |
| 65 | do_install_ptest() { |
| 66 | local olddir=`pwd` |
| 67 | |
| 68 | cd "${S}/${TEST_SRC_DIR}" |
| 69 | install -d "${D}/${PTEST_PATH}" |
| 70 | for i in add_person* list_people*; do |
| 71 | if [ -x "$i" ]; then |
| 72 | install "$i" "${D}/${PTEST_PATH}" |
| 73 | fi |
| 74 | done |
| 75 | cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}" |
| 76 | cd "$olddir" |
| 77 | } |
| 78 | |
| 79 | PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite" |
| 80 | |
| 81 | FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}" |
| 82 | FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}" |
| 83 | |
| 84 | RDEPENDS:${PN}-compiler = "${PN}" |
| 85 | RDEPENDS:${PN}-dev += "${PN}-compiler" |
| 86 | RDEPENDS:${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python-protobuf', '', d)}" |
| 87 | |
| 88 | MIPS_INSTRUCTION_SET = "mips" |
| 89 | |
| 90 | BBCLASSEXTEND = "native nativesdk" |
| 91 | |
| 92 | LDFLAGS:append:arm = " -latomic" |
| 93 | LDFLAGS:append:mips = " -latomic" |
| 94 | LDFLAGS:append:powerpc = " -latomic" |
| 95 | LDFLAGS:append:mipsel = " -latomic" |