yoctobitbakeopenembedded

Change recipe variable (e.g. EXTRA_OECMAKE) inside a bitbake task


Currently, I'm facing an odd requirement, where we have to put 2 slightly different binaries into the rootfs, and the only difference is the fact that we have an extra CMake option set for one of them.

So, the approach we took was to create a few extra tasks to be run, and add them in the correct sequence (after we copied the first binary). Everything works fine (renaming, having 2 bins, etc.).

The main issue is, we can't change EXTRA_OECMAKE during this custom do_configure task. I think it does make some sense that this is blocked... We actually can change it there using d.setVar(), although this is parsed before the whole recipe starts, so we still get 2 of the same.

Is there any nice approach that doesn't end up being:

  1. Creating a new recipe with most of the data being copied over (or generalizing most on .inc files)
  2. copying the whole cmake_do_configure out of the cmake.bbclass just to force an extra variable when running cmake

Let's know if either 1) or 2) are the best options though :)

We're currently on kirkstone.


Solution

  • (1) is the best solution where you're not fighting the system. The easiest solution is a .inc file which is 99% of the recipe and then just set the relevant option in each of your recipe-foo.bb and recipe-bar.bb files.