diff options
Diffstat (limited to 'meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb')
-rw-r--r-- | meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb new file mode 100644 index 0000000000..343933033b --- /dev/null +++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | |||
@@ -0,0 +1,108 @@ | |||
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 = "f0dc78d7e6e331b8c6bb2d5283e06aa26883ca7c" | ||
14 | |||
15 | SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=21.x;protocol=https \ | ||
16 | file://run-ptest \ | ||
17 | file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \ | ||
18 | file://0001-Fix-linking-error-with-ld-gold.patch \ | ||
19 | " | ||
20 | SRC_URI:append:mips:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch " | ||
21 | SRC_URI:append:mipsel:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch " | ||
22 | |||
23 | S = "${WORKDIR}/git" | ||
24 | |||
25 | inherit cmake pkgconfig ptest | ||
26 | |||
27 | PACKAGECONFIG ??= "" | ||
28 | PACKAGECONFIG:class-native ?= "compiler" | ||
29 | PACKAGECONFIG:class-nativesdk ?= "compiler" | ||
30 | PACKAGECONFIG[python] = ",," | ||
31 | PACKAGECONFIG[compiler] = "-Dprotobuf_BUILD_PROTOC_BINARIES=ON,-Dprotobuf_BUILD_PROTOC_BINARIES=OFF" | ||
32 | |||
33 | EXTRA_OECMAKE += "\ | ||
34 | -Dprotobuf_BUILD_SHARED_LIBS=ON \ | ||
35 | -Dprotobuf_BUILD_LIBPROTOC=ON \ | ||
36 | -Dprotobuf_BUILD_TESTS=OFF \ | ||
37 | -Dprotobuf_BUILD_EXAMPLES=OFF \ | ||
38 | " | ||
39 | |||
40 | TEST_SRC_DIR = "examples" | ||
41 | LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}" | ||
42 | |||
43 | do_compile_ptest() { | ||
44 | mkdir -p "${B}/${TEST_SRC_DIR}" | ||
45 | |||
46 | # Add the location of the cross-compiled header and library files | ||
47 | # which haven't been installed yet. | ||
48 | cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc" | ||
49 | cp ${S}/${TEST_SRC_DIR}/*.cc "${B}/${TEST_SRC_DIR}/" | ||
50 | cp ${S}/${TEST_SRC_DIR}/*.proto "${B}/${TEST_SRC_DIR}/" | ||
51 | cp ${S}/${TEST_SRC_DIR}/*.py "${B}/${TEST_SRC_DIR}/" | ||
52 | cp ${S}/${TEST_SRC_DIR}/Makefile "${B}/${TEST_SRC_DIR}/" | ||
53 | sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc" | ||
54 | sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc" | ||
55 | sed -e 's|Libs:|Libs: -L${B}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc" | ||
56 | # Until out-of-tree build of examples is supported, we have to use this approach | ||
57 | sed -e 's|../src/google/protobuf/.libs/timestamp.pb.o|${B}/CMakeFiles/libprotobuf.dir/src/google/protobuf/timestamp.pb.cc.o|' -i "${B}/${TEST_SRC_DIR}/Makefile" | ||
58 | export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}" | ||
59 | |||
60 | # Save the pkgcfg sysroot variable, and update it to nothing so | ||
61 | # that it doesn't append the sysroot to the beginning of paths. | ||
62 | # The header and library files aren't installed to the target | ||
63 | # system yet. So the absolute paths were specified above. | ||
64 | save_pkg_config_sysroot_dir=$PKG_CONFIG_SYSROOT_DIR | ||
65 | export PKG_CONFIG_SYSROOT_DIR= | ||
66 | |||
67 | # Compile the tests | ||
68 | for lang in ${LANG_SUPPORT}; do | ||
69 | oe_runmake -C "${B}/${TEST_SRC_DIR}" ${lang} | ||
70 | done | ||
71 | |||
72 | # Restore the pkgconfig sysroot variable | ||
73 | export PKG_CONFIG_SYSROOT_DIR=$save_pkg_config_sysroot_dir | ||
74 | } | ||
75 | |||
76 | do_install_ptest() { | ||
77 | local olddir=`pwd` | ||
78 | |||
79 | cd "${S}/${TEST_SRC_DIR}" | ||
80 | install -d "${D}/${PTEST_PATH}" | ||
81 | for i in add_person* list_people*; do | ||
82 | if [ -x "$i" ]; then | ||
83 | install "$i" "${D}/${PTEST_PATH}" | ||
84 | fi | ||
85 | done | ||
86 | cp "${B}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}" | ||
87 | cd "$olddir" | ||
88 | } | ||
89 | |||
90 | PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite" | ||
91 | |||
92 | FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}" | ||
93 | FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}" | ||
94 | |||
95 | SYSROOT_DIRS += "${bindir}" | ||
96 | |||
97 | RDEPENDS:${PN}-compiler = "${PN}" | ||
98 | RDEPENDS:${PN}-dev += "${PN}-compiler" | ||
99 | RDEPENDS:${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-protobuf', '', d)}" | ||
100 | |||
101 | MIPS_INSTRUCTION_SET = "mips" | ||
102 | |||
103 | BBCLASSEXTEND = "native nativesdk" | ||
104 | |||
105 | LDFLAGS:append:arm = " -latomic" | ||
106 | LDFLAGS:append:mips = " -latomic" | ||
107 | LDFLAGS:append:powerpc = " -latomic" | ||
108 | LDFLAGS:append:mipsel = " -latomic" | ||