public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 2/2] add example how to use derived sbuild chroots
Date: Thu, 13 Apr 2023 07:00:26 +0000	[thread overview]
Message-ID: <20230413070026.3511123-2-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20230413070026.3511123-1-felix.moessbauer@siemens.com>

This patch extends the samefile recipe to use a derived sbuild chroot to
compile the tool using clang instead of gcc. While there are easier ways
to achive this goal, it is still valuable to demonstrate how to use the
infrastructure.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta-isar/recipes-app/samefile/samefile_2.14.bb       |  8 ++++++++
 .../sbuild-chroot/sbuild-chroot-target-clang.bb       | 11 +++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-clang.bb

diff --git a/meta-isar/recipes-app/samefile/samefile_2.14.bb b/meta-isar/recipes-app/samefile/samefile_2.14.bb
index c53c9445..989e1983 100644
--- a/meta-isar/recipes-app/samefile/samefile_2.14.bb
+++ b/meta-isar/recipes-app/samefile/samefile_2.14.bb
@@ -5,6 +5,9 @@
 
 inherit dpkg
 
+# for demo reasons, we compile with clang if not cross-compiling
+SBUILD_FLAVOR = "${@ 'clang' if d.getVar('ISAR_CROSS_COMPILE') != '1' else '' }"
+
 DEBIAN_DEPENDS = "\${misc:Depends}"
 DESCRIPTION = "utility that finds files with identical contents"
 
@@ -42,4 +45,9 @@ EOF
 
     # We can also customize afterwards, in this case change the package section.
     sed -i -e 's/Section: misc/Section: utils/g' ${S}/debian/control
+
+    # use clang to compile (no cross support yet)
+    if [ "${SBUILD_FLAVOR}" = "clang" ]; then
+        sed -i -e 's/\(#\!.*\)/\1\nexport CC=clang/g' ${S}/debian/rules
+    fi
 }
diff --git a/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-clang.bb b/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-clang.bb
new file mode 100644
index 00000000..3df16368
--- /dev/null
+++ b/meta-isar/recipes-devtools/sbuild-chroot/sbuild-chroot-target-clang.bb
@@ -0,0 +1,11 @@
+# Root filesystem for packages building with clang
+#
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+
+DESCRIPTION = "Isar sbuild/schroot filesystem for target (clang variant)"
+
+require recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
+
+SBUILD_FLAVOR = "clang"
+SBUILD_CHROOT_PREINSTALL_COMMON += "clang"
-- 
2.34.1


  reply	other threads:[~2023-04-13  7:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13  7:00 [PATCH 1/2] add support for " Felix Moessbauer
2023-04-13  7:00 ` Felix Moessbauer [this message]
2023-04-14  8:46   ` [PATCH 2/2] add example how to use " Jan Kiszka
2023-06-21 12:33   ` Henning Schild
2023-05-29  7:14 ` [PATCH 1/2] add support for " Uladzimir Bely
2023-06-13  6:24 ` Uladzimir Bely
2023-06-19  5:58   ` Jan Kiszka
2023-06-19 13:10     ` Moessbauer Felix
2023-06-20  6:25       ` Uladzimir Bely
2023-06-20  8:05         ` Uladzimir Bely
2023-06-20  8:51           ` Moessbauer Felix
2023-06-21 12:42     ` Henning Schild
2023-06-21 13:22       ` Moessbauer Felix
2023-06-21 13:34         ` Henning Schild
2023-06-21 13:54 ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230413070026.3511123-2-felix.moessbauer@siemens.com \
    --to=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox