Re: How to use WORKDIR of recipe A in recipe B ?


Khem Raj
 

Hello Talel

On Tue, Oct 27, 2020 at 11:23 AM Bel Hadj Salem Talel
<bhstalel@...> wrote:

Hi All,

I have a macchina.io recipe that fetches the source from Github and compiles it correctly.

In the WORKDIR , there is a samples directory with many examples, and each example has a Makefile, here is an example :

include $(POCO_BASE)/build/rules/global
include $(POCO_BASE)/OSP/BundleCreator/BundleCreator.make
objects = BundleActivator
target = io.macchina.samples.sensor1
target_includes = $(PROJECT_BASE)/devices/Devices/include
target_libs = IoTDevices PocoOSP PocoUtil PocoJSON PocoXML PocoFoundation
postbuild = $(SET_LD_LIBRARY_PATH) $(BUNDLE_TOOL) -n$(OSNAME) -a$(OSARCH) -o../bundles HelloSensor1.bndlspec
include $(POCO_BASE)/build/rules/dylib

There is a global variable that are used when building macchina, like (POCO_BASE, BUNDLE_TOOL, ...)

Now, I don't want to make a patch for my custom sample, because that will force macchina to recompile again and that will take more than 45minutes.
I need to use the macchina WORKDIR
many options to handle such situations.
usually, workdirs is strictly specific to one recipe, no other recipe
gets to peak into it. however if you have multiple recipes needing to
access same sources again
its perhaps ok to turn it into recipe-source recipe which sets up
common sources dir and every recipe refers to it. This however only
works if you purely need to access source
and source alone. If you are depending on intermediate buils artifacts
e.g. object file libraries etc. then better approach is to add it to
your -dev package from the source recipe
during its build and then when you DEPEND = "recipeA" in your recipeB
it will automatically stage them in the recipe specific sysroot.

However in many case you need fully configured and built trees of a
package into another. then look at how kernel is sharing its build
artifacts for kernel module builds from other
recipes.


Join {yocto@lists.yoctoproject.org to automatically receive all group messages.