Skip to contentSkip to conversation

How to use WORKDIR of recipe A in recipe B ?

DISCUSSION Bel Hadj Salem Talel 2 participants 3 messages Oct 27, 2020

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Sorry this is rest of the mail:

I need to use the macchina WORKDIR in a different recipe , so that I can compile only my sample. For example, in my recipe I export those global variable used in the Makefile like :

export POCO_BASE = ${WORKDIR_MACCHINA}
...

Any idea ?
Thanks ,Talel

#2 lore raw
In reply to Bel Hadj Salem Talel

Hello Talel

Quoted 16 lines · Bel Hadj Salem Talel

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

Quoted 4 lines

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.

Quoted 2 lines