[OpenWrt-Devel] A note on selects vs. DEPENDS

Felix Fietkau nbd at openwrt.org
Tue Dec 22 18:46:23 EST 2015


On 2015-12-23 00:42, Daniel Dickinson wrote:
> Hi Felix,
> 
> On 22/12/15 09:03 AM, Felix Fietkau wrote:
>> On 2015-12-22 06:02, Daniel Dickinson wrote:
>>> Hi all,
>>>
>>> I just discovered something.  It seems that in a package if you have a
>>> config section that does select PACKAGE_condition_dependency then the
>>> build succeeds but when you do opkg install, opkg does not 'know' about
>>> the dependency.
>>>
>>> That means if you have a situation like lldpd where you have a
>>> conditional dependency it is not enough to add selects to same
>>> config section as the conditional compilation flags, but you also need
>>> to add an EXTRA_DEPENDS:=$(if
>>> $(CONFIG_<conditional-compilation-flag>),conditional_dependency) line.
>>>
>>> I will be submitting a patch to lldpd with that fix, since my previous
>>> patch fixed compilation, but doesn't solve the opkg problem (although no
>>> one is likely to actually run across it because libjson-c is installed
>>> by default so it's unlikely any failure would actually occur).  (Before
>>> my patch even compilation would fail if json output was disable due to
>>> missing dependency, now you would likely never notice the problem
>>> because libjson-c is installed by default, but I discovered the issue in
>>> reference to package to which I'm adding conditional build logic in the
>>> packages feed for which the conditional dependency is not included
>>> unless the package I'm working on depends on it).
>> You should just use the normal conditional depends syntax for the
>> DEPENDS line in the package, instead of duplicating it in Config.in and
>> EXTRA_DEPENDS.
>>
>> DEPENDS:=+PACKAGE_conditional_package:selected_package
> 
> It's actually used in the context of a Package/<pkg>/config section that 
> does some condition compilation option that when enabled adds another 
> dependency.  Hence the unusual method.  Conditional dependency based on 
> the configure option I had forgotten as an option though:
> 
> i.e.
> 
> config PACKAGE_LLDPD_JSON
> bool "Enable JSON output"
> default n
> 
> and in depends
> 
> DEPENDS:=PACKAGE_LLDPD_JSON:libjson-c
DEPENDS:=+PACKAGE_LLDPD_JSON:libjson-c (the + turns it into a select).
Then you don't need to select libjson-c from the /config section.

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list