Patchwork wpa-supplicant: use PACKAGECONFIG for ssl selection

login
register
mail settings
Submitter Yasir Khan
Date Aug. 5, 2014, 9:02 a.m.
Message ID <1407229341-15578-1-git-send-email-yasir_khan@mentor.com>
Download mbox | patch
Permalink /patch/77285/
State New
Headers show

Comments

Yasir Khan - Aug. 5, 2014, 9:02 a.m.
From: Yasir-Khan <yasir_khan@mentor.com>

Select between openssl or gnutls as ssl implementation via
PACKAGECONFIG instead of explicitly adding both via DEPENDS.

Signed-off-by: Yasir-Khan <yasir_khan@mentor.com>
---
 .../wpa-supplicant/wpa-supplicant.inc              |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Martin Jansa - Aug. 5, 2014, 10:17 a.m.
On Tue, Aug 05, 2014 at 02:02:21PM +0500, Yasir Khan wrote:
> From: Yasir-Khan <yasir_khan@mentor.com>
> 
> Select between openssl or gnutls as ssl implementation via
> PACKAGECONFIG instead of explicitly adding both via DEPENDS.
> 
> Signed-off-by: Yasir-Khan <yasir_khan@mentor.com>
> ---
>  .../wpa-supplicant/wpa-supplicant.inc              |   17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc
> index d9c6532..3bbe832 100644
> --- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc
> +++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc
> @@ -6,9 +6,13 @@ LICENSE = "BSD"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=ab87f20cd7e8c0d0a6539b34d3791d0e \
>                      file://README;beginline=1;endline=56;md5=a07250b28e857455336bb59fc31cb845 \
>                      file://wpa_supplicant/wpa_supplicant.c;beginline=1;endline=12;md5=e8e021e30f3a6ab7c341b66b86626a5a"
> -DEPENDS = "gnutls dbus libnl openssl libgcrypt"
> +DEPENDS = "dbus libnl libgcrypt"
>  RRECOMMENDS_${PN} = "wpa-supplicant-passphrase wpa-supplicant-cli"
>  
> +PACKAGECONFIG[defaultval] += "gnutls"

What is defaultval varflag?

We normally use PACKAGECONFIG ?= "gnutls"

> +PACKAGECONFIG[gnutls] = ",,gnutls"
> +PACKAGECONFIG[ssl] = ",,openssl"
> +
>  inherit systemd
>  
>  SYSTEMD_SERVICE_${PN} = "wpa_supplicant.service wpa_supplicant-nl80211@.service wpa_supplicant-wired@.service"
> @@ -36,6 +40,17 @@ CONFFILES_${PN} += "${sysconfdir}/wpa_supplicant.conf"
>  do_configure () {
>  	install -m 0755 ${WORKDIR}/defconfig-gnutls wpa_supplicant/.config
>  	echo "CFLAGS +=\"-I${STAGING_INCDIR}/libnl3\"" >> wpa_supplicant/.config
> +	
> +	sed -i '/CONFIG_TLS/d' wpa_supplicant/.config
> +	if echo "${PACKAGECONFIG}" | grep -qw "ssl"; then
> +        	ssl=openssl
> +	elif echo "${PACKAGECONFIG}" | grep -qw "gnutls"; then
> +        	ssl=gnutls
> +	fi
> +	if [ -n "$ssl" ]; then
> +        	echo "CONFIG_TLS = $ssl" >>wpa_supplicant/.config
> +	fi

Why don't you rename defconfig-gnutls to something generic and add
something like "CONFIG_TLS = %ssl%" there to replace it with one sed
call here based on selected implementation.

> +
>  }
>  
>  export EXTRA_CFLAGS = "${CFLAGS}"
> -- 
> 1.7.9.5
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc
index d9c6532..3bbe832 100644
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant.inc
@@ -6,9 +6,13 @@  LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://COPYING;md5=ab87f20cd7e8c0d0a6539b34d3791d0e \
                     file://README;beginline=1;endline=56;md5=a07250b28e857455336bb59fc31cb845 \
                     file://wpa_supplicant/wpa_supplicant.c;beginline=1;endline=12;md5=e8e021e30f3a6ab7c341b66b86626a5a"
-DEPENDS = "gnutls dbus libnl openssl libgcrypt"
+DEPENDS = "dbus libnl libgcrypt"
 RRECOMMENDS_${PN} = "wpa-supplicant-passphrase wpa-supplicant-cli"
 
+PACKAGECONFIG[defaultval] += "gnutls"
+PACKAGECONFIG[gnutls] = ",,gnutls"
+PACKAGECONFIG[ssl] = ",,openssl"
+
 inherit systemd
 
 SYSTEMD_SERVICE_${PN} = "wpa_supplicant.service wpa_supplicant-nl80211@.service wpa_supplicant-wired@.service"
@@ -36,6 +40,17 @@  CONFFILES_${PN} += "${sysconfdir}/wpa_supplicant.conf"
 do_configure () {
 	install -m 0755 ${WORKDIR}/defconfig-gnutls wpa_supplicant/.config
 	echo "CFLAGS +=\"-I${STAGING_INCDIR}/libnl3\"" >> wpa_supplicant/.config
+	
+	sed -i '/CONFIG_TLS/d' wpa_supplicant/.config
+	if echo "${PACKAGECONFIG}" | grep -qw "ssl"; then
+        	ssl=openssl
+	elif echo "${PACKAGECONFIG}" | grep -qw "gnutls"; then
+        	ssl=gnutls
+	fi
+	if [ -n "$ssl" ]; then
+        	echo "CONFIG_TLS = $ssl" >>wpa_supplicant/.config
+	fi
+
 }
 
 export EXTRA_CFLAGS = "${CFLAGS}"