meta-google: nanopb: Update from 0.4.5 -> 0.4.8

This is intended to fix some build issues with the old 0.4.5 package and
splits the generator bits out from the runtime bits. The change was
taken from meta-openembedded@341c47848d04a2114b8c794ef6e01b03c80c801a
and these files will eventually be deleted.

Change-Id: If9e5886ff584305da9057a9de79e15fe288843fb
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/nanopb/nanopb-generator_0.4.8.bb b/meta-google/recipes-google/nanopb/nanopb-generator_0.4.8.bb
new file mode 100644
index 0000000..c86750f
--- /dev/null
+++ b/meta-google/recipes-google/nanopb/nanopb-generator_0.4.8.bb
@@ -0,0 +1,14 @@
+require nanopb.inc
+
+inherit python3-dir
+
+DEPENDS = "protobuf-native"
+RDEPENDS:${PN} += "python3-protobuf"
+
+EXTRA_OECMAKE += " \
+  -Dnanopb_PYTHON_INSTDIR_OVERRIDE=${PYTHON_SITEPACKAGES_DIR} \
+  -Dnanopb_BUILD_RUNTIME=OFF \
+  -Dnanopb_BUILD_GENERATOR=ON \
+  "
+
+FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}"
diff --git a/meta-google/recipes-google/nanopb/nanopb-runtime_0.4.8.bb b/meta-google/recipes-google/nanopb/nanopb-runtime_0.4.8.bb
new file mode 100644
index 0000000..e43931a
--- /dev/null
+++ b/meta-google/recipes-google/nanopb/nanopb-runtime_0.4.8.bb
@@ -0,0 +1,17 @@
+require nanopb.inc
+
+EXTRA_OECMAKE += " \
+  -Dnanopb_PROTOC_PATH=/bin/false \
+  -DBUILD_SHARED_LIBS=ON \
+  -Dnanopb_BUILD_RUNTIME=ON \
+  -Dnanopb_BUILD_GENERATOR=OFF \
+  "
+
+# Maintain compatability with old header locations for packages
+# which haven't yet migrated to `nanopb/pb*.h`
+do_install:append() {
+  for hdr in ${D}${includedir}/nanopb/*; do
+	ln -sv nanopb/$(basename "$hdr") ${D}${includedir}/
+  done
+}
+
diff --git a/meta-google/recipes-google/nanopb/nanopb.bb b/meta-google/recipes-google/nanopb/nanopb.bb
new file mode 100644
index 0000000..7ad6a32
--- /dev/null
+++ b/meta-google/recipes-google/nanopb/nanopb.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Combined nanopb package"
+PV = "1.0"
+PR = "r1"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+inherit packagegroup
+
+DEPENDS = " \
+    nanopb-generator \
+    nanopb-runtime \
+"
+
+RDEPENDS:${PN} = " \
+    nanopb-generator \
+    nanopb-runtime \
+"
diff --git a/meta-google/recipes-google/nanopb/nanopb.inc b/meta-google/recipes-google/nanopb/nanopb.inc
new file mode 100644
index 0000000..87dbc73
--- /dev/null
+++ b/meta-google/recipes-google/nanopb/nanopb.inc
@@ -0,0 +1,13 @@
+DESCRIPTION="Protocol Buffers with small code size"
+LICENSE="Zlib"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f"
+
+SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https"
+SRCREV = "6cfe48d6f1593f8fa5c0f90437f5e6522587745e"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+BBCLASSEXTEND = "native nativesdk"
+
diff --git a/meta-google/recipes-google/nanopb/nanopb_0.4.5.bb b/meta-google/recipes-google/nanopb/nanopb_0.4.5.bb
deleted file mode 100644
index 0e8a69c..0000000
--- a/meta-google/recipes-google/nanopb/nanopb_0.4.5.bb
+++ /dev/null
@@ -1,24 +0,0 @@
-SUMMARY = "Nanopb library"
-DESCRIPTION = "Nanopb - Protocol Buffers for Embedded Systems"
-HOMEPAGE = "https://github.com/nanopb/nanopb"
-PR = "r1"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f"
-
-inherit cmake python3native
-
-SRC_URI = "git://github.com/nanopb/nanopb;branch=master;protocol=https"
-SRCREV = "f7e4140a27d9e63517b5d596bc117bd6d5248888"
-S = "${WORKDIR}/git"
-
-DEPENDS = "protobuf-native python3-protobuf"
-
-RDEPENDS:${PN}-generator += "python3 python3-protobuf"
-
-PACKAGES:prepend = "${PN}-generator ${PN}-runtime "
-
-FILES:${PN}-generator = "${libdir}/python* ${bindir}"
-
-FILES:${PN}-runtime = "${libdir}/*.so.*"
-
-BBCLASSEXTEND = "native"