[LEDE-DEV] Need help with package dependencies
Daniel Dickinson
lede at cshore.thecshore.com
Thu Oct 20 15:31:31 PDT 2016
On Tue, 18 Oct 2016 13:09:22 +0200
Zefir Kurtisi <zefir.kurtisi at neratec.com> wrote:
> Hi,
>
> to those understanding the package dependency logic by heart, I'm
> trying to achieve something I assumed to be common, but fail to get
> there with the help of the available documentation.
>
> The short version is this:
> * package A has an optional feature X provided by package B
> * package B is optional (feeds package)
> => feature X should be selectable only if B is installed and
> selected
> * if feature X is activated, package A depends from package B
>
> I did:
> 1) in Config.in of package A add
> config WITH_FEATURE_X
> bool
> depends on PACKAGE_B
> prompt "Enable feature X"
> default n
>
> 2) in Makefile of package A add
> DEPENDS += +WITH_FEATURE_X:B
>
>
> With those changes, build fails due to recursive dependencies, because
> - symbol PACKAGE_B is selected by WITH_FEATURE_X
> - symbol WITH_FEATURE_X depends on PACKAGE_B
>
> If I leave out the additional line in Makefile of A and in menu select
> WITH_FEATURE_X, the build of A fails with missing dependency to
> package B.
>
> If I leave out the 'depends on PACKAGE_B' line in Config.in, I can
> select WITH_FEATURE_X without package B even being installed, which
> obviously fails building.
>
>
> Is this doable out of the box? What am I missing?
Try the following:
1) Replace 'depends on PACKAGE_B' with 'select PACKAGE_B'
2) Replace DEPENDS+= +WITH_FEATURE_X:B with
EXTRA_DEPENDS:=$(if $(CONFIG_WITH_FEAURE_X),B)
That means that if WITH_FEATURE_X is selected that the package will
select (mark for build) rather than just depend on (refuse to build
unless package is selected) package B, and the EXTRA_DEPENDS makes sure
opkg has the dependency if WITH_FEATURE_X is selected.
Another possibility is:
DEPENDS+= +@(WITH_FEATURE_X&&PACKAGE_B):B
which ends up with a dependency on WITH_FEATURE_X and PACKAGE_B - the
disadvantage of this approach is that it means if the user does not
select package B but WITH_FEATURE_X is selected then the package will
disappear from menuconfig.
Regards,
Daniel
More information about the Lede-dev
mailing list