fix & enable package: qt5-qtbase

%ci:no-build
This commit is contained in:
Leonid Pliushch 2021-10-26 10:32:44 +00:00 committed by Yaksh Bariya
parent 7b6e094fc9
commit f6e69c60be
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
20 changed files with 793 additions and 0 deletions

View File

@ -0,0 +1,218 @@
TERMUX_PKG_HOMEPAGE=https://www.qt.io/
TERMUX_PKG_DESCRIPTION="A cross-platform application and UI framework"
TERMUX_PKG_LICENSE="LGPL-3.0"
TERMUX_PKG_MAINTAINER="Simeon Huang <symeon@librehat.com>"
TERMUX_PKG_VERSION=5.12.11
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL="https://download.qt.io/official_releases/qt/5.12/${TERMUX_PKG_VERSION}/submodules/qtbase-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz"
TERMUX_PKG_SHA256=1c1b4e33137ca77881074c140d54c3c9747e845a31338cfe8680f171f0bc3a39
TERMUX_PKG_DEPENDS="dbus, double-conversion, harfbuzz, libandroid-shmem, libc++, libice, libicu, libjpeg-turbo, libpng, libsm, libuuid, libx11, libxcb, libxi, libxkbcommon, openssl, pcre2, ttf-dejavu, freetype, xcb-util-image, xcb-util-keysyms, xcb-util-renderutil, xcb-util-wm, zlib, glib"
# gtk3 dependency is a run-time dependency only for the gtk platformtheme subpackage
TERMUX_PKG_BUILD_DEPENDS="gtk3"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_RM_AFTER_INSTALL="
bin/fixqt4headers.pl
bin/syncqt.pl
"
# Replacing the old qt5-base packages
TERMUX_PKG_REPLACES="qt5-base"
TERMUX_PKG_BREAKS="qt5-x11extras, qt5-tools, qt5-declarative"
termux_step_pre_configure () {
if [ "${TERMUX_ARCH}" = "arm" ]; then
## -mfpu=neon causes build failure on ARM.
CFLAGS="${CFLAGS/-mfpu=neon/} -mfpu=vfp"
CXXFLAGS="${CXXFLAGS/-mfpu=neon/} -mfpu=vfp"
fi
## Create qmake.conf suitable for cross-compiling.
sed \
-e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
-e "s|@TERMUX_CC@|${TERMUX_HOST_PLATFORM}-clang|" \
-e "s|@TERMUX_CXX@|${TERMUX_HOST_PLATFORM}-clang++|" \
-e "s|@TERMUX_AR@|llvm-ar|" \
-e "s|@TERMUX_NM@|llvm-nm|" \
-e "s|@TERMUX_OBJCOPY@|llvm-objcopy|" \
-e "s|@TERMUX_PKGCONFIG@|${TERMUX_HOST_PLATFORM}-pkg-config|" \
-e "s|@TERMUX_STRIP@|llvm-strip|" \
-e "s|@TERMUX_CFLAGS@|${CPPFLAGS} ${CFLAGS}|" \
-e "s|@TERMUX_CXXFLAGS@|${CPPFLAGS} ${CXXFLAGS}|" \
-e "s|@TERMUX_LDFLAGS@|${LDFLAGS}|" \
"${TERMUX_PKG_BUILDER_DIR}/qmake.conf" > "${TERMUX_PKG_SRCDIR}/mkspecs/termux-cross/qmake.conf"
}
termux_step_configure () {
unset CC CXX LD CFLAGS LDFLAGS PKG_CONFIG_PATH
"${TERMUX_PKG_SRCDIR}"/configure -v \
-opensource \
-confirm-license \
-release \
-optimized-tools \
-xplatform termux-cross \
-shared \
-no-rpath \
-no-use-gold-linker \
-prefix "${TERMUX_PREFIX}" \
-docdir "${TERMUX_PREFIX}/share/doc/qt" \
-archdatadir "${TERMUX_PREFIX}/lib/qt" \
-datadir "${TERMUX_PREFIX}/share/qt" \
-plugindir "${TERMUX_PREFIX}/libexec/qt" \
-hostbindir "${TERMUX_PREFIX}/opt/qt/cross/bin" \
-hostlibdir "${TERMUX_PREFIX}/opt/qt/cross/lib" \
-I "${TERMUX_PREFIX}/include" \
-I "${TERMUX_PREFIX}/include/glib-2.0" \
-I "${TERMUX_PREFIX}/lib/glib-2.0/include" \
-I "${TERMUX_PREFIX}/include/gio-unix-2.0" \
-I "${TERMUX_PREFIX}/include/cairo" \
-I "${TERMUX_PREFIX}/include/pango-1.0" \
-I "${TERMUX_PREFIX}/include/fribidi" \
-I "${TERMUX_PREFIX}/include/harfbuzz" \
-I "${TERMUX_PREFIX}/include/atk-1.0" \
-I "${TERMUX_PREFIX}/include/pixman-1" \
-I "${TERMUX_PREFIX}/include/uuid" \
-I "${TERMUX_PREFIX}/include/libxml2" \
-I "${TERMUX_PREFIX}/include/freetype2" \
-I "${TERMUX_PREFIX}/include/gdk-pixbuf-2.0" \
-I "${TERMUX_PREFIX}/include/gtk-3.0" \
-L "${TERMUX_PREFIX}/lib" \
-nomake examples \
-no-pch \
-no-accessibility \
-glib \
-gtk \
-icu \
-system-doubleconversion \
-system-pcre \
-system-zlib \
-system-freetype \
-ssl \
-openssl-linked \
-no-system-proxies \
-no-cups \
-system-harfbuzz \
-no-opengl \
-no-vulkan \
-qpa xcb \
-no-eglfs \
-no-gbm \
-no-kms \
-no-linuxfb \
-no-mirclient \
-no-libudev \
-no-evdev \
-no-libinput \
-no-mtdev \
-no-tslib \
-system-xcb \
-no-xcb-xinput \
-gif \
-system-libpng \
-system-libjpeg \
-system-sqlite \
-sql-sqlite \
-no-feature-systemsemaphore
}
termux_step_post_make_install() {
#######################################################
##
## Compiling necessary libraries for target.
##
#######################################################
cd "${TERMUX_PKG_SRCDIR}/src/tools/bootstrap" && {
make clean
"${TERMUX_PREFIX}/opt/qt/cross/bin/qmake" \
-spec "${TERMUX_PKG_SRCDIR}/mkspecs/termux-cross" \
DEFINES+="QT_NO_SYSTEMSEMAPHORE"
make -j "${TERMUX_MAKE_PROCESSES}"
install -Dm644 ../../../lib/libQt5Bootstrap.a "${TERMUX_PREFIX}/lib/libQt5Bootstrap.a"
install -Dm644 ../../../lib/libQt5Bootstrap.prl "${TERMUX_PREFIX}/lib/libQt5Bootstrap.prl"
}
cd "${TERMUX_PKG_SRCDIR}/src/tools/bootstrap-dbus" && {
# create the dbus bootstrap archieve but we don't need to install this
make clean
"${TERMUX_PREFIX}/opt/qt/cross/bin/qmake" \
-spec "${TERMUX_PKG_SRCDIR}/mkspecs/termux-cross"
make -j "${TERMUX_MAKE_PROCESSES}"
}
#######################################################
##
## Compiling necessary programs for target.
##
#######################################################
## Note: qmake can be built only on host so it is omitted here.
for i in moc qlalr qvkgen rcc uic qdbuscpp2xml qdbusxml2cpp; do
cd "${TERMUX_PKG_SRCDIR}/src/tools/${i}" && {
make clean
"${TERMUX_PREFIX}/opt/qt/cross/bin/qmake" \
-spec "${TERMUX_PKG_SRCDIR}/mkspecs/termux-cross"
## Ensure that no '-lpthread' specified in makefile.
sed \
-i 's@-lpthread@@g' \
Makefile
## Fix build failure on at least 'i686'.
sed \
-i 's@$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)@$(LINK) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) $(LFLAGS) -lz@g' \
Makefile
make -j "${TERMUX_MAKE_PROCESSES}"
install -Dm700 "../../../bin/${i}" "${TERMUX_PREFIX}/bin/${i}"
}
done
unset i
## Unpacking prebuilt qmake from archive.
cd "${TERMUX_PKG_SRCDIR}" && {
tar xf "${TERMUX_PKG_BUILDER_DIR}/prebuilt.tar.xz"
install \
-Dm700 "${TERMUX_PKG_SRCDIR}/bin/qmake-${TERMUX_HOST_PLATFORM}" \
"${TERMUX_PREFIX}/bin/qmake"
}
#######################################################
##
## Fixes & cleanup.
##
#######################################################
# Limit the scope, otherwise it'll touch other Qt files in a dirty host env
for i in Bootstrap Concurrent Core DBus DeviceDiscoverySupport EdidSupport EventDispatcherSupport FbSupport FontDatabaseSupport Gui InputSupport Network PrintSupport ServiceSupport Sql Test ThemeSupport Widget XcbQpa XkbCommonSupport Xml Zlib; do
## Drop QMAKE_PRL_BUILD_DIR because reference the build dir.
find "${TERMUX_PREFIX}/lib" -type f -name "libQt5${i}.prl" \
-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' "{}" \;
done
unset i
sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' "${TERMUX_PREFIX}/opt/qt/cross/lib/libQt5Bootstrap.prl"
## Remove *.la files.
find "${TERMUX_PREFIX}/lib" -iname \*.la -delete
find "${TERMUX_PREFIX}/opt/qt/cross/lib" -iname \*.la -delete
## Create qmake.conf suitable for compiling host tools (for other modules)
install -Dm644 \
"${TERMUX_PKG_BUILDER_DIR}/qplatformdefs.host.h" \
"${TERMUX_PREFIX}/lib/qt/mkspecs/termux-host/qplatformdefs.h"
sed \
-e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
"${TERMUX_PKG_BUILDER_DIR}/qmake.host.conf" > "${TERMUX_PREFIX}/lib/qt/mkspecs/termux-host/qmake.conf"
}
termux_step_create_debscripts() {
# Some clean-up is happening via `postinst`
# Because we're using this package in both host (Ubuntu glibc) and device (Termux)
cp -f "${TERMUX_PKG_BUILDER_DIR}/postinst" ./
}

View File

@ -0,0 +1,24 @@
--- src/src/corelib/configure.json 2020-09-21 13:16:21.000000000 +0000
+++ src.mod/src/corelib/configure.json 2021-05-18 13:05:04.670547308 +0000
@@ -44,7 +44,8 @@
},
"headers": "glib.h",
"sources": [
- { "type": "pkgConfig", "args": "glib-2.0 gthread-2.0" }
+ { "type": "pkgConfig", "args": "glib-2.0 gthread-2.0" },
+ { "libs": "-lgthread-2.0 -lglib-2.0" }
]
},
"posix_iconv": {
--- src/src/widgets/configure.json 2020-09-21 13:16:21.000000000 +0000
+++ src.mod/src/widgets/configure.json 2021-05-18 13:07:19.325327327 +0000
@@ -21,7 +21,8 @@
"gtk3": {
"label": "GTK+ >= 3.6",
"sources": [
- { "type": "pkgConfig", "args": "gtk+-3.0 >= 3.6" }
+ { "type": "pkgConfig", "args": "gtk+-3.0 >= 3.6" },
+ { "libs": "-lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0" }
]
}
},

View File

@ -0,0 +1,34 @@
#!/data/data/com.termux/files/usr/bin/sh
PREFIX="/data/data/com.termux/files/usr"
if [ `uname -o` = 'Android' ]; then
echo "Patching Qt installation configuration files ..."
## Set qt spec path suitable for target.
sed -i \
's|/lib/qt//mkspecs/termux-cross"|/lib/qt/mkspecs/termux"|g' \
"${PREFIX}/lib/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake"
## Make sure the cmake configurations point to the on-device programs instead of the host tools
for i in Core DBus Widgets; do
sed -i \
's|install_prefix}/opt/qt/cross/|install_prefix}/|g' \
"${PREFIX}/lib/cmake/Qt5${i}/Qt5${i}ConfigExtras.cmake"
done
unset i
fi
## FIXME: Qt should be built with fontconfig somehow instead
## of using direct path to fonts.
## Currently, using post-installation script to create symlink
## from /system/bin/fonts to $PREFIX/lib/fonts if possible.
if [ ! -e "${PREFIX}/lib/fonts" ]; then
ln -sf "${PREFIX}/share/fonts/TTF" "${PREFIX}/lib/fonts"
else
if [ -h "${PREFIX}/lib/fonts" ]; then
rm -f "${PREFIX}/lib/fonts"
ln -sf "${PREFIX}/share/fonts/TTF" "${PREFIX}/lib/fonts"
fi
fi

Binary file not shown.

View File

@ -0,0 +1,34 @@
QT_QPA_DEFAULT_PLATFORM = xcb
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/clang.conf)
QMAKE_INCDIR += @TERMUX_PREFIX@/include/glib-2.0
QMAKE_INCDIR += @TERMUX_PREFIX@/lib/glib-2.0/include
QMAKE_CC = @TERMUX_CC@
QMAKE_CXX = @TERMUX_CXX@
QMAKE_LINK = $${QMAKE_CXX}
QMAKE_LINK_SHLIB = $${QMAKE_CXX}
QMAKE_AR = @TERMUX_AR@ cqs
QMAKE_NM = @TERMUX_NM@ -P
QMAKE_OBJCOPY = @TERMUX_OBJCOPY@
QMAKE_PKG_CONFIG = @TERMUX_PKGCONFIG@
QMAKE_STRIP = @TERMUX_STRIP@
QMAKE_CFLAGS += @TERMUX_CFLAGS@
QMAKE_CXXFLAGS += @TERMUX_CXXFLAGS@
QMAKE_LFLAGS += -landroid-shmem @TERMUX_LDFLAGS@
QMAKE_LFLAGS_SHLIB += -shared
QMAKE_LFLAGS_PLUGIN += -shared
## Should be -lpthread, but Termux does not provide
## libpthread.so library.
QMAKE_LIBS_THREAD =
load(qt_config)

View File

@ -0,0 +1,16 @@
# This configuration is for the termux builder (Ubuntu glibc)
QT_QPA_DEFAULT_PLATFORM = xcb
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_INCDIR += @TERMUX_PREFIX@/include
QMAKE_INCDIR += @TERMUX_PREFIX@/include/glib-2.0
QMAKE_INCDIR += @TERMUX_PREFIX@/lib/glib-2.0/include
load(qt_config)

View File

@ -0,0 +1,4 @@
#include "../android-clang/qplatformdefs.h"
#define fseeko64 fseeko
#define ftello64 ftello
#define fopen64 fopen

View File

@ -0,0 +1,8 @@
TERMUX_SUBPKG_DESCRIPTION="Tools for cross build on the host (NOT for Termux)"
TERMUX_SUBPKG_DEPENDS="qt5-qtbase"
TERMUX_SUBPKG_INCLUDE="
opt/qt/cross/bin/*
opt/qt/cross/lib/*
lib/qt/mkspecs/termux-cross/*
lib/qt/mkspecs/termux-host/*
"

View File

@ -0,0 +1,6 @@
TERMUX_SUBPKG_DESCRIPTION="GTK+ 3 platform theme for Qt 5"
TERMUX_SUBPKG_DEPENDS="qt5-qtbase, gtk3"
TERMUX_SUBPKG_INCLUDE="
libexec/qt/platformthemes/libqgtk3.so
lib/cmake/Qt5Gui/Qt5Gui_QGtk3ThemePlugin.cmake
"

View File

@ -0,0 +1,47 @@
--- src/src/corelib/io/qfilesystemengine_unix.cpp 2020-09-21 13:16:21.000000000 +0000
+++ src.mod/src/corelib/io/qfilesystemengine_unix.cpp 2021-05-06 16:16:02.735214214 +0000
@@ -95,7 +95,7 @@
#endif
#endif
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) || defined(__ANDROID__)
// statx() is disabled on Android because quite a few systems
// come with sandboxes that kill applications that make system calls outside a
// whitelist and several Android vendors can't be bothered to update the list.
@@ -109,7 +109,7 @@
QT_BEGIN_NAMESPACE
enum {
-#ifdef Q_OS_ANDROID
+#if defined(Q_OS_ANDROID) || defined(__ANDROID__)
// On Android, the link(2) system call has been observed to always fail
// with EACCES, regardless of whether there are permission problems or not.
SupportsHardlinking = false
@@ -690,7 +690,7 @@
if (entry.isRoot())
return entry;
-#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU) && _POSIX_VERSION < 200809L
+#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) && !defined(__ANDROID__) && !defined(Q_OS_HAIKU) && _POSIX_VERSION < 200809L
// realpath(X,0) is not supported
Q_UNUSED(data);
return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath()));
@@ -704,7 +704,7 @@
errno = savedErrno;
ret = 0;
}
-# elif defined(Q_OS_ANDROID)
+# elif defined(Q_OS_ANDROID) || defined(__ANDROID__)
// On some Android versions, realpath() will return a path even if it does not exist
// To work around this, we check existence in advance.
if (!data.hasFlags(QFileSystemMetaData::ExistsAttribute))
@@ -854,7 +854,7 @@
#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_WASM)
struct group *gr = 0;
-#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
+#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || !defined(__ANDROID__) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
size_max = sysconf(_SC_GETGR_R_SIZE_MAX);
if (size_max == -1)
size_max = 1024;

View File

@ -0,0 +1,8 @@
diff -uNr qtbase/mkspecs/termux-cross/qplatformdefs.h qtbase.mod/mkspecs/termux-cross/qplatformdefs.h
--- qtbase/mkspecs/termux-cross/qplatformdefs.h 1970-01-01 03:00:00.000000000 +0300
+++ qtbase.mod/mkspecs/termux-cross/qplatformdefs.h 2018-09-21 16:25:01.055329471 +0300
@@ -0,0 +1,4 @@
+#include "../android-clang/qplatformdefs.h"
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fopen64 fopen

View File

@ -0,0 +1,35 @@
diff -uNr qtbase/mkspecs/termux/qmake.conf qtbase.mod/mkspecs/termux/qmake.conf
--- qtbase/mkspecs/termux/qmake.conf 1970-01-01 03:00:00.000000000 +0300
+++ qtbase.mod/mkspecs/termux/qmake.conf 2018-09-21 16:26:18.042253449 +0300
@@ -0,0 +1,31 @@
+QT_QPA_DEFAULT_PLATFORM = xcb
+
+MAKEFILE_GENERATOR = UNIX
+CONFIG += incremental
+QMAKE_INCREMENTAL_STYLE = sublib
+
+include(../common/linux.conf)
+include(../common/gcc-base-unix.conf)
+include(../common/clang.conf)
+
+QMAKE_CC = clang
+QMAKE_CXX = clang++
+QMAKE_LINK = $${QMAKE_CXX}
+QMAKE_LINK_SHLIB = $${QMAKE_CXX}
+QMAKE_AR = ar cqs
+QMAKE_NM = nm -P
+QMAKE_OBJCOPY = objcopy
+QMAKE_PKG_CONFIG = pkg-config
+QMAKE_STRIP = strip
+
+QMAKE_CFLAGS += -I/data/data/com.termux/files/usr/include
+QMAKE_CXXFLAGS += -I/data/data/com.termux/files/usr/include
+QMAKE_LFLAGS += -L/data/data/com.termux/files/usr/lib
+QMAKE_LFLAGS_SHLIB += -shared
+QMAKE_LFLAGS_PLUGIN += -shared
+
+## Should be -lpthread, but Termux does not provide
+## libpthread.so library.
+QMAKE_LIBS_THREAD =
+
+load(qt_config)

View File

@ -0,0 +1,8 @@
diff -uNr qtbase/mkspecs/termux/qplatformdefs.h qtbase.mod/mkspecs/termux/qplatformdefs.h
--- qtbase/mkspecs/termux/qplatformdefs.h 1970-01-01 03:00:00.000000000 +0300
+++ qtbase.mod/mkspecs/termux/qplatformdefs.h 2018-09-21 16:25:01.055329471 +0300
@@ -0,0 +1,4 @@
+#include "../android-clang/qplatformdefs.h"
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fopen64 fopen

View File

@ -0,0 +1,11 @@
--- src/src/corelib/global/qsystemdetection.h.orig 2021-05-06 14:36:25.054047886 +0000
+++ src.mod/src/corelib/global/qsystemdetection.h 2021-05-06 14:43:45.917806447 +0000
@@ -109,7 +109,7 @@
# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"
# endif
#elif defined(__ANDROID__) || defined(ANDROID)
-# define Q_OS_ANDROID
+# define Q_OS_ANDROID_EMBEDDED
# define Q_OS_LINUX
#elif defined(__CYGWIN__)
# define Q_OS_CYGWIN

View File

@ -0,0 +1,48 @@
diff -uNr qtbase/src/corelib/thread/qthread_unix.cpp qtbase.mod/src/corelib/thread/qthread_unix.cpp
--- qtbase/src/corelib/thread/qthread_unix.cpp 2018-09-13 07:25:10.000000000 +0300
+++ qtbase.mod/src/corelib/thread/qthread_unix.cpp 2018-09-21 16:25:01.058662816 +0300
@@ -92,7 +92,7 @@
# define SCHED_IDLE 5
#endif
-#if defined(Q_OS_DARWIN) || !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
+#if !defined(__ANDROID__) && (defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0))
#define QT_HAS_THREAD_PRIORITY_SCHEDULING
#endif
@@ -312,7 +312,7 @@
void *QThreadPrivate::start(void *arg)
{
-#if !defined(Q_OS_ANDROID)
+#if !defined(__ANDROID__)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
#endif
pthread_cleanup_push(QThreadPrivate::finish, arg);
@@ -360,7 +360,7 @@
#endif
emit thr->started(QThread::QPrivateSignal());
-#if !defined(Q_OS_ANDROID)
+#if !defined(__ANDROID__)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_testcancel();
#endif
@@ -747,7 +747,7 @@
void QThread::terminate()
{
-#if !defined(Q_OS_ANDROID)
+#if !defined(__ANDROID__)
Q_D(QThread);
QMutexLocker locker(&d->mutex);
@@ -789,7 +789,7 @@
"Current thread was not started with QThread.");
Q_UNUSED(thr)
-#if defined(Q_OS_ANDROID)
+#if defined(__ANDROID__)
Q_UNUSED(enabled);
#else
pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL);

View File

@ -0,0 +1,69 @@
diff -uNr qtbase/src/network/kernel/qdnslookup_unix.cpp qtbase.mod/src/network/kernel/qdnslookup_unix.cpp
--- qtbase/src/network/kernel/qdnslookup_unix.cpp 2018-09-13 07:25:10.000000000 +0300
+++ qtbase.mod/src/network/kernel/qdnslookup_unix.cpp 2018-09-21 16:25:01.061996160 +0300
@@ -65,9 +65,63 @@
#if QT_CONFIG(library)
-#if defined(Q_OS_OPENBSD)
-typedef struct __res_state* res_state;
+#include <sys/types.h>
+#include <linux/in.h>
+
+/* res_state: the global state used by the resolver stub. */
+#define MAXNS 3 /* max # name servers we'll track */
+#define MAXDFLSRCH 3 /* # default domain levels to try */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define MAXRESOLVSORT 10 /* number of net to sort on */
+
+struct __res_state {
+ int retrans; /* retransmition time interval */
+ int retry; /* number of times to retransmit */
+ unsigned long options; /* option flags - see below. */
+ int nscount; /* number of name servers */
+ struct sockaddr_in
+ nsaddr_list[MAXNS]; /* address of name server */
+ unsigned short id; /* current message id */
+ /* 2 byte hole here. */
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+ char defdname[256]; /* default domain (deprecated) */
+ unsigned long pfcode; /* RES_PRF_ flags - see below. */
+ unsigned ndots:4; /* threshold for initial abs. query */
+ unsigned nsort:4; /* number of elements in sort_list[] */
+ unsigned ipv6_unavail:1; /* connecting to IPv6 server failed */
+ unsigned unused:23;
+ struct {
+ struct in_addr addr;
+ uint32_t mask;
+ } sort_list[MAXRESOLVSORT];
+ /* 4 byte hole here on 64-bit architectures. */
+ void * __glibc_unused_qhook;
+ void * __glibc_unused_rhook;
+ int res_h_errno; /* last one set for this context */
+ int _vcsock; /* PRIVATE: for res_send VC i/o */
+ unsigned int _flags; /* PRIVATE: see below */
+ /* 4 byte hole here on 64-bit architectures. */
+ union {
+ char pad[52]; /* On an i386 this means 512b total. */
+ struct {
+ uint16_t nscount;
+ uint16_t nsmap[MAXNS];
+ int nssocks[MAXNS];
+ uint16_t nscount6;
+ uint16_t nsinit;
+ struct sockaddr_in6 *nsaddrs[MAXNS];
+#ifdef _LIBC
+ unsigned long long int __glibc_extension_index
+ __attribute__((packed));
+#else
+ unsigned int __glibc_reserved[2];
#endif
+ } _ext;
+ } _u;
+};
+
+typedef struct __res_state* res_state;
+
typedef int (*dn_expand_proto)(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
static dn_expand_proto local_dn_expand = 0;
typedef void (*res_nclose_proto)(res_state);

View File

@ -0,0 +1,65 @@
diff -uNr qtbase/src/network/kernel/qhostinfo_unix.cpp qtbase.mod/src/network/kernel/qhostinfo_unix.cpp
--- qtbase/src/network/kernel/qhostinfo_unix.cpp 2018-09-13 07:25:10.000000000 +0300
+++ qtbase.mod/src/network/kernel/qhostinfo_unix.cpp 2018-09-21 16:25:01.061996160 +0300
@@ -84,6 +84,61 @@
NeedResNInit
};
+#include <sys/types.h>
+#include <linux/in.h>
+
+/* res_state: the global state used by the resolver stub. */
+#define MAXNS 3 /* max # name servers we'll track */
+#define MAXDFLSRCH 3 /* # default domain levels to try */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define MAXRESOLVSORT 10 /* number of net to sort on */
+
+struct __res_state {
+ int retrans; /* retransmition time interval */
+ int retry; /* number of times to retransmit */
+ unsigned long options; /* option flags - see below. */
+ int nscount; /* number of name servers */
+ struct sockaddr_in
+ nsaddr_list[MAXNS]; /* address of name server */
+ unsigned short id; /* current message id */
+ /* 2 byte hole here. */
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+ char defdname[256]; /* default domain (deprecated) */
+ unsigned long pfcode; /* RES_PRF_ flags - see below. */
+ unsigned ndots:4; /* threshold for initial abs. query */
+ unsigned nsort:4; /* number of elements in sort_list[] */
+ unsigned ipv6_unavail:1; /* connecting to IPv6 server failed */
+ unsigned unused:23;
+ struct {
+ struct in_addr addr;
+ uint32_t mask;
+ } sort_list[MAXRESOLVSORT];
+ /* 4 byte hole here on 64-bit architectures. */
+ void * __glibc_unused_qhook;
+ void * __glibc_unused_rhook;
+ int res_h_errno; /* last one set for this context */
+ int _vcsock; /* PRIVATE: for res_send VC i/o */
+ unsigned int _flags; /* PRIVATE: see below */
+ /* 4 byte hole here on 64-bit architectures. */
+ union {
+ char pad[52]; /* On an i386 this means 512b total. */
+ struct {
+ uint16_t nscount;
+ uint16_t nsmap[MAXNS];
+ int nssocks[MAXNS];
+ uint16_t nscount6;
+ uint16_t nsinit;
+ struct sockaddr_in6 *nsaddrs[MAXNS];
+#ifdef _LIBC
+ unsigned long long int __glibc_extension_index
+ __attribute__((packed));
+#else
+ unsigned int __glibc_reserved[2];
+#endif
+ } _ext;
+ } _u;
+};
+
typedef struct __res_state *res_state_ptr;
typedef int (*res_init_proto)(void);

View File

@ -0,0 +1,11 @@
--- src/src/corelib/io/qtemporaryfile_p.h 2021-05-09 10:40:38.972403873 +0100
+++ src.mod/src/corelib/io/qtemporaryfile_p.h 2021-05-09 10:40:32.520423082 +0100
@@ -58,7 +58,7 @@
#include "private/qfile_p.h"
#include "qtemporaryfile.h"
-#if defined(Q_OS_LINUX) && QT_CONFIG(linkat)
+#if defined(Q_OS_LINUX) && !defined(__ANDROID__) && QT_CONFIG(linkat)
# include <fcntl.h>
# ifdef O_TMPFILE
// some early libc support had the wrong values for O_TMPFILE

View File

@ -0,0 +1,24 @@
diff --color -uNr qtbase-everywhere-src-5.12.10/src/network/ssl/qsslsocket.cpp qtbase-everywhere-src-5.12.10.mod/src/network/ssl/qsslsocket.cpp
--- qtbase-everywhere-src-5.12.10/src/network/ssl/qsslsocket.cpp 2020-09-21 14:16:21.000000000 +0100
+++ qtbase-everywhere-src-5.12.10.mod/src/network/ssl/qsslsocket.cpp 2021-05-15 21:38:31.770873374 +0100
@@ -2800,7 +2800,8 @@
<< "/usr/local/ssl/certs/" // Solaris
<< "/etc/openssl/certs/" // BlackBerry
<< "/opt/openssl/certs/" // HP-UX
- << "/etc/ssl/"; // OpenBSD
+ << "/etc/ssl/" // OpenBSD
+ << "@TERMUX_PREFIX@/etc/tls/"; // Termux
}
/*!
diff --color -uNr qtbase-everywhere-src-5.12.10/src/network/ssl/qsslsocket_openssl.cpp qtbase-everywhere-src-5.12.10.mod/src/network/ssl/qsslsocket_openssl.cpp
--- qtbase-everywhere-src-5.12.10/src/network/ssl/qsslsocket_openssl.cpp 2020-09-21 14:16:21.000000000 +0100
+++ qtbase-everywhere-src-5.12.10.mod/src/network/ssl/qsslsocket_openssl.cpp 2021-05-15 21:36:38.303135420 +0100
@@ -670,6 +670,7 @@
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora, Mandriva
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/share/certs/ca-root-nss.crt"), QSsl::Pem)); // FreeBSD's ca_root_nss
# endif
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("@TERMUX_PREFIX@/etc/tls/cert.pem"), QSsl::Pem)); // Termux ca-certificates
}
#endif
#ifdef QSSLSOCKET_DEBUG

View File

@ -0,0 +1,123 @@
#!/data/data/com.termux/files/usr/bin/bash
##
## A script for building qmake on device.
## Use in Termux only !
##
## Usage:
##
## ./termux-build-qmake.sh
set -e
TERMUX_PREFIX=/data/data/com.termux/files/usr
if [ $(uname -o) != Android ]; then
echo "This script should be run in Termux !"
exit 1
fi
if [ -e "build.sh" ]; then
source ./build.sh
fi
apt update
apt upgrade -y
apt install -y coreutils clang curl debianutils make
hash -r
## Override function from build.sh since we are
## building for host.
termux_step_configure () {
export PKG_CONFIG_SYSROOT_DIR="${TERMUX_PREFIX}"
./configure -v \
-opensource \
-confirm-license \
-release \
-platform termux \
-shared \
-no-rpath \
-no-use-gold-linker \
-prefix "${TERMUX_PREFIX}" \
-docdir "${TERMUX_PREFIX}/share/doc/qt" \
-archdatadir "${TERMUX_PREFIX}/lib/qt" \
-datadir "${TERMUX_PREFIX}/share/qt" \
-plugindir "${TERMUX_PREFIX}/libexec/qt" \
-nomake examples \
-no-pch \
-no-accessibility \
-no-glib \
-icu \
-system-pcre \
-system-zlib \
-system-freetype \
-ssl \
-openssl-linked \
-no-system-proxies \
-no-cups \
-system-harfbuzz \
-no-opengl \
-no-vulkan \
-qpa xcb \
-no-eglfs \
-no-gbm \
-no-kms \
-no-linuxfb \
-no-mirclient \
-no-libudev \
-no-evdev \
-no-libinput \
-no-mtdev \
-no-tslib \
-system-xcb \
-no-xcb-xinput \
-gif \
-system-libpng \
-system-libjpeg \
-system-sqlite \
-sql-sqlite \
-no-feature-systemsemaphore
}
if [ ! -e "qtbase-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz" ]; then
echo "[*] Downloading Qt sources..."
curl -L --output "qtbase-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz" "${TERMUX_PKG_SRCURL}"
fi
echo "[*] Unpacking Qt sources..."
rm -rf "qtbase-everywhere-src-${TERMUX_PKG_VERSION}"
tar xf "qtbase-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz"
cd "qtbase-everywhere-src-${TERMUX_PKG_VERSION}" && {
## Patch the source
for i in `ls ../*.patch`; do
patch -p1 -Ni "${i}"
done
unset i
## We need only qmake generated by configure, so ignoring
## errors here.
set +e
echo "[*] Running ./configure..."
termux_step_configure
set -e
cd qmake && {
## Bootstrap qmake.
echo "[*] Bootstrapping qmake..."
../bin/qmake -spec termux -o Makefile.qmake-aux qmake-aux.pro
make -f Makefile.qmake-aux
## Just verify.
echo "[*] Verifying..."
./qmake -spec termux -o Makefile.qmake-aux qmake-aux.pro
make -f Makefile.qmake-aux
cd -
}
cd ../
}
echo "[*] Done. Check file './qmake-$(uname -m)-linux-android'."
cp "qtbase-everywhere-src-${TERMUX_PKG_VERSION}/qmake/qmake" "./qmake-$(uname -m)-linux-android"