summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZumeng Chen <zumeng.chen@windriver.com>2016-05-19 23:57:28 -0700
committerBruce Ashfield <bruce.ashfield@windriver.com>2016-05-20 12:36:54 -0400
commit0afa6e168ea6421fdaeedb426c2131b7db1f9ed9 (patch)
tree23f6011d064f270dcc573587e8c1b081fde517f9
parent823c8cfcdf107a7cf6a7b2f39bc9c15fd81b9f78 (diff)
downloadmeta-virtualization-0afa6e168ea6421fdaeedb426c2131b7db1f9ed9.tar.gz
protobuf: add protobuf-2.5.0 into devtool
Protocol Buffers(a.k.a., protobuf) are language-neutral, platform-neutral, extensible mechanism for serializing structured data, so it is reasonable to be a part of development tool recipe. Signed-off-by: Zumeng Chen <zumeng.chen@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--recipes-devtools/protobuf/files/disable_tests.patch19
-rw-r--r--recipes-devtools/protobuf/files/protobuf-allow-running-python-scripts-from-anywhere.patch38
-rwxr-xr-xrecipes-devtools/protobuf/files/run-ptest32
-rw-r--r--recipes-devtools/protobuf/protobuf-c_0.15.bb20
-rw-r--r--recipes-devtools/protobuf/protobuf-native_2.5.0.bb20
-rw-r--r--recipes-devtools/protobuf/protobuf_2.5.0.bb95
6 files changed, 224 insertions, 0 deletions
diff --git a/recipes-devtools/protobuf/files/disable_tests.patch b/recipes-devtools/protobuf/files/disable_tests.patch
new file mode 100644
index 00000000..f5e71ca6
--- /dev/null
+++ b/recipes-devtools/protobuf/files/disable_tests.patch
@@ -0,0 +1,19 @@
1diff -Naur protobuf-c-0.15.old/src/Makefile.am protobuf-c-0.15/src/Makefile.am
2--- protobuf-c-0.15.old/src/Makefile.am 2012-11-28 14:59:57.845251943 +0100
3+++ protobuf-c-0.15/src/Makefile.am 2012-11-28 15:00:23.549252632 +0100
4@@ -1,5 +1,5 @@
5 if BUILD_PROTOC_C
6-SUBDIRS = . test
7+
8 bin_PROGRAMS = protoc-c
9 protoc_c_SOURCES = \
10 google/protobuf/compiler/c/c_service.cc \
11@@ -23,7 +23,7 @@
12 lib_LTLIBRARIES = libprotobuf-c.la
13 protobufcincludedir = $(includedir)/google/protobuf-c
14
15-EXTRA_DIST = CMakeLists.txt test/CMakeLists.txt
16+EXTRA_DIST = CMakeLists.txt
17
18 libprotobuf_c_la_SOURCES = \
19 google/protobuf-c/protobuf-c-dispatch.c \
diff --git a/recipes-devtools/protobuf/files/protobuf-allow-running-python-scripts-from-anywhere.patch b/recipes-devtools/protobuf/files/protobuf-allow-running-python-scripts-from-anywhere.patch
new file mode 100644
index 00000000..8b293428
--- /dev/null
+++ b/recipes-devtools/protobuf/files/protobuf-allow-running-python-scripts-from-anywhere.patch
@@ -0,0 +1,38 @@
1From 46e331263eb92e47510e88478b255f226d30245c Mon Sep 17 00:00:00 2001
2From: Keith Holman <Keith.Holman@windriver.com>
3Date: Mon, 18 Aug 2014 15:19:35 -0400
4Subject: [PATCH] protobuf: allow running python scripts from anywhere
5
6The Makefile to generate the examples with Google Protocol Buffers
7generates some scripts for python. However, these generated scripts
8only work if they are ran in the same directory as the source files.
9This fix generates scripts to execute from anywhere on the system.
10
11Signed-off-by: Keith Holman <Keith.Holman@windriver.com>
12---
13 examples/Makefile | 6 ++++--
14 1 file changed, 4 insertions(+), 2 deletions(-)
15
16diff --git a/examples/Makefile b/examples/Makefile
17index 8dc9083..a993d63 100644
18--- a/examples/Makefile
19+++ b/examples/Makefile
20@@ -48,11 +48,13 @@ list_people_java: javac_middleman
21 add_person_python: add_person.py protoc_middleman
22 @echo "Writing shortcut script add_person_python..."
23 @echo '#! /bin/sh' > add_person_python
24- @echo './add_person.py "$$@"' >> add_person_python
25+ @echo 'SCRIPT_DIR=$$(dirname $$0)' >> add_person_python
26+ @echo '$$SCRIPT_DIR/add_person.py "$$@"' >> add_person_python
27 @chmod +x add_person_python
28
29 list_people_python: list_people.py protoc_middleman
30 @echo "Writing shortcut script list_people_python..."
31 @echo '#! /bin/sh' > list_people_python
32- @echo './list_people.py "$$@"' >> list_people_python
33+ @echo 'SCRIPT_DIR=$$(dirname $$0)' >> list_people_python
34+ @echo '$$SCRIPT_DIR/list_people.py "$$@"' >> list_people_python
35 @chmod +x list_people_python
36--
371.9.3
38
diff --git a/recipes-devtools/protobuf/files/run-ptest b/recipes-devtools/protobuf/files/run-ptest
new file mode 100755
index 00000000..a5a7b0f9
--- /dev/null
+++ b/recipes-devtools/protobuf/files/run-ptest
@@ -0,0 +1,32 @@
1#!/bin/bash
2DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3TEST_FILE="/tmp/test.data"
4
5RETVAL=0
6# Test every writing test application
7for write_exe_full_path in ${DIR}/add_person_*; do
8 if [ -x "${write_exe_full_path}" ]; then
9 write_exe=`basename ${write_exe_full_path}`
10 echo "Generating new test file using ${write_exe}..."
11 ${write_exe_full_path} "${TEST_FILE}"
12 RETVAL=$?
13
14 # Test every reading test application
15 for read_exe_full_path in ${DIR}/list_people_*; do
16 read_exe=`basename ${read_exe_full_path}`
17 echo "Test: Write with ${write_exe}; Read with ${read_exe}..."
18 if [ -x "${read_exe_full_path}" ]; then
19 ${read_exe_full_path} "${TEST_FILE}"
20 RETVAL=$?
21 fi
22 done
23
24 # Cleanup...
25 if [ -e "${TEST_FILE}" ]; then
26 rm "${TEST_FILE}"
27 fi
28 fi
29done
30
31exit $RETVAL
32
diff --git a/recipes-devtools/protobuf/protobuf-c_0.15.bb b/recipes-devtools/protobuf/protobuf-c_0.15.bb
new file mode 100644
index 00000000..91dcb3b3
--- /dev/null
+++ b/recipes-devtools/protobuf/protobuf-c_0.15.bb
@@ -0,0 +1,20 @@
1SUMMARY = "protobuf-c"
2DESCRIPTION = "This package provides a code generator and runtime libraries to use Protocol Buffers from pure C"
3HOMEPAGE = "http://code.google.com/p/protobuf-c/"
4SECTION = "console/tools"
5LICENSE = "Apache-2.0"
6
7LIC_FILES_CHKSUM = "file://src/google/protobuf-c/protobuf-c.c;endline=33;md5=333140fae7cf8a38dc5f980ddb63704b"
8
9PR = "r0"
10
11DEPENDS = "protobuf"
12
13SRC_URI[md5sum] = "73ff0c8df50d2eee75269ad8f8c07dc8"
14SRC_URI[sha256sum] = "8fcb538e13a5431c46168fc8f2e6ad2574e2db9b684c0c72b066e24f010a0036"
15SRC_URI = "http://protobuf-c.googlecode.com/files/protobuf-c-${PV}.tar.gz \
16 file://disable_tests.patch"
17
18inherit autotools
19
20BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/protobuf/protobuf-native_2.5.0.bb b/recipes-devtools/protobuf/protobuf-native_2.5.0.bb
new file mode 100644
index 00000000..61b18a79
--- /dev/null
+++ b/recipes-devtools/protobuf/protobuf-native_2.5.0.bb
@@ -0,0 +1,20 @@
1SUMMARY = "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://COPYING.txt;md5=af6809583bfde9a31595a58bb4a24514"
10
11PR = "r0"
12
13SRC_URI[md5sum] = "b751f772bdeb2812a2a8e7202bf1dae8"
14SRC_URI[sha256sum] = "c55aa3dc538e6fd5eaf732f4eb6b98bdcb7cedb5b91d3b5bdcf29c98c293f58e"
15SRC_URI = "http://protobuf.googlecode.com/files/protobuf-${PV}.tar.gz \
16 "
17
18EXTRA_OECONF += " --with-protoc=echo --disable-shared"
19
20inherit native autotools
diff --git a/recipes-devtools/protobuf/protobuf_2.5.0.bb b/recipes-devtools/protobuf/protobuf_2.5.0.bb
new file mode 100644
index 00000000..e1c72547
--- /dev/null
+++ b/recipes-devtools/protobuf/protobuf_2.5.0.bb
@@ -0,0 +1,95 @@
1SUMMARY = "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://COPYING.txt;md5=af6809583bfde9a31595a58bb4a24514"
10
11PR = "r0"
12EXCLUDE_FROM_WORLD = "1"
13
14SRC_URI[md5sum] = "b751f772bdeb2812a2a8e7202bf1dae8"
15SRC_URI[sha256sum] = "c55aa3dc538e6fd5eaf732f4eb6b98bdcb7cedb5b91d3b5bdcf29c98c293f58e"
16SRC_URI = "http://protobuf.googlecode.com/files/protobuf-${PV}.tar.gz \
17 file://protobuf-allow-running-python-scripts-from-anywhere.patch \
18 file://run-ptest"
19
20
21EXTRA_OECONF += " --with-protoc=${STAGING_BINDIR_NATIVE}/protoc"
22inherit autotools setuptools ptest
23
24DEPENDS += "protobuf-native"
25
26PYTHON_SRC_DIR="python"
27TEST_SRC_DIR="examples"
28LANG_SUPPORT="python"
29
30do_compile() {
31 # Compile protoc compiler
32 base_do_compile
33}
34
35do_compile_ptest() {
36 # Modify makefile to use the cross-compiler
37 sed -e "s|c++|${CXX}|g" -i "${S}/${TEST_SRC_DIR}/Makefile"
38
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
65do_install() {
66 local olddir=`pwd`
67
68 # Install protoc compiler
69 autotools_do_install
70
71 # Install header files
72 export PROTOC="${STAGING_BINDIR_NATIVE}/protoc"
73 cd "${S}/${PYTHON_SRC_DIR}"
74 distutils_do_install
75
76 cd "$olddir"
77}
78
79do_install_ptest() {
80 local olddir=`pwd`
81
82 cd "${S}/${TEST_SRC_DIR}"
83 install -d "${D}/${PTEST_PATH}"
84 for i in add_person* list_people*; do
85 if [ -x "$i" ]; then
86 install "$i" "${D}/${PTEST_PATH}"
87 fi
88 done
89 cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
90
91 cd "$olddir"
92}
93
94BBCLASSEXTEND = "nativesdk"
95