I have 2 application, both uses the same library but the library should be build with a flag enabled in one and disabled in other. this is a static library, so at run time there won't be a conflict in runtime. But the library is separate ie, the application is build separately and the library is separate. In each configuration, the library will be build with a different name which is taken care by the makefile. This can be done manually. but now I need to add it to Yocto. In yocto, how can I build the same library 2 times in separate configuration?
3 Answers
If you're limited to .bbappend
and you don't want to duplicate the recipe, you can add some additional tasks then. In these additional tasks (after regular installation) you can do configuration/compilation/installation once again but with any kind of additional actions/variable overrides or whatever. Something like this:
do_special_configure() {
oe_runmake clean
export MAGIC_VARIABLE="magic value"
do_configure
}
do_special_compile() {
export MAGIC_VARIABLE="magic value"
do_compile
}
fakeroot do_special_install() {
export MAGIC_VARIABLE="magic value"
do_install
}
do_special_configure[dirs] = "${B}"
do_special_compile[dirs] = "${B}"
do_special_install[dirs] = "${B}"
addtask special_configure after do_install before do_special_compile
addtask special_compile after do_special_configure before do_special_install
addtask special_install after do_special_compile before do_package do_populate_sysroot

- 4,807
- 1
- 27
- 35
If the different configurations really produce different installed files, then you'll have no problems adding two separate recipes that just happen to have the same SRC_URI

- 13,857
- 1
- 37
- 54
-
the problem is i only have acces to .bbappend file. for this we need to have .bb file – jsaji Sep 28 '16 at 08:49
-
-
-
Yes but what prevents you from adding another bb file to your own layer? – Jussi Kukkonen Sep 28 '16 at 12:21
-
for that i need to copy code from the other meta-layer to my layer. this is not expected – jsaji Sep 28 '16 at 13:56
-
If you named the the library, the layer and the special configuration you need, then maybe someone could provide more accurate help.... – Jussi Kukkonen Sep 29 '16 at 07:29
Well, you can't, not without two recipes.
Your two applications, can't influence in any way, how the library is being used. Thus, your options (as long as both these two applications should be available for the same machine / distro combination) basically are:
Create a 2nd recipe (in this case, likely in your layer, though preferably in the upstream layer). If the recipe you're copying uses in
.inc
and a small.bb
that mostly includes that file, you can easily do just the same. Otherwise, your options are to either copy the recipe and modify it, or to have your new reciperequire <PATH_FROM COREBASE-TO-THE-UPSTREAM-RECIPE>/upstream-recipe.bb
If possible, modify the upstream recipe (preferably using a
.bbappend
) to simultaneously build both versions that you require.

- 8,541
- 1
- 27
- 34