commit:     4bd76936d7c51956f49a76e8f38d50044cac4f3c
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  2 20:24:23 2017 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Dec  2 21:57:35 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4bd76936

kde-frameworks/kdelibs4support: Fix build w/ LibreSSL

Closes: https://bugs.gentoo.org/637498
Package-Manager: Portage-2.3.16, Repoman-2.3.6

 kde-frameworks/kdelibs4support/Manifest            |   2 +-
 .../files/kdelibs4support-5.40.0-libressl.patch    | 208 +++++++++++++++++++++
 .../kdelibs4support/kdelibs4support-5.40.0.ebuild  |   2 +
 3 files changed, 211 insertions(+), 1 deletion(-)

diff --git a/kde-frameworks/kdelibs4support/Manifest 
b/kde-frameworks/kdelibs4support/Manifest
index 4861dc4cfb4..4fc58fa3c12 100644
--- a/kde-frameworks/kdelibs4support/Manifest
+++ b/kde-frameworks/kdelibs4support/Manifest
@@ -1,2 +1,2 @@
 DIST kdelibs4support-5.37.0.tar.xz 3339044 SHA256 
09d2a7817dbfd0aec82886fb2c5a83321d8b535a438013ed78d5611d2a00e1ff SHA512 
c56d821d8f6cea31df7a1138ff050818fd38764fc7bd63de1c125921b86f00144eac7d569c40b2fe0dcd8fc4f006a0ba8af93fba2feab2d4a3fca1a8a1fa3ca7
 WHIRLPOOL 
0a29ea6febcf441441d3c46e324dd71b5f7926b19fdcb175d360cd477e25cedbfb9e4c668d500f9d74950e4c3248d8d8476366c890f6eff62e3ccfb19e04f57d
-DIST kdelibs4support-5.40.0.tar.xz 3341884 SHA256 
f9d7508aa6a72a186ba7d922e82ca49a5ac5d76e1fa02af995d17208128995df SHA512 
ea6758a42d993af312f0231c75b77f00c0a4938dfd8efa82d443d60e553865ed59621413a651aef1443ec1d07bcc273532b11f1699382b66c0ea91e2bfdf94d1
 WHIRLPOOL 
296965cafadea8f168e0b14203421195fa2903c91dc04cd0234ce777a46b69a3cffbe3068e9ca82eaa8ba9d08e8507b47e86f7960f7d5699049c891398d75d84
+DIST kdelibs4support-5.40.0.tar.xz 3341884 BLAKE2B 
693816728db15b9e8d28fa2c01634083d11d4b3da942fd06606eaf7715e75ac14978bb9020df37ae154e4dddf740e0672fc90f561f2d467307a24f0362bb282a
 SHA512 
ea6758a42d993af312f0231c75b77f00c0a4938dfd8efa82d443d60e553865ed59621413a651aef1443ec1d07bcc273532b11f1699382b66c0ea91e2bfdf94d1

diff --git 
a/kde-frameworks/kdelibs4support/files/kdelibs4support-5.40.0-libressl.patch 
b/kde-frameworks/kdelibs4support/files/kdelibs4support-5.40.0-libressl.patch
new file mode 100644
index 00000000000..ad7cd799967
--- /dev/null
+++ b/kde-frameworks/kdelibs4support/files/kdelibs4support-5.40.0-libressl.patch
@@ -0,0 +1,208 @@
+From 00cae452ac619810f311cf63d4dfd268887d30e5 Mon Sep 17 00:00:00 2001
+From: Heiko Becker <heire...@exherbo.org>
+Date: Sun, 5 Nov 2017 22:52:54 +0100
+Subject: Fix build with LibreSSL
+
+Summary:
+Unfortunately LibreSSL sets OPENSSL_VERSION_NUMBER to
+0x20000000L and doesn't support the OpenSSL 1.1 API.
+
+Test Plan: Builds with LibreSSL
+
+Reviewers: #frameworks
+
+Tags: #frameworks
+
+Differential Revision: https://phabricator.kde.org/D8672
+---
+ src/kssl/kopenssl.cpp        | 34 +++++++++++++++++-----------------
+ src/kssl/kopenssl.h          |  2 +-
+ src/kssl/ksslcertificate.cpp |  2 +-
+ 3 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/src/kssl/kopenssl.cpp b/src/kssl/kopenssl.cpp
+index c68a134..ce5f137 100644
+--- a/src/kssl/kopenssl.cpp
++++ b/src/kssl/kopenssl.cpp
+@@ -81,7 +81,7 @@ extern "C" {
+     static void (*K_X509_LOOKUP_free)(X509_LOOKUP *) = nullptr;
+     static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int, const char *, long, 
char **) = nullptr;
+     static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 
*, STACK_OF(X509) *) = nullptr;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     static void (*K_CRYPTO_free)(void *) = nullptr;
+ #else
+     static void (*K_CRYPTO_free)(void *, const char *, int) = nullptr;
+@@ -430,7 +430,7 @@ KOpenSSLProxy::KOpenSSLProxy()
+         K_RAND_load_file = (int (*)(const char *, long)) 
d->cryptoLib->resolve("RAND_load_file");
+         K_RAND_file_name = (const char *(*)(char *, size_t)) 
d->cryptoLib->resolve("RAND_file_name");
+         K_RAND_write_file = (int (*)(const char *)) 
d->cryptoLib->resolve("RAND_write_file");
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+         K_CRYPTO_free = (void (*)(void *)) 
d->cryptoLib->resolve("CRYPTO_free");
+ #else
+         K_CRYPTO_free = (void (*)(void *, const char *, int)) 
d->cryptoLib->resolve("CRYPTO_free");
+@@ -485,7 +485,7 @@ KOpenSSLProxy::KOpenSSLProxy()
+         K_X509_STORE_CTX_get_current_cert = (X509 * (*)(X509_STORE_CTX *)) 
d->cryptoLib->resolve("X509_STORE_CTX_get_current_cert");
+         K_X509_STORE_CTX_set_error = (void (*)(X509_STORE_CTX *, int)) 
d->cryptoLib->resolve("X509_STORE_CTX_set_error");
+         K_X509_STORE_CTX_get_error = (int (*)(X509_STORE_CTX *)) 
d->cryptoLib->resolve("X509_STORE_CTX_get_error");
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+         K_OPENSSL_sk_free = (void (*)(STACK *)) 
d->cryptoLib->resolve("OPENSSL_sk_free");
+         K_OPENSSL_sk_num = (int (*)(STACK *)) 
d->cryptoLib->resolve("OPENSSL_sk_num");
+         K_OPENSSL_sk_pop = (char *(*)(STACK *)) 
d->cryptoLib->resolve("OPENSSL_sk_pop");
+@@ -979,7 +979,7 @@ void KOpenSSLProxy::X509_STORE_free(X509_STORE *v)
+ 
+ void KOpenSSLProxy::X509_STORE_set_verify_cb(X509_STORE *store, int 
(*verify_cb)(int, X509_STORE_CTX *))
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     X509_STORE_set_verify_cb_func(store, verify_cb);
+ #else
+     if (K_X509_STORE_set_verify_cb) {
+@@ -1044,7 +1044,7 @@ X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a)
+ 
+ void KOpenSSLProxy::X509_get0_signature(const ASN1_BIT_STRING **psig, const 
X509_ALGOR **algor, const X509 *x)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     if (psig) {
+         *psig = x->signature;
+     }
+@@ -1096,7 +1096,7 @@ void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX 
*ctx, X509_STORE *store,
+     }
+ }
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ void KOpenSSLProxy::CRYPTO_free(void *x)
+ {
+     if (K_CRYPTO_free) {
+@@ -1122,7 +1122,7 @@ X509 *KOpenSSLProxy::X509_dup(X509 *x509)
+ 
+ ASN1_TIME *KOpenSSLProxy::X509_getm_notBefore(const X509 *x)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return X509_get_notBefore(x);
+ #else
+     if (K_X509_getm_notBefore) {
+@@ -1135,7 +1135,7 @@ ASN1_TIME *KOpenSSLProxy::X509_getm_notBefore(const X509 
*x)
+ 
+ ASN1_TIME *KOpenSSLProxy::X509_getm_notAfter(const X509 *x)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return X509_get_notAfter(x);
+ #else
+     if (K_X509_getm_notAfter) {
+@@ -1413,7 +1413,7 @@ void 
KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v, int purpose)
+ 
+ X509 *KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *v)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return v->current_cert;
+ #else
+     if (K_X509_STORE_CTX_get_current_cert) {
+@@ -1426,7 +1426,7 @@ X509 
*KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *v)
+ 
+ void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *v, int error)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     v->error = error;
+ #else
+     if (K_X509_STORE_CTX_set_error) {
+@@ -1437,7 +1437,7 @@ void 
KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *v, int error)
+ 
+ int KOpenSSLProxy::X509_STORE_CTX_get_error(X509_STORE_CTX *v)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return v->error;
+ #else
+     if (K_X509_STORE_CTX_get_error) {
+@@ -1894,7 +1894,7 @@ int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey, int 
type, char *key)
+ 
+ int KOpenSSLProxy::EVP_PKEY_base_id(EVP_PKEY *pkey)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return pkey->type;
+ #else
+     if (K_EVP_PKEY_base_id) {
+@@ -1907,7 +1907,7 @@ int KOpenSSLProxy::EVP_PKEY_base_id(EVP_PKEY *pkey)
+ 
+ RSA *KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return pkey->pkey.rsa;
+ #else
+     if (K_EVP_PKEY_get0_RSA) {
+@@ -1920,7 +1920,7 @@ RSA *KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
+ 
+ void KOpenSSLProxy::RSA_get0_key(RSA *rsa, const BIGNUM **n, const BIGNUM 
**e, const BIGNUM **d)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     if (n) {
+         *n = rsa->n;
+     }
+@@ -1939,7 +1939,7 @@ void KOpenSSLProxy::RSA_get0_key(RSA *rsa, const BIGNUM 
**n, const BIGNUM **e, c
+ 
+ DSA *KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     return pkey->pkey.dsa;
+ #else
+     if (K_EVP_PKEY_get0_DSA) {
+@@ -1952,7 +1952,7 @@ DSA *KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
+ 
+ void KOpenSSLProxy::DSA_get0_pqg(DSA *dsa, const BIGNUM **p, const BIGNUM 
**q, const BIGNUM **g)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     if (p) {
+         *p = dsa->p;
+     }
+@@ -1971,7 +1971,7 @@ void KOpenSSLProxy::DSA_get0_pqg(DSA *dsa, const BIGNUM 
**p, const BIGNUM **q, c
+ 
+ void KOpenSSLProxy::DSA_get0_key(DSA *dsa, const BIGNUM **pub_key, const 
BIGNUM **priv_key)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     if (pub_key) {
+         *pub_key = dsa->pub_key;
+     }
+diff --git a/src/kssl/kopenssl.h b/src/kssl/kopenssl.h
+index 518cd5b..fa23efe 100644
+--- a/src/kssl/kopenssl.h
++++ b/src/kssl/kopenssl.h
+@@ -395,7 +395,7 @@ public:
+     /*
+      *   CRYPTO_free - free up an internally allocated object
+      */
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     void CRYPTO_free(void *x);
+ #else
+     void CRYPTO_free(void *x, const char *file, int line);
+diff --git a/src/kssl/ksslcertificate.cpp b/src/kssl/ksslcertificate.cpp
+index 4c96e4b..e9631fb 100644
+--- a/src/kssl/ksslcertificate.cpp
++++ b/src/kssl/ksslcertificate.cpp
+@@ -1222,7 +1222,7 @@ QByteArray KSSLCertificate::toNetscape()
+ {
+     QByteArray qba;
+      // no equivalent in OpenSSL 1.1.0 (?), so behave as if we had no OpenSSL 
at all
+-#if KSSL_HAVE_SSL && OPENSSL_VERSION_NUMBER < 0x10100000L
++#if KSSL_HAVE_SSL && (OPENSSL_VERSION_NUMBER < 0x10100000L || 
defined(LIBRESSL_VERSION_NUMBER))
+     NETSCAPE_X509 nx;
+     ASN1_OCTET_STRING hdr;
+     QTemporaryFile ktf;
+-- 
+cgit v0.11.2
+

diff --git a/kde-frameworks/kdelibs4support/kdelibs4support-5.40.0.ebuild 
b/kde-frameworks/kdelibs4support/kdelibs4support-5.40.0.ebuild
index 705c2f4ded1..0e6ea402f0f 100644
--- a/kde-frameworks/kdelibs4support/kdelibs4support-5.40.0.ebuild
+++ b/kde-frameworks/kdelibs4support/kdelibs4support-5.40.0.ebuild
@@ -76,6 +76,8 @@ RDEPEND="${COMMON_DEPEND}
 
 RESTRICT+=" test"
 
+PATCHES=( "${FILESDIR}/${P}-libressl.patch" )
+
 src_configure() {
        local mycmakeargs=(
                $(cmake-utils_use_find_package X X11)

Reply via email to