Depends Package A or B possible?

I’m running into a problem where I have 2 packages that do the same thing (one based on OpenSSL the other on MbedTls) and another package (GUI) that needs one (not both) of them.
Ideally I’d like to compile both so that the user could later choose to swap to the other if they want.

Currently I’ve got both the OpenSSL and mbedtls versions of the package set to =m and they both PROVIDE desired_function

The GUI package depends on desired_function and seems to try to pull in both at the same time leading to a build conflict (can’t install B because A already provides the file XYZ).

Is this type of configuration doable?

It should be.

Your terminology is a bit vague. I get lost with "2 packages" vs. "versions of the package", so I am not quite sure if you have two separate packages or two variants of one.

Without seeing your Makefile(s), I think that :

One package, two variants in the same Makefile:
Easy one.
Have both variants to PROVIDE xxx, and make the GUI package to depend on xxx. Define one variant, e.g. xxx-openssl, as DEFAULT_VARIANT=1. Neither variant should be name as plain xxx.

Two separate packages in separate Makefiles:
More difficult.
Define a virtual empty package xxx. Have both mbedtls and openssl packages to PROVIDE xxx. Make GUI to depend on xxx. You can't define a default. You need to select one manually, or one gets selected by semi-random.

1 Like

Thanks appreciate the response. Apologies I should have been more clear, and you were right to assume they were VARIANTs.
The relevant makefile is as such:

...
define Package/openvpn/Default
  TITLE:=Open source VPN solution using $(2)
  SECTION:=net
  CATEGORY:=Network
  URL:=http://openvpn.net
  SUBMENU:=VPN
  MENU:=1
  DEPENDS:=+kmod-tun +OPENVPN_gargoyle_$(1)_ENABLE_LZO:liblzo +OPENVPN_gargoyle_$(1)_ENABLE_IPROUTE2:ip $(3)
  VARIANT:=$(1)
  PROVIDES:=openvpn openvpn-gargoyle openvpn-crypto
endef

Package/openvpn-gargoyle-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-gargoyle-openssl:libopenssl)
Package/openvpn-gargoyle-mbedtls=$(call Package/openvpn/Default,mbedtls,mbedTLS,+PACKAGE_openvpn-gargoyle-mbedtls:libmbedtls)
Package/openvpn-gargoyle-wolfssl=$(call Package/openvpn/Default,wolfssl,WolfSSL \(experimental\),+PACKAGE_openvpn-gargoyle-wolfssl:libwolfssl)
...

We don't use the default openvpn packages because there are some minor changes to the init scripts etc. For the purposes of the makefile they should behave the same. As you can see they PROVIDE openvpn-gargoyle.

The GUI package:

...
define Package/plugin-gargoyle-openvpn
	SECTION:=admin
	CATEGORY:=Administration
	SUBMENU:=Gargoyle Web Interface
	TITLE:=OpenVPN Support for Gargoyle
	DEPENDS:=+gargoyle +openvpn-gargoyle +openvpn-gargoyle-easy-rsa +liblzo +zip
	MAINTAINER:=Eric Bishop
	PKGARCH:=all
endef
...

This DEPENDS on openvpn-gargoyle.

If i set both openvpn-gargoyle-mbedtls and openvpn-gargoyle-openssl to =m, I get the conflict. I did try adding DEFAULT_VARIANT unfortunately with the same outcome.
Is there anything else that we can try? I get the feeling this case just isn't handled correctly (at all?) and it tries to drag in both variants causing the conflict.