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