qt4: Add patch for socklen_t on musl, from alpine
This commit is contained in:
parent
2e2517c9c9
commit
c48974c952
@ -106,7 +106,13 @@ stdenv.mkDerivation rec {
|
||||
++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
|
||||
url = "https://src.fedoraproject.org/rpms/qt/raw/ecf530486e0fb7fe31bad26805cde61115562b2b/f/qt-aarch64.patch";
|
||||
sha256 = "1fbjh78nmafqmj7yk67qwjbhl3f6ylkp6x33b1dqxfw9gld8b3gl";
|
||||
});
|
||||
})
|
||||
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||
./qt-musl.patch
|
||||
./qt-musl-iconv-no-bom.patch
|
||||
./patch-qthread-stacksize.diff
|
||||
./qsettings-recursive-global-mutex.patch
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
|
||||
|
@ -0,0 +1,54 @@
|
||||
--- a/src/corelib/thread/qthread_unix.cpp.orig 2015-11-23 19:05:40.000000000 +0100
|
||||
+++ b/src/corelib/thread/qthread_unix.cpp 2015-11-24 11:22:31.000000000 +0100
|
||||
@@ -79,6 +79,7 @@
|
||||
#endif
|
||||
|
||||
+#include <sys/resource.h> // getrlimit/setrlimit
|
||||
#if defined(Q_OS_MAC)
|
||||
# ifdef qDebug
|
||||
# define old_qDebug qDebug
|
||||
# undef qDebug
|
||||
@@ -649,6 +650,43 @@
|
||||
#endif // QT_HAS_THREAD_PRIORITY_SCHEDULING
|
||||
|
||||
|
||||
+ if (d->stackSize == 0) {
|
||||
+ // Fix the default (too small) stack size for threads on OS X,
|
||||
+ // which also affects the thread pool.
|
||||
+ // See also:
|
||||
+ // https://bugreports.qt.io/browse/QTBUG-2568
|
||||
+ // This fix can also be found in Chromium:
|
||||
+ // https://chromium.googlesource.com/chromium/src.git/+/master/base/threading/platform_thread_mac.mm#186
|
||||
+
|
||||
+ // The Mac OS X default for a pthread stack size is 512kB.
|
||||
+ // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
|
||||
+ // DEFAULT_STACK_SIZE for this purpose.
|
||||
+ //
|
||||
+ // 512kB isn't quite generous enough for some deeply recursive threads that
|
||||
+ // otherwise request the default stack size by specifying 0. Here, adopt
|
||||
+ // glibc's behavior as on Linux, which is to use the current stack size
|
||||
+ // limit (ulimit -s) as the default stack size. See
|
||||
+ // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
|
||||
+ // avoid setting the limit below the Mac OS X default or the minimum usable
|
||||
+ // stack size, these values are also considered. If any of these values
|
||||
+ // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
|
||||
+ // stack_size is left at 0 to get the system default.
|
||||
+ //
|
||||
+ // Mac OS X normally only applies ulimit -s to the main thread stack. On
|
||||
+ // contemporary OS X and Linux systems alike, this value is generally 8MB
|
||||
+ // or in that neighborhood.
|
||||
+ size_t default_stack_size = 0;
|
||||
+ struct rlimit stack_rlimit;
|
||||
+ if (pthread_attr_getstacksize(&attr, &default_stack_size) == 0 &&
|
||||
+ getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
|
||||
+ stack_rlimit.rlim_cur != RLIM_INFINITY) {
|
||||
+ default_stack_size =
|
||||
+ std::max(std::max(default_stack_size,
|
||||
+ static_cast<size_t>(PTHREAD_STACK_MIN)),
|
||||
+ static_cast<size_t>(stack_rlimit.rlim_cur));
|
||||
+ }
|
||||
+ d->stackSize = default_stack_size;
|
||||
+ }
|
||||
if (d->stackSize > 0) {
|
||||
#if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0 > 0)
|
||||
int code = pthread_attr_setstacksize(&attr, d->stackSize);
|
@ -0,0 +1,17 @@
|
||||
Calling qsettings before constructing qapplications causes a dead-lock.
|
||||
|
||||
http://sourceforge.net/tracker/?func=detail&aid=3168620&group_id=4932&atid=104932
|
||||
http://developer.qt.nokia.com/forums/viewthread/10365
|
||||
|
||||
|
||||
--- ./src/corelib/io/qsettings.cpp.orig
|
||||
+++ ./src/corelib/io/qsettings.cpp
|
||||
@@ -122,7 +122,7 @@
|
||||
Q_GLOBAL_STATIC(ConfFileCache, unusedCacheFunc)
|
||||
Q_GLOBAL_STATIC(PathHash, pathHashFunc)
|
||||
Q_GLOBAL_STATIC(CustomFormatVector, customFormatVectorFunc)
|
||||
-Q_GLOBAL_STATIC(QMutex, globalMutex)
|
||||
+Q_GLOBAL_STATIC_WITH_ARGS(QMutex, globalMutex, (QMutex::Recursive))
|
||||
static QSettings::Format globalDefaultFormat = QSettings::NativeFormat;
|
||||
|
||||
#ifndef Q_OS_WIN
|
@ -0,0 +1,11 @@
|
||||
--- qt-everywhere-opensource-src-4.8.5/src/corelib/codecs/qiconvcodec.cpp.orig
|
||||
+++ qt-everywhere-opensource-src-4.8.5/src/corelib/codecs/qiconvcodec.cpp
|
||||
@@ -62,7 +62,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__))
|
||||
# define NO_BOM
|
||||
# if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
# define UTF16 "UTF-16BE"
|
14
pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch
Normal file
14
pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++/qplatformdefs.h.orig
|
||||
+++ qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++/qplatformdefs.h
|
||||
@@ -86,11 +86,7 @@
|
||||
|
||||
#undef QT_SOCKLEN_T
|
||||
|
||||
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
|
||||
#define QT_SOCKLEN_T socklen_t
|
||||
-#else
|
||||
-#define QT_SOCKLEN_T int
|
||||
-#endif
|
||||
|
||||
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
|
||||
#define QT_SNPRINTF ::snprintf
|
Loading…
Reference in New Issue
Block a user