[OpenWrt-Devel] How to handle multiple providers?

Alexandru Ardelean ardeleanalex at gmail.com
Fri Jan 23 02:18:24 EST 2015


Well, you need to specifiy Ax in the DEPENDS section of B.
Since there are 3 Ax, you can do it 2 ways:

1) Create Bx (x = 1-3) packages; B1 depends on A1, B2 depends on A2, B3
depends on A3; so, if you select the correct Bx, the correct Ax will also
get built.
You can also use build variants to keep Bx in a single Makefile; you can
check the  package/ncurses/Makefile for hints.
The build variants does not seem too popular, but you can try it.

2) In the Makefile of B you can do a "dynamic" DEPENDS.
Before the package definition (i.e.  define Package/B ) you can add a
A_DEPENDS variable.
You can do something like:
ifeq ($(A_DEPENDS),)
   ifeq ($(CONFIG_A1),y)
        A_DEPENDS := A1
   endif
endif
ifeq ($(A_DEPENDS),)
   ifeq ($(CONFIG_A2),y)
        A_DEPENDS := A2
   endif
endif
ifeq ($(A_DEPENDS),)
   ifeq ($(CONFIG_A3),y)
        A_DEPENDS := A3
   endif
endif
A_DEPENDS should equal to either A1, A2 or A3, if either is selected. Note
that CONFIG_Ax is as defined in the .config file.
Then
define Package/B
  DEPENDS:= ............ $(A_DEPENDS)
endef

If I look at this approach, it does what you asked for.
But all in all, I would say there would be a cleaner approach if Ax and B
are known.

If the assumption would be that Ax are similar packages (or variants of a
base A), then I'd make a single package A, and define some options to it.
Based on those options A would be a variation of type Ax (x = 1 - 3).
Then
define Package/B
  DEPENDS:= ............ A
endef

And you can configure A with whatever options you need.


On Thu, Jan 22, 2015 at 8:34 PM, Mats Karrman <mats.dev.list at gmail.com>
wrote:

> Hi,
>
> I'm struggling with a problem and I can't really get it to work as I want.
>
> Say you have 3 packages, A1, A2 and A3, that all provide the include file
> "f.h".
> I also have package B that build-time depends on "f.h".
>
> I will enable either A1, A2 or A3 in the .config for a build but how do I
> make
> OpenWRT understand that it cannot build B until either of Ax is built?
>
> I'd be ever so greatfull for some good hints on how to solve this.
>
> (and oh, I'm on "Attitude-Adjustment")
>
> Best regards,
> Mats
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150123/24df9e34/attachment.htm>
-------------- next part --------------
_______________________________________________
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