openssl-nativesdk: Fix "can't open config file" warning

Submitted by Ovidiu Panait on Dec. 14, 2017, 12:26 p.m. | Patch ID: 146657

Details

Message ID 20171214122628.95611-1-ovidiu.panait@windriver.com
State New
Headers show

Commit Message

Ovidiu Panait Dec. 14, 2017, 12:26 p.m.
When SDK is not installed in the default location, openssl will not be 
able to find the the openssl.cnf config file:

"WARNING: can't open config file: XXXX/usr/lib/ssl/openssl.cnf"

To fix this, we need to provide the environment variable $OPENSSL_CONF 
pointing to the correct config file location.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 .../openssl/openssl/environment.d-openssl.sh                  |  1 +
 meta/recipes-connectivity/openssl/openssl10.inc               |  7 +++++++
 meta/recipes-connectivity/openssl/openssl_1.0.2m.bb           |  5 +++++
 meta/recipes-connectivity/openssl/openssl_1.1.0g.bb           | 11 +++++++++++
 4 files changed, 24 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/environment.d-openssl.sh

Patch hide | download patch | download mbox

diff --git a/meta/recipes-connectivity/openssl/openssl/environment.d-openssl.sh b/meta/recipes-connectivity/openssl/openssl/environment.d-openssl.sh
new file mode 100644
index 0000000..b9cc24a
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/environment.d-openssl.sh
@@ -0,0 +1 @@ 
+export OPENSSL_CONF="$OECORE_NATIVE_SYSROOT/usr/lib/ssl/openssl.cnf"
diff --git a/meta/recipes-connectivity/openssl/openssl10.inc b/meta/recipes-connectivity/openssl/openssl10.inc
index 4697755..71e80f1 100644
--- a/meta/recipes-connectivity/openssl/openssl10.inc
+++ b/meta/recipes-connectivity/openssl/openssl10.inc
@@ -271,5 +271,12 @@  do_install_append_class-native() {
 	    OPENSSL_ENGINES=${libdir}/ssl/engines
 }
 
+do_install_append_class-nativesdk() {
+    mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
+    install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
+}
+
+FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
+
 BBCLASSEXTEND = "native nativesdk"
 
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.2m.bb b/meta/recipes-connectivity/openssl/openssl_1.0.2m.bb
index 9270f52..fcb627a 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.0.2m.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.0.2m.bb
@@ -44,6 +44,11 @@  SRC_URI += "file://find.pl;subdir=openssl-${PV}/util/ \
             file://0001-openssl-force-soft-link-to-avoid-rare-race.patch  \
             file://0001-aes-armv4-bsaes-armv7-sha256-armv4-.pl-make-it-work-.patch \
             "
+
+SRC_URI_append_class-nativesdk = " \
+    file://environment.d-openssl.sh \
+   "
+
 SRC_URI[md5sum] = "10e9e37f492094b9ef296f68f24a7666"
 SRC_URI[sha256sum] = "8c6ff15ec6b319b50788f42c7abc2890c08ba5a1cdcd3810eb9092deada37b0f"
 
diff --git a/meta/recipes-connectivity/openssl/openssl_1.1.0g.bb b/meta/recipes-connectivity/openssl/openssl_1.1.0g.bb
index 53f397a..0d4c90f 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.1.0g.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.1.0g.bb
@@ -21,6 +21,10 @@  SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
            file://0001-aes-asm-aes-armv4-bsaes-armv7-.pl-make-it-work-with-.patch \
           "
 
+SRC_URI_append_class-nativesdk = " \
+    file://environment.d-openssl.sh \
+   "
+
 S = "${WORKDIR}/openssl-${PV}"
 
 inherit lib_package multilib_header ptest
@@ -143,6 +147,13 @@  do_install_append_class-native () {
         sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
 }
 
+do_install_append_class-nativesdk() {
+    mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
+    install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
+}
+
+FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
+
 do_install_ptest() {
         cp -r * ${D}${PTEST_PATH}