[RFC,2/2] Add example for build-config-snippets

Message ID 20210809102645.17414-3-Quirin.Gylstorff@siemens.com
State RFC
Headers show
Series Add bbclass to generate build configuration from snippets | expand

Commit Message

Quirin Gylstorff Aug. 9, 2021, 2:26 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta-isar/conf/local.conf.sample              |  2 +-
 .../example-build-config_0.1.bb               | 32 +++++++++++++++++++
 .../example-build-config/files/build.snippet  |  1 +
 .../example-build-config/files/build_config   |  1 +
 4 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 meta-isar/recipes-app/example-build-config/example-build-config_0.1.bb
 create mode 100644 meta-isar/recipes-app/example-build-config/files/build.snippet
 create mode 100644 meta-isar/recipes-app/example-build-config/files/build_config

Patch

diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 6cf1656..b86d618 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -178,7 +178,7 @@  CONF_VERSION = "1"
 
 #
 # The default list of extra packages to be installed.
-IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck isar-exclude-docs samefile hello isar-disable-apt-cache cowsay example-prebuilt"
+IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck isar-exclude-docs samefile hello isar-disable-apt-cache cowsay example-prebuilt example-build-config"
 
 #
 # Enable cross-compilation support
diff --git a/meta-isar/recipes-app/example-build-config/example-build-config_0.1.bb b/meta-isar/recipes-app/example-build-config/example-build-config_0.1.bb
new file mode 100644
index 0000000..c899aed
--- /dev/null
+++ b/meta-isar/recipes-app/example-build-config/example-build-config_0.1.bb
@@ -0,0 +1,32 @@ 
+# Sample application using dpkg-raw, which turns a folder (${D}) of
+# files into a .deb
+#
+# This software is a part of ISAR.
+
+DESCRIPTION = "Sample use for build-config-snippets for ISAR"
+MAINTAINER = "Your name here <you@domain.com>"
+
+inherit dpkg-raw
+inherit build-config-snippets
+BUILD_CONFIG ?= "build_config"
+
+SRC_URI += "file://${BUILD_CONFIG}"
+
+BUILD_FEATURE_libhello = ""
+BUILD_FEATURE_libhello[DEPENDS] = "libhello"
+BUILD_FEATURE_libhello[DEBIAN_DEPENDS] = "libhello"
+BUILD_FEATURE_libhello[DEBIAN_BUILD_DEPENDS] = "libhello"
+BUILD_FEATURE_libhello[BUILD_CONFIG_SNIPPETS] = "file://build.snippet"
+
+
+BUILD_FEATURES += "libhello"
+do_prepare_build[cleandirs] = "${D}/usr/share/example-build-config"
+do_prepare_build() {
+    # use deb_debianize to generate the necessary debian files
+    deb_debianize
+
+    # ${BUILD_CONFIG}.gen contains the concated build_config
+    install ${WORKDIR}/build_config.gen ${D}/usr/share/example-build-config/build_config.gen
+}
+
+
diff --git a/meta-isar/recipes-app/example-build-config/files/build.snippet b/meta-isar/recipes-app/example-build-config/files/build.snippet
new file mode 100644
index 0000000..199e48a
--- /dev/null
+++ b/meta-isar/recipes-app/example-build-config/files/build.snippet
@@ -0,0 +1 @@ 
+# build snippet test
diff --git a/meta-isar/recipes-app/example-build-config/files/build_config b/meta-isar/recipes-app/example-build-config/files/build_config
new file mode 100644
index 0000000..d95da26
--- /dev/null
+++ b/meta-isar/recipes-app/example-build-config/files/build_config
@@ -0,0 +1 @@ 
+# BUILD CONFIG EXAMPLE