2

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?

jsaji
  • 900
  • 1
  • 15
  • 31

3 Answers3

3

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
Roman Khimov
  • 4,807
  • 1
  • 27
  • 35
0

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

Jussi Kukkonen
  • 13,857
  • 1
  • 37
  • 54
0

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:

  1. 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 recipe

    require <PATH_FROM COREBASE-TO-THE-UPSTREAM-RECIPE>/upstream-recipe.bb
    
  2. If possible, modify the upstream recipe (preferably using a .bbappend) to simultaneously build both versions that you require.

Anders
  • 8,541
  • 1
  • 27
  • 34