qt5: update to 5.8.0

No longer build examples but just install the source in qt5-examples.
New submodule qt5-speech.
This commit is contained in:
Jürgen Buchmüller 2017-02-26 13:44:12 +01:00
parent 08d81bd14b
commit 013674e3a8
20 changed files with 1274 additions and 290 deletions

View file

@ -1916,6 +1916,7 @@ libQt5EglDeviceIntegration.so.5 qt5-5.6.0_1
libQt5EglFsKmsSupport.so.5 qt5-5.7.1_1
libQt5WebKit.so.5 qt5-webkit-5.6.0_1
libQt5WebKitWidgets.so.5 qt5-webkit-5.6.0_1
libQt5TextToSpeech.so.5 qt5-speech-5.8.0_1
libx265.so.102 x265-2.2_1
libQt5Xdg.so.2 libqtxdg-2.0.0_1
libQt5XdgIconLoader.so.2 libqtxdg-2.0.0_1

1
srcpkgs/qt5-speech Symbolic link
View file

@ -0,0 +1 @@
qt5

1
srcpkgs/qt5-speech-devel Symbolic link
View file

@ -0,0 +1 @@
qt5

View file

@ -1,39 +0,0 @@
--- qtwebengine/src/3rdparty/chromium/build/compiler_version.py 2016-05-26 14:58:54.000000000 +0200
+++ qtwebengine/src/3rdparty/chromium/build/compiler_version.py 2016-08-08 20:46:31.311068824 +0200
@@ -41,7 +41,9 @@
"""Look up an environment variable from a possible list of variable names."""
for var in var_list:
if var in os.environ:
- return os.environ[var]
+ val = os.environ[var]
+ if val != "":
+ return val
return default
--- qtwebengine/src/3rdparty/ninja/configure.py 2016-05-26 14:58:54.000000000 +0200
+++ qtwebengine/src/3rdparty/ninja/configure.py 2016-08-08 20:58:43.594054074 +0200
@@ -245,6 +245,8 @@
n.newline()
CXX = configure_env.get('CXX', 'g++')
+if CXX == '':
+ CXX = 'g++'
objext = '.o'
if platform.is_msvc():
CXX = 'cl'
@@ -270,9 +272,12 @@
n.variable('builddir', 'build')
n.variable('cxx', CXX)
if platform.is_msvc():
- n.variable('ar', 'link')
+ AR = 'link'
else:
- n.variable('ar', configure_env.get('AR', 'ar'))
+ AR = configure_env.get('AR', 'ar')
+ if AR == '':
+ AR = 'ar'
+n.variable('ar', AR)
if platform.is_msvc():
cflags = ['/showIncludes',

View file

@ -1,33 +1,6 @@
The checks for OPENSSL_VERSION_NUMBER > 0x10002000 are used to
enable openssl specific macros and functions which libressl
obviously does not provide, thus add some additional tests
to disable that code for libressl.
--- qtbase/src/network/ssl/qsslcontext_openssl.cpp 2015-06-29 22:04:46.000000000 +0200
+++ qtbase/src/network/ssl/qsslcontext_openssl.cpp 2015-07-04 03:51:25.926570550 +0200
@@ -338,7 +338,7 @@
const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
if (!qcurves.isEmpty()) {
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC) && defined(SSL_CTRL_SET_CURVES)
// Set the curves to be used
if (q_SSLeay() >= 0x10002000L) {
// SSL_CTX_ctrl wants a non-const pointer as last argument,
--- qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp 2015-06-29 22:04:46.000000000 +0200
+++ qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp 2015-07-04 03:58:29.430569295 +0200
@@ -406,7 +406,7 @@
DEFINEFUNC(EC_KEY *, EC_KEY_new_by_curve_name, int nid, nid, return 0, return)
DEFINEFUNC(void, EC_KEY_free, EC_KEY *ecdh, ecdh, return, DUMMYARG)
DEFINEFUNC2(size_t, EC_get_builtin_curves, EC_builtin_curve * r, r, size_t nitems, nitems, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC(int, EC_curve_nist2nid, const char *name, name, return 0, return)
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
#endif // OPENSSL_NO_EC
--- qtbase/src/network/ssl/qsslellipticcurve_openssl.cpp 2015-07-04 04:05:26.110568061 +0200
+++ qtbase/src/network/ssl/qsslellipticcurve_openssl.cpp 2015-07-04 04:06:01.709567956 +0200
@@ -76,7 +76,7 @@
--- qtbase/src/network/ssl/qsslellipticcurve_openssl.cpp 2017-01-18 15:20:58.000000000 +0100
+++ qtbase/src/network/ssl/qsslellipticcurve_openssl.cpp 2017-02-21 16:25:56.477986158 +0100
@@ -82,7 +82,7 @@
int nid = q_OBJ_sn2nid(curveNameLatin1.data());
@ -36,41 +9,396 @@ to disable that code for libressl.
if (nid == 0 && q_SSLeay() >= 0x10002000L)
nid = q_EC_curve_nist2nid(curveNameLatin1.data());
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
--- qtwebengine/src/3rdparty/chromium/net/third_party/nss/ssl/ssl3con.c.orig 2016-03-19 08:55:45.519280715 +0100
+++ qtwebengine/src/3rdparty/chromium/net/third_party/nss/ssl/ssl3con.c 2016-03-19 08:58:17.419007495 +0100
@@ -2088,8 +2088,8 @@ ssl3_ChaCha20Poly1305(
param.len = sizeof(aeadParams);
param.data = (unsigned char *) &aeadParams;
memset(&aeadParams, 0, sizeof(aeadParams));
- aeadParams.pIv = (unsigned char *) additionalData;
- aeadParams.ulIvLen = 8;
+ aeadParams.pNonce = (unsigned char *) additionalData;
+ aeadParams.ulNonceLen = 8;
aeadParams.pAAD = (unsigned char *) additionalData;
aeadParams.ulAADLen = additionalDataLen;
aeadParams.ulTagLen = tagSize;
--- qtbase/src/network/ssl/qsslsocket_openssl_symbols_p.h 2016-12-01 09:17:04.000000000 +0100
+++ qtbase/src/network/ssl/qsslsocket_openssl_symbols_p.h 2016-12-19 23:09:01.362450092 +0100
@@ -489,9 +489,9 @@
int q_EC_curve_nist2nid(const char *name);
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
#endif // OPENSSL_NO_EC
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && defined(SSL_CTRL_GET_SERVER_TEMP_KEY)
#define q_SSL_get_server_tmp_key(ssl, key) q_SSL_ctrl((ssl), SSL_CTRL_GET_SERVER_TMP_KEY, 0, (char *)key)
-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
+#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) && defined(SSL_CTRL_GET_SERVER_TEMP_KEY)
--- qtbase/src/network/ssl/qsslsocket_openssl.cpp 2017-01-18 15:20:58.000000000 +0100
+++ qtbase/src/network/ssl/qsslsocket_openssl.cpp 2017-02-21 19:12:22.200604090 +0100
@@ -94,7 +94,7 @@
bool QSslSocketPrivate::s_loadedCiphersAndCerts = false;
bool QSslSocketPrivate::s_loadRootCertsOnDemand = false;
// PKCS#12 support
int q_PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca);
--- qtbase/src/network/ssl/qsslsocket_openssl.cpp 2016-12-01 09:17:04.000000000 +0100
+++ qtbase/src/network/ssl/qsslsocket_openssl.cpp 2016-12-19 23:12:19.584374209 +0100
@@ -1587,7 +1587,7 @@
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
int QSslSocketBackendPrivate::s_indexForSSLExtraData = -1;
#endif
@@ -191,7 +191,7 @@
return (quintptr)QThread::currentThreadId();
}
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
static unsigned int q_ssl_psk_client_callback(SSL *ssl,
const char *hint,
char *identity, unsigned int max_identity_len,
@@ -328,7 +328,7 @@
options = SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3;
else if (protocol == QSsl::TlsV1_0OrLater)
options = SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3;
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
// Choosing Tlsv1_1OrLater or TlsV1_2OrLater on OpenSSL < 1.0.1
// will cause an error in QSslContext::fromConfiguration, meaning
// we will never get here.
@@ -437,13 +437,13 @@
else
q_SSL_set_accept_state(ssl);
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
// Save a pointer to this object into the SSL structure.
if (q_SSLeay() >= 0x10001000L)
q_SSL_set_ex_data(ssl, s_indexForSSLExtraData, this);
#endif
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
// Set the client callback for PSK
if (q_SSLeay() >= 0x10001000L) {
if (mode == QSslSocket::SslClientMode)
@@ -506,7 +506,7 @@
q_SSL_load_error_strings();
q_OpenSSL_add_all_algorithms();
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
if (q_SSLeay() >= 0x10001000L)
QSslSocketBackendPrivate::s_indexForSSLExtraData = q_SSL_get_ex_new_index(0L, NULL, NULL, NULL, NULL);
#endif
@@ -1594,7 +1594,7 @@
}
}
-#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
+#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
configuration.nextProtocolNegotiationStatus = sslContextPointer->npnContext().status;
if (sslContextPointer->npnContext().status == QSslConfiguration::NextProtocolNegotiationUnsupported) {
@@ -1603,7 +1603,7 @@
} else {
const unsigned char *proto = 0;
unsigned int proto_len = 0;
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
if (q_SSLeay() >= 0x10002000L) {
q_SSL_get0_alpn_selected(ssl, &proto, &proto_len);
if (proto_len && mode == QSslSocket::SslClientMode) {
@@ -1626,7 +1626,7 @@
}
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && defined(SSL_CTRL_GET_SERVER_TMP_KEY)
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
if (q_SSLeay() >= 0x10002000L && mode == QSslSocket::SslClientMode) {
EVP_PKEY *key;
if (q_SSL_get_server_tmp_key(ssl, &key))
--- qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp 2017-01-18 15:20:58.000000000 +0100
+++ qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp 2017-02-21 19:14:32.805677245 +0100
@@ -151,7 +151,7 @@
DEFINEFUNC(BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return 0, return)
DEFINEFUNC3(int, BIO_write, BIO *a, a, const void *b, b, int c, c, return -1, return)
DEFINEFUNC(int, BN_num_bits, const BIGNUM *a, a, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return)
#endif
DEFINEFUNC2(BN_ULONG, BN_mod_word, const BIGNUM *a, a, BN_ULONG w, w, return -1, return)
@@ -300,17 +300,17 @@
DEFINEFUNC(void, SSL_SESSION_free, SSL_SESSION *ses, ses, return, DUMMYARG)
DEFINEFUNC(SSL_SESSION*, SSL_get1_session, SSL *ssl, ssl, return 0, return)
DEFINEFUNC(SSL_SESSION*, SSL_get_session, const SSL *ssl, ssl, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC5(int, SSL_get_ex_new_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return)
DEFINEFUNC3(int, SSL_set_ex_data, SSL *ssl, ssl, int idx, idx, void *arg, arg, return 0, return)
DEFINEFUNC2(void *, SSL_get_ex_data, const SSL *ssl, ssl, int idx, idx, return NULL, return)
#endif
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC2(void, SSL_set_psk_client_callback, SSL* ssl, ssl, q_psk_client_callback_t callback, callback, return, DUMMYARG)
DEFINEFUNC2(void, SSL_set_psk_server_callback, SSL* ssl, ssl, q_psk_server_callback_t callback, callback, return, DUMMYARG)
DEFINEFUNC2(int, SSL_CTX_use_psk_identity_hint, SSL_CTX* ctx, ctx, const char *hint, hint, return 0, return)
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#ifndef OPENSSL_NO_SSL2
DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
#endif
@@ -319,7 +319,7 @@
#endif
DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC(const SSL_METHOD *, TLSv1_1_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_2_client_method, DUMMYARG, DUMMYARG, return 0, return)
#endif
@@ -331,7 +331,7 @@
#endif
DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC(const SSL_METHOD *, TLSv1_1_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_2_server_method, DUMMYARG, DUMMYARG, return 0, return)
#endif
@@ -414,7 +414,7 @@
DEFINEFUNC(const char *, SSLeay_version, int a, a, return 0, return)
DEFINEFUNC2(int, i2d_SSL_SESSION, SSL_SESSION *in, in, unsigned char **pp, pp, return 0, return)
DEFINEFUNC3(SSL_SESSION *, d2i_SSL_SESSION, SSL_SESSION **a, a, const unsigned char **pp, pp, long length, length, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
+#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC6(int, SSL_select_next_proto, unsigned char **out, out, unsigned char *outlen, outlen,
const unsigned char *in, in, unsigned int inlen, inlen,
const unsigned char *client, client, unsigned int client_len, client_len,
@@ -427,7 +427,7 @@
void *arg, arg, return, DUMMYARG)
DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s,
const unsigned char **data, data, unsigned *len, len, return, DUMMYARG)
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC3(int, SSL_set_alpn_protos, SSL *s, s, const unsigned char *protos, protos,
unsigned protos_len, protos_len, return -1, return)
DEFINEFUNC3(void, SSL_CTX_set_alpn_select_cb, SSL_CTX *s, s,
@@ -451,7 +451,7 @@
DEFINEFUNC(EC_KEY *, EC_KEY_new_by_curve_name, int nid, nid, return 0, return)
DEFINEFUNC(void, EC_KEY_free, EC_KEY *ecdh, ecdh, return, DUMMYARG)
DEFINEFUNC2(size_t, EC_get_builtin_curves, EC_builtin_curve * r, r, size_t nitems, nitems, return 0, return)
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
DEFINEFUNC(int, EC_curve_nist2nid, const char *name, name, return 0, return)
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
#endif // OPENSSL_NO_EC
@@ -791,7 +791,7 @@
RESOLVEFUNC(EC_GROUP_get_degree)
#endif
RESOLVEFUNC(BN_num_bits)
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(BN_is_word)
#endif
RESOLVEFUNC(BN_mod_word)
@@ -912,12 +912,12 @@
RESOLVEFUNC(SSL_SESSION_free)
RESOLVEFUNC(SSL_get1_session)
RESOLVEFUNC(SSL_get_session)
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(SSL_get_ex_new_index)
RESOLVEFUNC(SSL_set_ex_data)
RESOLVEFUNC(SSL_get_ex_data)
#endif
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(SSL_set_psk_client_callback)
RESOLVEFUNC(SSL_set_psk_server_callback)
RESOLVEFUNC(SSL_CTX_use_psk_identity_hint)
@@ -931,7 +931,7 @@
#endif
RESOLVEFUNC(SSLv23_client_method)
RESOLVEFUNC(TLSv1_client_method)
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(TLSv1_1_client_method)
RESOLVEFUNC(TLSv1_2_client_method)
#endif
@@ -943,7 +943,7 @@
#endif
RESOLVEFUNC(SSLv23_server_method)
RESOLVEFUNC(TLSv1_server_method)
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(TLSv1_1_server_method)
RESOLVEFUNC(TLSv1_2_server_method)
#endif
@@ -999,12 +999,12 @@
RESOLVEFUNC(SSLeay_version)
RESOLVEFUNC(i2d_SSL_SESSION)
RESOLVEFUNC(d2i_SSL_SESSION)
-#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
+#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(SSL_select_next_proto)
RESOLVEFUNC(SSL_CTX_set_next_proto_select_cb)
RESOLVEFUNC(SSL_get0_next_proto_negotiated)
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
RESOLVEFUNC(SSL_set_alpn_protos)
RESOLVEFUNC(SSL_CTX_set_alpn_select_cb)
RESOLVEFUNC(SSL_get0_alpn_selected)
@@ -1020,7 +1020,7 @@
RESOLVEFUNC(EC_KEY_new_by_curve_name)
RESOLVEFUNC(EC_KEY_free)
RESOLVEFUNC(EC_get_builtin_curves)
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
if (q_SSLeay() >= 0x10002000L)
RESOLVEFUNC(EC_curve_nist2nid)
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
--- qtbase/src/network/ssl/qsslsocket_openssl_symbols_p.h 2017-01-18 15:20:58.000000000 +0100
+++ qtbase/src/network/ssl/qsslsocket_openssl_symbols_p.h 2017-02-21 19:15:38.083714302 +0100
@@ -228,7 +228,7 @@
Q_AUTOTEST_EXPORT BIO_METHOD *q_BIO_s_mem();
Q_AUTOTEST_EXPORT int q_BIO_write(BIO *a, const void *b, int c);
int q_BN_num_bits(const BIGNUM *a);
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
int q_BN_is_word(BIGNUM *a, BN_ULONG w);
#else
// BN_is_word is implemented purely as a
@@ -241,7 +241,7 @@
//
// Users are required to include <openssl/bn.h>.
#define q_BN_is_word BN_is_word
-#endif // OPENSSL_VERSION_NUMBER >= 0x10100000L
+#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
BN_ULONG q_BN_mod_word(const BIGNUM *a, BN_ULONG w);
#ifndef OPENSSL_NO_EC
const EC_GROUP* q_EC_KEY_get0_group(const EC_KEY* k);
@@ -387,19 +387,19 @@
void q_SSL_SESSION_free(SSL_SESSION *ses);
SSL_SESSION *q_SSL_get1_session(SSL *ssl);
SSL_SESSION *q_SSL_get_session(const SSL *ssl);
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
int q_SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int q_SSL_set_ex_data(SSL *ssl, int idx, void *arg);
void *q_SSL_get_ex_data(const SSL *ssl, int idx);
#endif
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
typedef unsigned int (*q_psk_client_callback_t)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len);
void q_SSL_set_psk_client_callback(SSL *ssl, q_psk_client_callback_t callback);
typedef unsigned int (*q_psk_server_callback_t)(SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len);
void q_SSL_set_psk_server_callback(SSL *ssl, q_psk_server_callback_t callback);
int q_SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
-#endif // OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#endif // (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#ifndef OPENSSL_NO_SSL2
const SSL_METHOD *q_SSLv2_client_method();
#endif
@@ -509,13 +509,13 @@
// EC curves management
size_t q_EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
int q_EC_curve_nist2nid(const char *name);
-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
+#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
#endif // OPENSSL_NO_EC
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
#define q_SSL_get_server_tmp_key(ssl, key) q_SSL_ctrl((ssl), SSL_CTRL_GET_SERVER_TMP_KEY, 0, (char *)key)
-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
+#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
// PKCS#12 support
int q_PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca);
@@ -573,7 +573,7 @@
int q_i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
SSL_SESSION *q_d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length);
-#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
+#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
int q_SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen,
const unsigned char *client, unsigned int client_len);
@@ -585,7 +585,7 @@
void *arg);
void q_SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
unsigned *len);
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
int q_SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,
unsigned protos_len);
void q_SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
@@ -598,7 +598,7 @@
void q_SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,
unsigned *len);
#endif
-#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
+#endif // (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
// Helper function
class QDateTime;
--- qtbase/src/network/ssl/qsslcontext_openssl.cpp 2017-01-18 15:20:58.000000000 +0100
+++ qtbase/src/network/ssl/qsslcontext_openssl.cpp 2017-02-21 19:23:04.291975945 +0100
@@ -126,7 +126,7 @@
sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_client_method() : q_TLSv1_server_method());
break;
case QSsl::TlsV1_1:
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_1_client_method() : q_TLSv1_1_server_method());
#else
// TLS 1.1 not supported by the system, but chosen deliberately -> error
@@ -135,7 +135,7 @@
#endif
break;
case QSsl::TlsV1_2:
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
sslContext->ctx = q_SSL_CTX_new(client ? q_TLSv1_2_client_method() : q_TLSv1_2_server_method());
#else
// TLS 1.2 not supported by the system, but chosen deliberately -> error
@@ -149,7 +149,7 @@
break;
case QSsl::TlsV1_1OrLater:
case QSsl::TlsV1_2OrLater:
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(LIBRESSL_VERSION_NUMBER)
// Specific protocols will be specified via SSL options.
sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv23_client_method() : q_SSLv23_server_method());
#else
@@ -330,7 +330,7 @@
}
#ifndef OPENSSL_NO_EC
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
if (q_SSLeay() >= 0x10002000L) {
q_SSL_CTX_ctrl(sslContext->ctx, SSL_CTRL_SET_ECDH_AUTO, 1, NULL);
} else
@@ -344,14 +344,14 @@
}
#endif // OPENSSL_NO_EC
-#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+#if (OPENSSL_VERSION_NUMBER >= 0x10001000L) && !defined(OPENSSL_NO_PSK) && !defined(LIBRESSL_VERSION_NUMBER)
if (!client)
q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData());
#endif // OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
if (!qcurves.isEmpty()) {
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(OPENSSL_NO_EC) && !defined(LIBRESSL_VERSION_NUMBER)
// Set the curves to be used
if (q_SSLeay() >= 0x10002000L) {
// SSL_CTX_ctrl wants a non-const pointer as last argument,
@@ -387,7 +387,7 @@
return sslContext;
}
-#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
+#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
static int next_proto_cb(SSL *, unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen, void *arg)
@@ -447,7 +447,7 @@
}
}
-#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
+#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL) && !defined(OPENSSL_NO_NEXTPROTONEG) && !defined(LIBRESSL_VERSION_NUMBER)
QList<QByteArray> protocols = sslConfiguration.d->nextAllowedProtocols;
if (!protocols.isEmpty()) {
m_supportedNPNVersions.clear();
@@ -462,7 +462,7 @@
m_npnContext.data = reinterpret_cast<unsigned char *>(m_supportedNPNVersions.data());
m_npnContext.len = m_supportedNPNVersions.count();
m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone;
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
if (q_SSLeay() >= 0x10002000L) {
// Callback's type has a parameter 'const unsigned char ** out'
// since it was introduced in 1.0.2. Internally, OpenSSL's own code

View file

@ -0,0 +1,248 @@
From 3bd0fd8f97e7a33a874929a383a42e6c710bfff3 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Sat, 17 Dec 2016 06:20:06 +0000
Subject: [PATCH] QSFPM: Fix handling of source model layout change
In sourceLayoutAboutToBeChanged the source model update is ignored if
the affected parents are filtered out anyway. The same logic is
attempted in the sourceLayoutChanged slot, but there the early-return
logic is applied too late - the mapping is cleared before performing the
early-return. Because pointers into the mapping are used in the
internalPointer of QModelIndexes in this class, persistent indexes used
later will segfault when attempting to dereference it.
Additionally, if a parent becomes invalid as a result of the
layoutChange, it would be filtered out by the condition in the loop,
resulting in a different result in the comparison of emptiness of the
parents container.
Fix that by persisting the parent's container, and performing the test
for early-return before clearing the mapping.
Task-number: QTBUG-47711
Task-number: QTBUG-32981
Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/corelib/itemmodels/qsortfilterproxymodel.cpp | 31 ++---
.../tst_qsortfilterproxymodel.cpp | 126 +++++++++++++++++++++
2 files changed, 137 insertions(+), 20 deletions(-)
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index b0ddfa8..3331521 100644
--- qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -171,6 +171,7 @@ class QSortFilterProxyModelPrivate : public QAbstractProxyModelPrivate
QRowsRemoval itemsBeingRemoved;
QModelIndexPairList saved_persistent_indexes;
+ QList<QPersistentModelIndex> saved_layoutChange_parents;
QHash<QModelIndex, Mapping *>::const_iterator create_mapping(
const QModelIndex &source_parent) const;
@@ -1331,23 +1332,23 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
saved_persistent_indexes.clear();
- QList<QPersistentModelIndex> parents;
+ saved_layoutChange_parents.clear();
for (const QPersistentModelIndex &parent : sourceParents) {
if (!parent.isValid()) {
- parents << QPersistentModelIndex();
+ saved_layoutChange_parents << QPersistentModelIndex();
continue;
}
const QModelIndex mappedParent = q->mapFromSource(parent);
// Might be filtered out.
if (mappedParent.isValid())
- parents << mappedParent;
+ saved_layoutChange_parents << mappedParent;
}
// All parents filtered out.
- if (!sourceParents.isEmpty() && parents.isEmpty())
+ if (!sourceParents.isEmpty() && saved_layoutChange_parents.isEmpty())
return;
- emit q->layoutAboutToBeChanged(parents);
+ emit q->layoutAboutToBeChanged(saved_layoutChange_parents);
if (persistent.indexes.isEmpty())
return;
@@ -1359,6 +1360,9 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
Q_Q(QSortFilterProxyModel);
Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
+ if (!sourceParents.isEmpty() && saved_layoutChange_parents.isEmpty())
+ return;
+
// Optimize: We only actually have to clear the mapping related to the contents of
// sourceParents, not everything.
qDeleteAll(source_index_mapping);
@@ -1373,21 +1377,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
source_index_mapping.clear();
}
- QList<QPersistentModelIndex> parents;
- for (const QPersistentModelIndex &parent : sourceParents) {
- if (!parent.isValid()) {
- parents << QPersistentModelIndex();
- continue;
- }
- const QModelIndex mappedParent = q->mapFromSource(parent);
- if (mappedParent.isValid())
- parents << mappedParent;
- }
-
- if (!sourceParents.isEmpty() && parents.isEmpty())
- return;
-
- emit q->layoutChanged(parents);
+ emit q->layoutChanged(saved_layoutChange_parents);
+ saved_layoutChange_parents.clear();
}
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 38e3c68..6b98d9f 100644
--- qtbase/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ qtbase/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -145,6 +145,8 @@ private slots:
void canDropMimeData();
void filterHint();
+ void sourceLayoutChangeLeavesValidPersistentIndexes();
+
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
void checkHierarchy(const QStringList &data, const QAbstractItemModel *model);
@@ -4181,5 +4183,129 @@ void tst_QSortFilterProxyModel::filterHint()
QAbstractItemModel::NoLayoutChangeHint);
}
+/**
+
+ Creates a model where each item has one child, to a set depth,
+ and the last item has no children. For a model created with
+ setDepth(4):
+
+ - 1
+ - - 2
+ - - - 3
+ - - - - 4
+*/
+class StepTreeModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ StepTreeModel(QObject * parent = 0)
+ : QAbstractItemModel(parent), m_depth(0) {}
+
+ int columnCount(const QModelIndex& = QModelIndex()) const override { return 1; }
+
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override
+ {
+ quintptr parentId = (parent.isValid()) ? parent.internalId() : 0;
+ return (parentId < m_depth) ? 1 : 0;
+ }
+
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override
+ {
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ return QString::number(index.internalId());
+ }
+
+ QModelIndex index(int, int, const QModelIndex& parent = QModelIndex()) const override
+ {
+ quintptr parentId = (parent.isValid()) ? parent.internalId() : 0;
+ if (parentId >= m_depth)
+ return QModelIndex();
+
+ return createIndex(0, 0, parentId + 1);
+ }
+
+ QModelIndex parent(const QModelIndex& index) const override
+ {
+ if (index.internalId() == 0)
+ return QModelIndex();
+
+ return createIndex(0, 0, index.internalId() - 1);
+ }
+
+ void setDepth(quintptr depth)
+ {
+ int parentIdWithLayoutChange = (m_depth < depth) ? m_depth : depth;
+
+ QList<QPersistentModelIndex> parentsOfLayoutChange;
+ parentsOfLayoutChange.push_back(createIndex(0, 0, parentIdWithLayoutChange));
+
+ layoutAboutToBeChanged(parentsOfLayoutChange);
+
+ auto existing = persistentIndexList();
+
+ QList<QModelIndex> updated;
+
+ for (auto idx : existing) {
+ if (indexDepth(idx) <= depth)
+ updated.push_back(idx);
+ else
+ updated.push_back({});
+ }
+
+ m_depth = depth;
+
+ changePersistentIndexList(existing, updated);
+
+ layoutChanged(parentsOfLayoutChange);
+ }
+
+private:
+ static quintptr indexDepth(QModelIndex const& index)
+ {
+ return (index.isValid()) ? 1 + indexDepth(index.parent()) : 0;
+ }
+
+private:
+ quintptr m_depth;
+};
+
+void tst_QSortFilterProxyModel::sourceLayoutChangeLeavesValidPersistentIndexes()
+{
+ StepTreeModel model;
+ Q_SET_OBJECT_NAME(model);
+ model.setDepth(4);
+
+ QSortFilterProxyModel proxy1;
+ proxy1.setSourceModel(&model);
+ Q_SET_OBJECT_NAME(proxy1);
+
+ proxy1.setFilterRegExp("1|2");
+
+ // The current state of things:
+ // model proxy
+ // - 1 - 1
+ // - - 2 - - 2
+ // - - - 3
+ // - - - - 4
+
+ // The setDepth call below removes '4' with a layoutChanged call.
+ // Because the proxy filters that out anyway, the proxy doesn't need
+ // to emit any signals or update persistent indexes.
+
+ QPersistentModelIndex persistentIndex = proxy1.index(0, 0, proxy1.index(0, 0));
+
+ model.setDepth(3);
+
+ // Calling parent() causes the internalPointer to be used.
+ // Before fixing QTBUG-47711, that could be a dangling pointer.
+ // The use of qDebug here makes sufficient use of the heap to
+ // cause corruption at runtime with normal use on linux (before
+ // the fix). valgrind confirms the fix.
+ qDebug() << persistentIndex.parent();
+ QVERIFY(persistentIndex.parent().isValid());
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"

View file

@ -0,0 +1,191 @@
From 0874861bcc70313c343aba5e5566ed30b69eed1c Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Mon, 19 Dec 2016 21:13:57 +0000
Subject: [PATCH] QSFPM: Remove data manipulation from move handlers
Similar to the fix in the parent commit, incorrect updating of the
internal data structures during layout changes can lead to dangling
pointers being dereferenced later. Moves are treated as layoutChanges
by this proxy by forwarding to the appropriate method. However, data is
incorrectly cleared prior to that forwarding. Remove that, and let the
layoutChange handling take appropriate action.
Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/corelib/itemmodels/qsortfilterproxymodel.cpp | 67 ++++------------------
.../tst_qsortfilterproxymodel.cpp | 46 +++++++++++++++
2 files changed, 58 insertions(+), 55 deletions(-)
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 3331521..226a240 100644
--- qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -1418,49 +1418,27 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsRemoved(
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
// Because rows which are contiguous in the source model might not be contiguous
// in the proxy due to sorting, the best thing we can do here is be specific about what
// parents are having their children changed.
// Optimize: Emit move signals if the proxy is not sorted. Will need to account for rows
// being filtered out though.
- saved_persistent_indexes.clear();
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutAboutToBeChanged(parents);
- if (persistent.indexes.isEmpty())
- return;
- saved_persistent_indexes = store_persistent_indexes();
+ parents << destParent;
+ _q_sourceLayoutAboutToBeChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
-
- // Optimize: We only need to clear and update the persistent indexes which are children of
- // sourceParent or destParent
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
-
- update_persistent_indexes(saved_persistent_indexes);
- saved_persistent_indexes.clear();
-
- if (dynamic_sortfilter && update_source_sort_column()) {
- //update_source_sort_column might have created wrong mapping so we have to clear it again
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
- }
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutChanged(parents);
+ parents << destParent;
+ _q_sourceLayoutChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(
@@ -1522,42 +1500,21 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved(
void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
-
- saved_persistent_indexes.clear();
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutAboutToBeChanged(parents);
-
- if (persistent.indexes.isEmpty())
- return;
- saved_persistent_indexes = store_persistent_indexes();
+ parents << destParent;
+ _q_sourceLayoutAboutToBeChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
-
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
-
- update_persistent_indexes(saved_persistent_indexes);
- saved_persistent_indexes.clear();
-
- if (dynamic_sortfilter && update_source_sort_column()) {
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
- }
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutChanged(parents);
+ parents << destParent;
+ _q_sourceLayoutChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
/*!
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 6b98d9f..7b6c470 100644
--- qtbase/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ qtbase/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -146,6 +146,7 @@ private slots:
void filterHint();
void sourceLayoutChangeLeavesValidPersistentIndexes();
+ void rowMoveLeavesValidPersistentIndexes();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -4307,5 +4308,50 @@ void tst_QSortFilterProxyModel::sourceLayoutChangeLeavesValidPersistentIndexes()
QVERIFY(persistentIndex.parent().isValid());
}
+void tst_QSortFilterProxyModel::rowMoveLeavesValidPersistentIndexes()
+{
+ DynamicTreeModel model;
+ Q_SET_OBJECT_NAME(model);
+
+ QList<int> ancestors;
+ for (auto i = 0; i < 5; ++i)
+ {
+ Q_UNUSED(i);
+ ModelInsertCommand insertCommand(&model);
+ insertCommand.setAncestorRowNumbers(ancestors);
+ insertCommand.setStartRow(0);
+ insertCommand.setEndRow(0);
+ insertCommand.doCommand();
+ ancestors.push_back(0);
+ }
+
+ QSortFilterProxyModel proxy1;
+ proxy1.setSourceModel(&model);
+ Q_SET_OBJECT_NAME(proxy1);
+
+ proxy1.setFilterRegExp("1|2");
+
+ auto item5 = model.match(model.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
+ auto item3 = model.match(model.index(0, 0), Qt::DisplayRole, "3", 1, Qt::MatchRecursive).first();
+
+ Q_ASSERT(item5.isValid());
+ Q_ASSERT(item3.isValid());
+
+ QPersistentModelIndex persistentIndex = proxy1.match(proxy1.index(0, 0), Qt::DisplayRole, "2", 1, Qt::MatchRecursive).first();
+
+ ModelMoveCommand moveCommand(&model, 0);
+ moveCommand.setAncestorRowNumbers(QList<int>{0, 0, 0, 0});
+ moveCommand.setStartRow(0);
+ moveCommand.setEndRow(0);
+ moveCommand.setDestRow(0);
+ moveCommand.setDestAncestors(QList<int>{0, 0, 0});
+ moveCommand.doCommand();
+
+ // Calling parent() causes the internalPointer to be used.
+ // Before fixing QTBUG-47711 (moveRows case), that could be
+ // a dangling pointer.
+ QVERIFY(persistentIndex.parent().isValid());
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"

View file

@ -0,0 +1,149 @@
From baad82d242a4d8c1af6c87faaa7f25584183fd53 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Tue, 20 Dec 2016 00:44:12 +0000
Subject: [PATCH] QIPM: Persist model indexes after emitting layoutChange, not
before
Callers can persist a QModelIndex which was not persisted before in a
slot connected to the signal, and such a persisted index must be updated
in the course of the layoutChange.
Store the indexes to persist after emitting the signal.
Task-number: QTBUG-32981
Change-Id: Ibee4c0d84817d72603a03fe5b22fdeefeac0695e
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/corelib/itemmodels/qidentityproxymodel.cpp | 18 ++---
.../tst_qidentityproxymodel.cpp | 76 ++++++++++++++++++++++
2 files changed, 85 insertions(+), 9 deletions(-)
diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp
index e537793..7c30679 100644
--- qtbase/src/corelib/itemmodels/qidentityproxymodel.cpp
+++ qtbase/src/corelib/itemmodels/qidentityproxymodel.cpp
@@ -496,15 +496,6 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
{
Q_Q(QIdentityProxyModel);
- const auto proxyPersistentIndexes = q->persistentIndexList();
- for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
- proxyIndexes << proxyPersistentIndex;
- Q_ASSERT(proxyPersistentIndex.isValid());
- const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
- Q_ASSERT(srcPersistentIndex.isValid());
- layoutChangePersistentIndexes << srcPersistentIndex;
- }
-
QList<QPersistentModelIndex> parents;
parents.reserve(sourceParents.size());
for (const QPersistentModelIndex &parent : sourceParents) {
@@ -518,6 +509,15 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
}
q->layoutAboutToBeChanged(parents, hint);
+
+ const auto proxyPersistentIndexes = q->persistentIndexList();
+ for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
+ proxyIndexes << proxyPersistentIndex;
+ Q_ASSERT(proxyPersistentIndex.isValid());
+ const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
+ Q_ASSERT(srcPersistentIndex.isValid());
+ layoutChangePersistentIndexes << srcPersistentIndex;
+ }
}
void QIdentityProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index e946f31..564b854 100644
--- qtbase/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ qtbase/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -68,6 +68,8 @@ private slots:
void itemData();
+ void persistIndexOnLayoutChange();
+
protected:
void verifyIdentity(QAbstractItemModel *model, const QModelIndex &parent = QModelIndex());
@@ -377,5 +379,79 @@ void tst_QIdentityProxyModel::itemData()
QCOMPARE(proxy.itemData(topIndex).value(Qt::DisplayRole).toString(), QStringLiteral("Monday_appended"));
}
+void dump(QAbstractItemModel* model, QString const& indent = " - ", QModelIndex const& parent = {})
+{
+ for (auto row = 0; row < model->rowCount(parent); ++row)
+ {
+ auto idx = model->index(row, 0, parent);
+ qDebug() << (indent + idx.data().toString());
+ dump(model, indent + "- ", idx);
+ }
+}
+
+void tst_QIdentityProxyModel::persistIndexOnLayoutChange()
+{
+ DynamicTreeModel model;
+
+ QList<int> ancestors;
+ for (auto i = 0; i < 3; ++i)
+ {
+ Q_UNUSED(i);
+ ModelInsertCommand insertCommand(&model);
+ insertCommand.setAncestorRowNumbers(ancestors);
+ insertCommand.setStartRow(0);
+ insertCommand.setEndRow(0);
+ insertCommand.doCommand();
+ ancestors.push_back(0);
+ }
+ ModelInsertCommand insertCommand(&model);
+ insertCommand.setAncestorRowNumbers(ancestors);
+ insertCommand.setStartRow(0);
+ insertCommand.setEndRow(1);
+ insertCommand.doCommand();
+
+ // dump(&model);
+ // " - 1"
+ // " - - 2"
+ // " - - - 3"
+ // " - - - - 4"
+ // " - - - - 5"
+
+ QIdentityProxyModel proxy;
+ proxy.setSourceModel(&model);
+
+ QPersistentModelIndex persistentIndex;
+
+ QPersistentModelIndex sourcePersistentIndex = model.match(model.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
+
+ QCOMPARE(sourcePersistentIndex.data().toString(), QStringLiteral("5"));
+
+ bool gotLayoutAboutToBeChanged = false;
+ bool gotLayoutChanged = false;
+
+ QObject::connect(&proxy, &QAbstractItemModel::layoutAboutToBeChanged, &proxy, [&proxy, &persistentIndex, &gotLayoutAboutToBeChanged]
+ {
+ gotLayoutAboutToBeChanged = true;
+ persistentIndex = proxy.match(proxy.index(0, 0), Qt::DisplayRole, "5", 1, Qt::MatchRecursive).first();
+ });
+
+ QObject::connect(&proxy, &QAbstractItemModel::layoutChanged, &proxy, [&proxy, &persistentIndex, &sourcePersistentIndex, &gotLayoutChanged]
+ {
+ gotLayoutChanged = true;
+ QCOMPARE(QModelIndex(persistentIndex), proxy.mapFromSource(sourcePersistentIndex));
+ });
+
+ ModelChangeChildrenLayoutsCommand layoutChangeCommand(&model, 0);
+
+ layoutChangeCommand.setAncestorRowNumbers(QList<int>{0, 0, 0});
+ layoutChangeCommand.setSecondAncestorRowNumbers(QList<int>{0, 0});
+
+ layoutChangeCommand.doCommand();
+
+ QVERIFY(gotLayoutAboutToBeChanged);
+ QVERIFY(gotLayoutChanged);
+ QVERIFY(persistentIndex.isValid());
+}
+
QTEST_MAIN(tst_QIdentityProxyModel)
#include "tst_qidentityproxymodel.moc"

View file

@ -18,35 +18,6 @@
void* trace[100];
int size = backtrace(trace, sizeof(trace) / sizeof(*trace));
char** symbols = backtrace_symbols(trace, size);
--- qtwebengine/src/3rdparty/chromium/base/debug/stack_trace_posix.cc 2016-03-03 15:48:36.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/base/debug/stack_trace_posix.cc 2016-03-17 02:23:45.442708132 +0100
@@ -22,7 +22,7 @@
#if defined(__GLIBCXX__)
#include <cxxabi.h>
#endif
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
#include <execinfo.h>
#endif
@@ -169,7 +169,7 @@
handler->HandleOutput("\n");
}
-#elif !defined(__UCLIBC__)
+#elif defined(__GLIBC__) && !defined(__UCLIBC__)
bool printed = false;
// Below part is async-signal unsafe (uses malloc), so execute it only
@@ -738,7 +738,7 @@
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
// Though the backtrace API man page does not list any possible negative
// return values, we take no chance.
count_ = base::saturated_cast<size_t>(backtrace(trace_, arraysize(trace_)));
--- qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp 2016-03-03 15:48:36.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp 2016-03-17 05:47:32.637589639 +0100
@@ -61,7 +61,7 @@
@ -76,3 +47,86 @@
Dl_info info;
if (!dladdr(addr, &info) || !info.dli_sname)
return;
--- qtwebengine/src/3rdparty/chromium/base/debug/stack_trace_posix.cc 2017-01-03 10:28:53.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/base/debug/stack_trace_posix.cc 2017-02-23 20:50:40.715144712 +0100
@@ -25,7 +25,7 @@
#if defined(__GLIBCXX__)
#include <cxxabi.h>
#endif
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
#include <execinfo.h>
#endif
@@ -76,7 +76,7 @@
// Note: code in this function is NOT async-signal safe (std::string uses
// malloc internally).
-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
+#if defined(__GLIBCXX__) && defined(__GLIBC__) && !defined(__UCLIBC__)
std::string::size_type search_from = 0;
while (search_from < text->size()) {
@@ -113,7 +113,7 @@
}
}
-#endif // defined(__GLIBCXX__) && !defined(__UCLIBC__)
+#endif // defined(__GLIBCXX__) && defined(__GLIBC__) && !defined(__UCLIBC__)
}
#endif // !defined(USE_SYMBOLIZE)
@@ -125,7 +125,7 @@
virtual ~BacktraceOutputHandler() {}
};
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
// This should be more than enough to store a 64-bit number in hex:
// 16 hex digits + 1 for null-terminator.
@@ -202,7 +202,7 @@
}
#endif // defined(USE_SYMBOLIZE)
}
-#endif // !defined(__UCLIBC__)
+#endif // defined(__GLIBC__) && !defined(__UCLIBC__)
void PrintToStderr(const char* output) {
// NOTE: This code MUST be async-signal safe (it's used by in-process
@@ -717,7 +717,7 @@
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
// Though the backtrace API man page does not list any possible negative
// return values, we take no chance.
count_ = base::saturated_cast<size_t>(backtrace(trace_, arraysize(trace_)));
@@ -730,13 +730,13 @@
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
PrintBacktraceOutputHandler handler;
ProcessBacktrace(trace_, count_, &handler);
#endif
}
-#if !defined(__UCLIBC__)
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
void StackTrace::OutputToStream(std::ostream* os) const {
StreamBacktraceOutputHandler handler(os);
ProcessBacktrace(trace_, count_, &handler);
--- qtwebengine/src/3rdparty/chromium/base/logging.cc 2017-01-03 10:28:53.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/base/logging.cc 2017-02-26 12:49:40.691446466 +0100
@@ -526,7 +526,7 @@
}
LogMessage::~LogMessage() {
-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__)
+#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && defined(__GLIBC__)
if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
// Include a stack trace on a fatal, unless a debugger is attached.
base::debug::StackTrace trace;

View file

@ -1,11 +1,11 @@
--- qtbase/src/corelib/codecs/qiconvcodec.cpp.orig
+++ qtbase/src/corelib/codecs/qiconvcodec.cpp
@@ -62,7 +62,7 @@
--- qtbase/src/corelib/codecs/qiconvcodec.cpp 2017-01-18 15:20:58.000000000 +0100
+++ qtbase/src/corelib/codecs/qiconvcodec.cpp 2017-02-21 14:33:32.423808603 +0100
@@ -64,7 +64,7 @@
#elif defined(Q_OS_AIX)
# define NO_BOM
# define UTF16 "UCS-2"
-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
+#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && !defined(__GLIBC__))
-#elif defined(Q_OS_FREEBSD)
+#elif defined(Q_OS_FREEBSD) || (defined(Q_OS_LINUX) && !defined(__GLIBC__))
# define NO_BOM
# if Q_BYTE_ORDER == Q_BIG_ENDIAN
# define UTF16 "UTF-16BE"

View file

@ -1,6 +1,6 @@
--- qtwebengine/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc 2016-11-07 15:46:18.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc 2016-12-20 03:02:28.260383021 +0100
@@ -61,7 +61,7 @@
--- qtwebengine/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc 2017-01-03 10:28:53.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc 2017-02-21 22:04:37.993963440 +0100
@@ -128,7 +128,7 @@
// fixed quantum, so the excess region will not be resident.
// See crrev.com/1531463004 for detailed explanation.
resident_size = stats.max_size_in_use;
@ -9,12 +9,12 @@
struct mallinfo info = mallinfo();
DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
--- qtwebengine/src/3rdparty/chromium/content/child/content_child_helpers.cc 2016-11-07 15:46:18.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/content/child/content_child_helpers.cc 2016-12-20 04:15:06.214331244 +0100
@@ -18,7 +18,7 @@
namespace content {
--- qtwebengine/src/3rdparty/chromium/content/child/content_child_helpers.cc 2017-01-03 10:28:53.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/content/child/content_child_helpers.cc 2017-02-21 22:09:13.161343477 +0100
@@ -25,7 +25,7 @@
// though, this provides only a partial and misleading value.
// Unfortunately some telemetry benchmark rely on it and these need to
// be refactored before getting rid of this. See crbug.com/581365 .
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if (defined(OS_LINUX) || defined(OS_ANDROID)) && defined(__GLIBC__)
size_t GetMemoryUsageKB() {

View file

@ -0,0 +1,12 @@
--- qtwebengine/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc 2017-01-03 10:28:53.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/device/serial/serial_io_handler_posix.cc 2017-02-23 21:20:42.650669563 +0100
@@ -12,6 +12,9 @@
#if defined(OS_LINUX)
#include <linux/serial.h>
+#if !defined(__GLIBC__)
+#include <asm-generic/ioctls.h>
+#endif
// The definition of struct termios2 is copied from asm-generic/termbits.h
// because including that header directly conflicts with termios.h.

View file

@ -1,29 +0,0 @@
--- qtwebengine/src/3rdparty/chromium/net/socket/ssl_client_socket_openssl.cc 2015-12-10 18:17:21.000000000 +0100
+++ qtwebengine/src/3rdparty/chromium/net/socket/ssl_client_socket_openssl.cc 2016-01-14
17:11:38.432633534 +0100
@@ -57,6 +57,10 @@
#include "net/ssl/ssl_platform_key.h"
#endif
+#if defined(USE_NSS_CERTS) || defined(OS_IOS)
+#include "net/cert_net/nss_ocsp.h"
+#endif
+
namespace net {
namespace {
@@ -795,6 +799,14 @@
DCHECK(!ssl_);
DCHECK(!transport_bio_);
+#if defined(USE_NSS_CERTS) || defined(OS_IOS)
+ if (ssl_config_.cert_io_enabled) {
+ // TODO(davidben): Move this out of SSLClientSocket. See
+ // https://crbug.com/539520.
+ EnsureNSSHttpIOInit();
+ }
+#endif
+
SSLContext* context = SSLContext::GetInstance();
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);

View file

@ -1,16 +1,18 @@
# Template file for 'qt5'
pkgname=qt5
version=5.7.1
revision=4
version=5.8.0
revision=1
wrksrc="qt-everywhere-opensource-src-${version}"
build_style=gnu-configure
homepage="http://qt.io/"
short_desc="A cross-platform application and UI framework (QT5)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-3, LGPL-2.1"
distfiles="http://download.qt.io/official_releases/qt/${version%.*}/${version}/single/qt-everywhere-opensource-src-${version}.tar.xz"
checksum=46ebca977deb629c5e69c2545bc5fe13f7e40012e5e2e451695c583bd33502fa
checksum=0f4c54386d3dbac0606a936a7145cebb7b94b0ca2d29bc001ea49642984824b6
if [ "${XBPS_MACHINE%%-musl}" = i686 ]; then
broken="Hangs forever when running python gyp_qtwebengine; File /usr/lib/python2.7/multiprocessing/process.py, line 258, in _bootstrap"
nodebug=yes # prevent OOM
fi
hostmakedepends="flex ruby gperf git python perl pkg-config re2c"
@ -33,55 +35,52 @@ replaces="qt5-doc<5.6.0 qt5-quick1<5.6.0 qt5-quick1-devel<5.6.0 qt5-webkit<5.6.0
# Work around SSLv3_{client,server}_method missing in libressl-2.3.3
CFLAGS="-DOPENSSL_NO_SSL3_METHOD"
CXXFLAGS="-DOPENSSL_NO_SSL3_METHOD"
CXXFLAGS="-DOPENSSL_NO_SSL3_METHOD -Wno-deprecated-declarations -fno-delete-null-pointer-checks"
# Required for musl libc
LDFLAGS="-pthread"
LDFLAGS="-pthread -fPIE"
case "$XBPS_TARGET_MACHINE" in
armv[5-6]*) ;; # Can't cross compile libvpx
*) makedepends+=" libvpx-devel"
armv[56]*) # Can't cross compile libvpx
;;
armv7*) # Force use of neon and enable libvpx
CXXFLAGS+=" -mfpu=neon"
makedepends+=" libvpx-devel"
;;
*) # Other architectures have libvpx (TODO: mips-* too?)
makedepends+=" libvpx-devel"
;;
esac
if [ -n "$CROSS_BUILD" ]; then
# Need some devel packages in the host to build qmake, moc, uic, rcc
# wayland-devel contains /usr/bin/wayland-scanner
hostmakedepends+=" zlib-devel icu-devel wayland-devel"
# Cross building ninja does not work, thus use the system ninja
hostmakedepends+=" zlib-devel icu-devel wayland-devel ninja"
fi
_cleanup_wrksrc_leak() {
if [ -d "${PKGDESTDIR}/usr/lib/cmake" ]; then
# Replace ${wrksrc} in cmake files
# Replace references to ${wrksrc} in cmake files
sed -i ${PKGDESTDIR}/usr/lib/cmake/*/*.cmake \
-e "s;${wrksrc}/qtbase/host;/usr/lib/qt5;g" \
-e "s;devices/void-${XBPS_CROSS_TRIPLET}-g++;linux-g++;g"
fi
if [ -d "${PKGDESTDIR}/usr/lib/pkgconfig" ]; then
# Replace ${wrksrc} in pkgconfig files
# Replace references to ${wrksrc} in pkgconfig files
sed -i ${PKGDESTDIR}/usr/lib/pkgconfig/*.pc \
-e "s;${wrksrc}/qtbase/host;/usr/lib/qt5;g" \
-e "s;devices/void-${XBPS_CROSS_TRIPLET}-g++;linux-g++;g"
fi
# Remove QMAKE_PRL_BUILD_DIR from linker hint files
# Remove QMAKE_PRL_BUILD_DIR from hint files for static libraries
# and replace references to ${wrksrc}
find ${PKGDESTDIR} -iname "*.prl" -exec sed -i "{}" \
-e "/^QMAKE_PRL_BUILD_DIR/d" \
-e "s;-L${wrksrc}/qtbase/lib;/usr/lib;g" \;
-e "s;-L${wrksrc}/qtbase/lib;-L/usr/lib;g" \;
# Replace ${wrksrc} in project include files
find ${PKGDESTDIR} -iname "*.pri" -exec sed -i "{}" \
-e "s;${wrksrc}/qtbase;/usr/lib/qt5;g" \;
}
_move_examples() {
local dest=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/qt5-examples-${version}
if [ -d ${PKGDESTDIR}/usr/share/qt5/examples ]; then
# Copy examples to /destdir/qt5-examples-${version} subpackage
mkdir -p ${dest}/usr/share/qt5
cp -pR ${PKGDESTDIR}/usr/share/qt5/examples ${dest}/usr/share/qt5
rm -rf ${PKGDESTDIR}/usr/share/qt5/examples
# The help files (*.qch) are in the qt5-doc package
find ${dest}/usr/share/qt5/examples -iname "*.qch" -delete
fi
}
_install_subpkg() {
local module=$1 f base
cd ${wrksrc}/${module}
@ -91,16 +90,16 @@ _install_subpkg() {
rm -rf ${PKGDESTDIR}/usr/lib/cmake
rm -rf ${PKGDESTDIR}/usr/lib/qt5/mkspecs
rm -rf ${PKGDESTDIR}/usr/lib/pkgconfig
rm -f ${PKGDESTDIR}/usr/lib/*.a
rm -f ${PKGDESTDIR}/usr/lib/*.so
rm -f ${PKGDESTDIR}/usr/lib/*.prl
if [ -d ${PKGDESTDIR}/usr/lib/qt5/bin ]; then
vmkdir usr/bin
for f in ${PKGDESTDIR}/usr/lib/qt5/bin/*; do
base=$(basename $f)
base=${f##*/}
ln -sf /usr/lib/qt5/bin/${base} ${PKGDESTDIR}/usr/bin/${base}-qt5
done
fi
_move_examples
}
_install_devel() {
@ -158,10 +157,6 @@ _create_config() {
}
pre_configure() {
if [ ${XBPS_GCC_VERSION_MAJOR} -gt 5 ]; then
CXXFLAGS+=" -fno-delete-null-pointer-checks"
fi
# Compatibility functions res_ninit() and res_nclose() for musl libc
cp ${FILESDIR}/resolv_compat.h ${wrksrc}/qtwebengine/src/3rdparty/chromium/net/dns
case "$XBPS_TARGET_MACHINE" in
@ -171,24 +166,40 @@ pre_configure() {
for config in $(find ${chromium}/third_party/ffmpeg/chromium/config -name "config\.*" | grep linux); do
sed -i ${config} -e "s;HAVE_SYSCTL 1;HAVE_SYSCTL 0;"
done
# Do not use experimental allocator shim (incompatible with musl libc)
sed -i qtwebengine/src/3rdparty/chromium/build/common.gypi \
-e"s;\('use_experimental_allocator_shim%':\) 1,;\1 0,;"
esac
# qmake CFLAGS/LDFLAGS
sed -i qtbase/configure \
-e 's;cd "$0/qmake";cd "$0";' \
-e 's;"$outpath" "$MAKE";"$outpath/qmake" "$MAKE";' \
-e '/outpath\/qmake.*$MAKE/s;\"$MAKE\"\(.*\);\"$MAKE\" QMAKE_CFLAGS=\"$CFLAGS\" QMAKE_CXXFLAGS=\"$CXXFLAGS\" QMAKE_LFLAGS=\"$LDFLAGS\"\1;' \
-e 's;\(setBootstrapVariable\s\+\|EXTRA_C\(XX\)\?FLAGS=.*\)QMAKE_C\(XX\)\?FLAGS_\(DEBUG\|RELEASE\).*;:;'
# cross build patches
# Cross build patches
if [ -n "$CROSS_BUILD" ]; then
# This also sets default {C,CXX,LD}FLAGS for projects built using qmake
sed -i -e "s|^\(QMAKE_CFLAGS_RELEASE.*\)|\1 ${XBPS_CFLAGS}|" \
qtbase/mkspecs/common/gcc-base.conf
sed -i -e "s|^\(QMAKE_LFLAGS_RELEASE.*\)|\1 ${XBPS_LDFLAGS}|" \
qtbase/mkspecs/common/g++-unix.conf
# Patch to skip non-working check for GCC version
patch -p0 < ${FILESDIR}/cross-gcc.patch
# Patches to fix non-working python scripts host CXX detection
patch -p0 < ${FILESDIR}/cross-ninja.patch
# Create symbolic links for private include directories
for d in $(ls ${wrksrc}/qtbase/include); do
ln -s ${version}/${d}/private qtbase/include/${d}/private
done
# Copy system ninja to 3rdparty path
cp -v /usr/bin/ninja qtwebengine/src/3rdparty/ninja/
else
# Build qmake using Void {C,LD}FLAGS
# This also sets default {C,CXX,LD}FLAGS for projects built using qmake
sed -i -e "s|^\(QMAKE_CFLAGS_RELEASE.*\)|\1 ${CFLAGS}|" \
qtbase/mkspecs/common/gcc-base.conf
sed -i -e "s|^\(QMAKE_LFLAGS_RELEASE.*\)|\1 ${LDFLAGS}|" \
qtbase/mkspecs/common/g++-unix.conf
fi
case "$XBPS_TARGET_MACHINE" in
arm*)
esac
}
do_configure() {
local opts spec
local opts spec dirs dir f
opts+=" -confirm-license"
opts+=" -opensource"
@ -206,16 +217,17 @@ do_configure() {
opts+=" -accessibility -fontconfig -icu"
opts+=" -openssl-linked"
opts+=" -dbus-linked"
opts+=" -silent"
opts+=" -no-pch" # For ccache support
opts+=" -no-pch"
opts+=" -no-strip"
opts+=" -nomake examples"
opts+=" -optimized-qmake"
opts+=" -system-libjpeg"
opts+=" -system-libpng"
opts+=" -system-zlib"
opts+=" -system-sqlite"
opts+=" -system-harfbuzz"
opts+=" -v" # Enable for verbose configuration tests
# opts+=" -silent"
opts+=" -v"
if [ -z "$CROSS_BUILD" ]; then
if [ "${XBPS_MACHINE%%-musl}" = i686 ]; then
@ -230,51 +242,19 @@ do_configure() {
opts+=" -sysroot ${XBPS_CROSS_BASE}"
opts+=" -hostprefix host"
opts+=" -extprefix /usr"
export CFLAGS="$XBPS_CFLAGS"
export CXXFLAGS="$XBPS_CXXFLAGS"
export CPPFLAGS="$XBPS_CPPFLAGS"
export LDFLAGS="$XBPS_LDFLAGS"
fi
export CC="$XBPS_CC"
export CXX="$XBPS_CXX"
export CPP="$XBPS_CPP"
export LD="$XBPS_CXX"
export AR="ar"
export AS="as"
export NM="nm"
export OBJDUMP="objdump"
export STRIP="strip"
export RANLIB="ranlib"
./configure ${opts}
}
do_build() {
CC="cc" CXX="c++" CPP="cpp" LD="c++" AR="ar" AS="as" NM="nm" \
OBJDUMP="objdump" STRIP="strip" RANLIB="ranlib" \
CFLAGS="$XBPS_CFLAGS" CXXFLAGS="$XBPS_CXXFLAGS" \
CPPFLAGS="$XBPS_CPPFLAGS" LDFLAGS="$XBPS_LDFLAGS" \
LFLAGS="$XBPS_LDFLAGS" \
./configure ${opts}
export LD_LIBRARY_PATH="${wrksrc}/qtbase/lib:${wrksrc}/qttools/lib:${LD_LIBRARY_PATH}"
if [ -z "$CROSS_BUILD" ]; then
unset CC CXX LD CPP AR AS RANLIB
make ${makejobs}
else
export CC="$XBPS_CC"
export CXX="$XBPS_CXX"
export CPP="$XBPS_CPP"
export LD="$XBPS_CXX"
export CFLAGS="$XBPS_CFLAGS"
export CXXFLAGS="$XBPS_CXXFLAGS"
export CPPFLAGS="$XBPS_CPPFLAGS"
export LDFLAGS="$XBPS_LDFLAGS"
export AR="ar"
export AS="as"
export NM="nm"
export OBJDUMP="objdump"
export RANLIB="ranlib"
export STRIP="strip"
make ${makejobs}
fi
}
do_install() {
local f base
local f base dirs
if [ -z "$CROSS_BUILD" ]; then
unset CC CXX LD CPP AR AS RANLIB
@ -287,53 +267,115 @@ do_install() {
if [ -n "$CROSS_BUILD" ]; then
#
# For some reason qmake and some tools are not built for the target.
# Do this manually by patching their Makefiles and installing
# the targets to ${DESTDIR}/usr/lib/qt5/bin
# For some reason qmake and several tools are not built for the target
# but only for the host. Build them for the target architecture by
# replacing or patching their project files (*.pro) and the resulting
# Makefiles and eventually install the targets to ${DESTDIR}/usr/lib/qt5/bin
#
vmkdir usr/lib/qt5/bin
echo ">>> Building qmake or target ${CROSS_BUILD} ..."
# Make a backup of the host tools
for f in qtbase qt3d qtdeclarative qtscxml qttools; do
mkdir -p ${wrksrc}/host/${f}
cp -ar ${wrksrc}/${f}/bin ${wrksrc}/host/${f}
done
msg_normal "Building qmake for target ${CROSS_BUILD} ...\n"
cd qmake
sed Makefile \
-e "s;^\(CC\\s*\)=.*;\1= $CC;" \
-e "s;^\(CXX\\s*\)=.*;\1= $CXX;" \
-e "s;^\(QMAKE_CFLAGS\\s*\)=.*;\1= $CFLAGS;" \
-e "s;^\(QMAKE_CXXFLAGS\\s*\)=.*;\1= $CXXFLAGS;" \
-e "s;^\(QMAKE_LFLAGS\\s*\)=.*;\1= $LDFLAGS;" \
-e "s;.(BUILD_PATH)/bin;${DESTDIR}/usr/lib/qt5/bin;" \
-e "s;^\(CC\\s*=\).*;\1 $CC;" \
-e "s;^\(CXX\\s*=\).*;\1 $CXX;" \
-e "s;^\(QMAKE_CFLAGS\\s*=\).*;\1 $CFLAGS;" \
-e "s;^\(QMAKE_CXXFLAGS\\s*=\).*;\1 $CXXFLAGS;" \
-e "s;^\(QMAKE_LFLAGS\\s*=\).*;\1 $LDFLAGS;" \
-e "s;\$(BUILD_PATH)/bin;${DESTDIR}/usr/lib/qt5/bin;" \
> Makefile.target
make clean
make -f Makefile.target ${makejobs}
mkdir -p ${wrksrc}/tools
cd ${wrksrc}/tools
# Build various tools for the target
dirs+=" qtbase/src/tools/qdbuscpp2xml"
dirs+=" qtbase/src/tools/qdbusxml2cpp"
dirs+=" qtbase/src/tools/qlalr"
dirs+=" qtbase/src/tools/moc"
dirs+=" qtbase/src/tools/rcc"
dirs+=" qtbase/src/tools/uic"
dirs+=" qt3d/tools/qgltf"
dirs+=" qtdeclarative/src/qmldevtools"
dirs+=" qtdeclarative/tools/qmlimportscanner"
dirs+=" qtdeclarative/tools/qmlmin"
dirs+=" qtdeclarative/tools/qmllint"
dirs+=" qtscxml/tools/qscxmlc"
dirs+=" qttools/src/linguist/lconvert"
dirs+=" qttools/src/linguist/lrelease"
dirs+=" qttools/src/linguist/lupdate"
dirs+=" qttools/src/qdoc"
mkdir -p ${wrksrc}/target/bin
for f in ${dirs}; do
cd ${wrksrc}/${f}
base=${f##*/}
msg_normal "Building ${base} for target ${CROSS_BUILD} ...\n"
make clean
# Create a .qmake.conf file for building the tools
echo "load(qt_build_config)" > .qmake.conf
echo "CONFIG += warning_clean" >> .qmake.conf
echo "QT_SOURCE_TREE = ${wrksrc}/qtbase" >> .qmake.conf
echo "QT_BUILD_TREE = ${wrksrc}/tools" >> .qmake.conf
echo "MODULE_VERSION = ${version}" >> .qmake.conf
if [ -f "${FILESDIR}/${base}.pro" ]; then
# A specific *.pro file is available, use it.
cp ${FILESDIR}/${base}.pro ${base}.pro
else
# Otherwise strip the option(host_build)
sed -i ${base}.pro -e "/option(host_build)/d"
fi
# Re-create the Makefile
${wrksrc}/qtbase/bin/qmake -o Makefile ${base}.pro
for f in moc rcc uic qlalr qdbuscpp2xml qdbusxml2cpp; do
echo ">>> Building ${f} for target ${CROSS_BUILD} ..."
mkdir -p ${wrksrc}/tools/${f}
cd ${wrksrc}/tools/${f}
cp -pR ${wrksrc}/qtbase/src/tools/${f}/* .
cp ${FILESDIR}/${f}/${f}.pro .
${wrksrc}/qtbase/bin/qmake -o Makefile ${f}.pro
# Now patch the Makefile to not use the bootstrap libs and
# use the compilers, linker, flags, etc. for the target arch
sed -i Makefile \
-e"s;^\(CFLAGS\\s=.*\);\1 $CFLAGS;" \
-e"s;^\(CXXFLAGS\\s=.*\);\1 $CXXFLAGS;"
-e"s; force_bootstrap;;" \
-e"s;^\(CC\\s*=\).*;\1 $CC;" \
-e"s;^\(CXX\\s*=\).*;\1 $CXX;" \
-e"s;^\(LINK\\s*=\).*;\1 $CXX;" \
-e"s;^\(CFLAGS\\s*=.*\);\1 $CFLAGS;" \
-e"s;^\(CXXFLAGS\\s*=.*\);\1 $CXXFLAGS;" \
-e"s;^\(LFLAGS\\s*=.*\);\1 $LDFLAGS;" \
-e"s;^\(AR\\s*=\).*;\1 $AR cqs;" \
-e"s;^\(RANLIB\\s*=\).*;\1 $RANLIB;"
if [ "${base}" != qmldevtools ]; then
# Set target destination and name
find . -name Makefile -exec sed -i "{}" \
-e"s;^\(DESTDIR\\s*=\).*;\1 ${wrksrc}/target/bin/;" \
-e"s;^\(TARGET\\s*=\).*;\1 ${wrksrc}/target/bin/${base};" \
\;
fi
make ${makejobs}
# Install the resulting binary
vinstall ${wrksrc}/tools/bin/${f} 755 usr/lib/qt5/bin
# Install the resulting binary, if any
if [ "${base}" != qmldevtools ]; then
vinstall ${wrksrc}/target/bin/${base} 755 usr/lib/qt5/bin
fi
done
cd ${wrksrc}/qtbase
# Install the mkspecs
vcopy mkspecs usr/lib/qt5
# Restore backup of the host tools
for f in qtbase qt3d qtdeclarative qtscxml qttools; do
rm -rf ${wrksrc}/${f}/bin
cp -pR ${wrksrc}/host/${f}/bin ${wrksrc}/${f}
done
else
msg_normal ">>> Building qmake for host ${XBPS_ARCH} ...\n"
cd qmake
sed Makefile \
-e "s;^\(CC\\s*\)=.*;\1= gcc;" \
-e "s;^\(CXX\\s*\)=.*;\1= g++;" \
-e "s;^\(QMAKE_CFLAGS\\s*\)=.*;\1= $CFLAGS;" \
-e "s;^\(QMAKE_CXXFLAGS\\s*\)=.*;\1= $CXXFLAGS;" \
-e "s;^\(QMAKE_LFLAGS\\s*\)=.*;\1= $LDFLAGS;" \
-e "s;\$(BUILD_PATH)/bin;${DESTDIR}/usr/lib/qt5/bin;" \
> Makefile.host
make clean
make -f Makefile.host ${makejobs}
fi
vlicense ${wrksrc}/LGPL_EXCEPTION.txt
@ -342,7 +384,6 @@ do_install() {
base=$(basename $f)
ln -sf /usr/lib/qt5/bin/${base} ${PKGDESTDIR}/usr/bin/${base}-qt5
done
_move_examples
_cleanup_wrksrc_leak
}
@ -447,13 +488,18 @@ qt5-examples_package() {
short_desc+=" - Examples"
depends="qt5-devel-${version}_${revision} qt5-qmake-${version}_${revision}"
pkg_install() {
# In case any examples are still left in $DESTDIR
if [ -d ${DESTDIR}/usr/share/qt5/examples ]; then
vmkdir usr/share/qt5
cp -pR ${DESTDIR}/usr/share/qt5/examples \
${PKGDESTDIR}/usr/share/qt5
rm -rf ${DESTDIR}/usr/share/qt5/examples
fi
local dir mod base=usr/share/qt5/examples
vmkdir ${base}
vcopy qtbase/examples/examples.pro ${base}/
# Copy examples source
for dir in $(find ${wrksrc} -maxdepth 2 -type d -name examples); do
mod=${dir%/examples}
mod=${mod##*/}
vcopy ${dir}/* ${base}/
if [ -e "${PKGDESTDIR}/${base}/README" ]; then
mv ${PKGDESTDIR}/${base}/README{,.${mod}}
fi
done
}
}
@ -590,6 +636,21 @@ qt5-serialport_package() {
}
}
qt5-speech-devel_package() {
short_desc+=" - Speech component (development)"
depends="qt5-speech-${version}_${revision} qt5-devel-${version}_${revision}"
pkg_install() {
_install_devel qtspeech
}
}
qt5-speech_package() {
short_desc+=" - Speech component"
pkg_install() {
_install_subpkg qtspeech
}
}
qt5-svg-devel_package() {
short_desc+=" - Svg component (development)"
depends="qt5-svg-${version}_${revision} qt5-devel-${version}_${revision}"
@ -728,6 +789,8 @@ qt5-xmlpatterns_package() {
qt5-translations_package() {
short_desc+=" - Translations"
pkg_install() {
sed -i ${wrksrc}/qttranslations/translations/Makefile \
-e "s;qttranslations/translations/\(.*\)_wrapper.sh;host/qttools/bin/\1;g"
_install_subpkg qttranslations
}
}
@ -838,5 +901,9 @@ qt5-qmake_package() {
# Change -isystem to -I to avoid "#include_next <stdlib.h>" errors
sed -i ${PKGDESTDIR}/usr/lib/qt5/mkspecs/common/gcc-base.conf \
-e '/^QMAKE_CFLAGS_ISYSTEM/s;-isystem;-I;'
# Remove -specs=/builddir/... from conf files
sed -i ${PKGDESTDIR}/usr/lib/qt5/mkspecs/common/*.conf \
-e "s;-specs=/void-packages/common/environment/configure/gccspecs/hardened-ld ;;g" \
-e "s;-specs=/void-packages/common/environment/configure/gccspecs/hardened-cc1 ;;g"
}
}