This commit is contained in:
ziggi
2021-03-09 15:37:23 +00:00
parent 831be4620d
commit d585eb8dc2
8 changed files with 279 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
As we moved the libraries of Qt5 from /usr/local/lib to /usr/local/lib/qt5 the
cmake files would get installed into /usr/local/lib/qt5/cmake. This however is
not really convenient for use with other applications depending on Qt via cmake.
For ports we could modify cmake.mk to always append /usr/local/lib/qt5 to the
search path. This would however still break applications outside of the ports
tree that users want to compile via cmake. An other option would be to patch
devel/cmake to add /usr/local/lib/qt5/cmake to the default search paths.
We chose the third option. To patch qmake's internal cmake generation function
to fix up the paths so that cmake files still land in the the "correct" location
in /usr/local/lib/cmake -- as this seemed to be the least intrusive method.
--- src/corelib/corelib.pro.orig 2017-06-28 11:54:29.000000000 +0200
+++ src/corelib/corelib.pro 2017-07-20 23:06:37.223900000 +0200
@@ -130,7 +130,7 @@
$$cmake_umbrella_config_version_file.output \
$$cmake_umbrella_config_module_location_for_install.output
-cmake_qt5_umbrella_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5
+cmake_qt5_umbrella_module_files.path = $$[QT_INSTALL_PREFIX]/lib/cmake/Qt5
QMAKE_SUBSTITUTES += \
ctest_macros_file \
@@ -143,6 +143,6 @@
ctest_qt5_module_files.files += $$ctest_macros_file.output $$cmake_extras_mkspec_dir_for_install.output
-ctest_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5Core
+ctest_qt5_module_files.path = $$[QT_INSTALL_PREFIX]/lib/cmake/Qt5Core
INSTALLS += ctest_qt5_module_files cmake_qt5_umbrella_module_files

View File

@@ -0,0 +1,17 @@
--- src/corelib/io/qiodevice.cpp.orig 2020-05-11 08:15:08 UTC
+++ src/corelib/io/qiodevice.cpp
@@ -1480,10 +1480,12 @@ QByteArray QIODevice::readLine(qint64 maxSize)
} else
readBytes = readLine(result.data(), result.size());
- if (readBytes <= 0)
+ if (readBytes <= 0) {
result.clear();
- else
+ } else {
result.resize(readBytes);
+ result.squeeze();
+ }
return result;
}

View File

@@ -0,0 +1,74 @@
--- src/corelib/io/io.pri.orig 2018-02-08 18:24:48 UTC
+++ src/corelib/io/io.pri
@@ -178,6 +178,9 @@ win32 {
SOURCES += \
io/qstandardpaths_unix.cpp \
io/qstorageinfo_unix.cpp
+ freebsd {
+ LIBS += -lkvm -lprocstat
+ }
}
linux|if(qnx:qtConfig(inotify)) {
--- src/corelib/io/qlockfile_unix.cpp.orig 2018-02-08 18:24:48 UTC
+++ src/corelib/io/qlockfile_unix.cpp
@@ -75,6 +75,8 @@
# include <sys/sysctl.h>
# if !defined(Q_OS_NETBSD)
# include <sys/user.h>
+# include <kvm.h>
+# include <libprocstat.h>
# endif
#endif
@@ -246,23 +248,44 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
struct kinfo_proc kp;
int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc), 1 };
# else
+ QString nameFromProcstat;
+ kvm_t *kvm = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "");
+ if (kvm) {
+ int cnt;
+ struct kinfo_proc *kp = kvm_getprocs(kvm, KERN_PROC_PID, getpid(), &cnt);
+ if (kp) {
+ struct procstat *ps = procstat_open_sysctl();
+ char **argv = procstat_getargv(ps, kp, 0);
+ if (argv != nullptr && argv[0] != nullptr)
+ nameFromProcstat = QString::fromLocal8Bit(argv[0]);
+ procstat_close(ps);
+ }
+ kvm_close(kvm);
+ }
struct kinfo_proc kp;
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid };
# endif
- size_t len = sizeof(kp);
- u_int mib_len = sizeof(mib)/sizeof(u_int);
+ if (nameFromProcstat.isEmpty()) {
+ size_t len = sizeof(kp);
+ u_int mib_len = sizeof(mib)/sizeof(u_int);
- if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0)
- return QString();
-
+ if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0)
+ return QString();
+ }
# if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD)
if (kp.p_pid != pid)
return QString();
QString name = QFile::decodeName(kp.p_comm);
# else
- if (kp.ki_pid != pid)
+ QString name;
+ if (!nameFromProcstat.isEmpty()) {
+ QFileInfo fi(nameFromProcstat);
+ name = fi.fileName();
+ }
+ else if (kp.ki_pid != pid)
return QString();
- QString name = QFile::decodeName(kp.ki_comm);
+ else
+ name = QFile::decodeName(kp.ki_comm);
# endif
return name;

View File

@@ -0,0 +1,39 @@
--- src/corelib/time/qtimezoneprivate_tz.cpp.orig 2020-09-12 18:44:11 UTC
+++ src/corelib/time/qtimezoneprivate_tz.cpp
@@ -1155,6 +1155,8 @@ class ZoneNameReader : public QObject (public)
return m_name;
m_name = etcLocalTime();
+ if (m_name.isEmpty())
+ m_name = varDBZoneinfo();
if (!m_name.isEmpty()) {
m_last = local;
return m_name;
@@ -1203,6 +1205,27 @@ class ZoneNameReader : public QObject (public)
return path.midRef(index + zoneinfo.size()).toUtf8();
} while (!path.isEmpty() && --iteration > 0);
+ return QByteArray();
+ }
+
+ static QByteArray varDBZoneinfo()
+ {
+ // On some FreeBSD systems, /etc/localtime is a regular file while
+ // the actual name is in /var/db/zoneinfo
+ QFile tzif(QStringLiteral("/var/db/zoneinfo"));
+ if (tzif.open(QIODevice::ReadOnly)) {
+ const int maximumTZNameLength = 256;
+ QByteArray tzcontents( tzif.read( maximumTZNameLength ) );
+ if (tzcontents.size() >= 2) {
+ const int newlineIndex = tzcontents.indexOf('\n');
+ if (newlineIndex < 0) // No newline in file
+ return tzcontents;
+ // Shortest TZ name in FreeBSD is "GB", "NZ" or "US"
+ if (newlineIndex >= 2) // Newline, chop it off
+ return tzcontents.left(newlineIndex);
+ // Newline on position 0 or 1 is an invalid name
+ }
+ }
return QByteArray();
}

View File

@@ -0,0 +1,24 @@
Do not inline functions which access TLS in LLVM JIT, as
this leads to crashes with unsupported relocation error
diff --git src/backend/jit/llvm/llvmjit_inline.cpp src/backend/jit/llvm/llvmjit_inline.cpp
index 2617a46..a063edb 100644
--- src/backend/jit/llvm/llvmjit_inline.cpp
+++ src/backend/jit/llvm/llvmjit_inline.cpp
@@ -608,6 +608,16 @@ function_inlinable(llvm::Function &F,
if (rv->materialize())
elog(FATAL, "failed to materialize metadata");
+ /*
+ * Don't inline functions with thread-local variables until
+ * related crashes are investigated (see BUG #16696)
+ */
+ if (rv->isThreadLocal()) {
+ ilog(DEBUG1, "cannot inline %s due to thread-local variable %s",
+ F.getName().data(), rv->getName().data());
+ return false;
+ }
+
/*
* Never want to inline externally visible vars, cheap enough to
* reference.

View File

@@ -0,0 +1,23 @@
--- cursor/os-compatibility.c.orig 2020-02-11 23:46:03 UTC
+++ cursor/os-compatibility.c
@@ -34,7 +34,7 @@
#include <string.h>
#include <stdlib.h>
-#ifdef HAVE_MEMFD_CREATE
+#if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__)
#include <sys/mman.h>
#endif
@@ -131,6 +131,11 @@ os_create_anonymous_file(off_t size)
*/
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
} else
+#elif defined(__FreeBSD__)
+/* posix_fallocate returns ENODEV before https://svnweb.freebsd.org/changeset/base/356512 */
+#undef HAVE_POSIX_FALLOCATE
+ fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600); // shm_open is always CLOEXEC
+ if (fd < 0)
#endif
{
path = getenv("XDG_RUNTIME_DIR");

View File

@@ -0,0 +1,33 @@
--- meson.build.orig 2020-02-11 23:46:03 UTC
+++ meson.build
@@ -26,7 +26,14 @@ add_project_arguments(
language: 'c'
)
-foreach h: [ 'sys/prctl.h' ]
+have_headers = [
+ 'signal.h',
+ 'sys/epoll.h',
+ 'sys/prctl.h',
+ 'sys/ucred.h',
+]
+
+foreach h: have_headers
config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
endforeach
@@ -37,12 +44,14 @@ have_funcs = [
'prctl',
'memfd_create',
'strndup',
+ 'waitid',
]
foreach f: have_funcs
config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
endforeach
if get_option('libraries')
+ epoll_dep = dependency('epoll-shim', required: false)
ffi_dep = dependency('libffi')
decls = [

View File

@@ -0,0 +1,36 @@
--- src/meson.build.orig 2021-01-06 19:25:15 UTC
+++ src/meson.build
@@ -77,7 +77,7 @@ if get_option('libraries')
'connection.c',
'wayland-os.c'
],
- dependencies: [ ffi_dep, rt_dep ]
+ dependencies: [ epoll_dep, ffi_dep, rt_dep ]
)
wayland_private_dep = declare_dependency(
@@ -151,6 +151,7 @@ if get_option('libraries')
],
version: '0.1.0',
dependencies: [
+ epoll_dep,
ffi_dep,
wayland_private_dep,
wayland_util_dep,
@@ -165,7 +166,7 @@ if get_option('libraries')
wayland_server_dep = declare_dependency(
link_with: wayland_server,
include_directories: [ root_inc, include_directories('.') ],
- dependencies: [ ffi_dep, mathlib_dep, threads_dep ],
+ dependencies: [ epoll_dep, ffi_dep, mathlib_dep, threads_dep ],
sources: [
wayland_server_protocol_core_h,
wayland_server_protocol_h
@@ -194,6 +195,7 @@ if get_option('libraries')
],
version: '0.3.0',
dependencies: [
+ epoll_dep,
ffi_dep,
wayland_private_dep,
wayland_util_dep,