qt5-base: use wrapper for 'qmake' and improve configuration steps

This commit is contained in:
Leonid Pliushch 2018-09-20 03:28:06 +03:00 committed by Yaksh Bariya
parent f655924d36
commit 7bfa8474ae
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
14 changed files with 172 additions and 121 deletions

View File

@ -5,20 +5,55 @@ TERMUX_PKG_DESCRIPTION="A cross-platform application and UI framework"
TERMUX_PKG_VERSION=5.11.1
TERMUX_PKG_SRCURL="http://download.qt.io/official_releases/qt/${TERMUX_PKG_VERSION%.*}/$TERMUX_PKG_VERSION/single/qt-everywhere-src-$TERMUX_PKG_VERSION.tar.xz"
TERMUX_PKG_SHA256=39602cb08f9c96867910c375d783eed00fc4a244bffaa93b801225d17950fb2b
TERMUX_PKG_DEPENDS="harfbuzz, libandroid-support, libandroid-shmem, libc++, libice, libicu, libjpeg-turbo, libpng, libsm, libxcb, libxkbcommon, openssl, pcre2, xcb-util-image, xcb-util-keysyms, xcb-util-renderutil"
TERMUX_PKG_BUILD_IN_SRC=true
## Note: we need proot for qmake wrapper since there currently no adequate fix
## for the qmake's search paths.
TERMUX_PKG_DEPENDS="harfbuzz, libandroid-support, libandroid-shmem, libc++, libice, libicu, libjpeg-turbo, libpng, libsm, libxcb, libxkbcommon, openssl, pcre2, proot, xcb-util-image, xcb-util-keysyms, xcb-util-renderutil"
termux_step_pre_configure () {
sed -e "s|@TERMUX_HOST_PLATFORM@|$TERMUX_HOST_PLATFORM|g" \
-e "s|@CFLAGS@|$CPPFLAGS $CFLAGS|" \
-e "s|@CXXFLAGS@|$CPPFLAGS $CXXFLAGS|" \
-e "s|@LDFLAGS@|$LDFLAGS|" "${TERMUX_PKG_BUILDER_DIR}/mkspec.diff" | patch -p1
## qmake.conf for cross-compiling
sed \
-e "s|@TERMUX_CC@|${TERMUX_HOST_PLATFORM}-clang|" \
-e "s|@TERMUX_CXX@|${TERMUX_HOST_PLATFORM}-clang++|" \
-e "s|@TERMUX_AR@|${TERMUX_HOST_PLATFORM}-ar|" \
-e "s|@TERMUX_NM@|${TERMUX_HOST_PLATFORM}-nm|" \
-e "s|@TERMUX_OBJCOPY@|${TERMUX_HOST_PLATFORM}-objcopy|" \
-e "s|@TERMUX_PKGCONFIG@|${TERMUX_HOST_PLATFORM}-pkg-config|" \
-e "s|@TERMUX_STRIP@|${TERMUX_HOST_PLATFORM}-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}/qtbase/mkspecs/termux/qmake.conf"
## qmake.conf for target.
## Should be put to correct place in post_install step.
sed \
-e "s|@TERMUX_CC@|clang|" \
-e "s|@TERMUX_CXX@|clang++|" \
-e "s|@TERMUX_AR@|ar|" \
-e "s|@TERMUX_NM@|nm|" \
-e "s|@TERMUX_OBJCOPY@|objcopy|" \
-e "s|@TERMUX_PKGCONFIG@|pkg-config|" \
-e "s|@TERMUX_STRIP@|strip|" \
-e "s|@TERMUX_CFLAGS@|${CPPFLAGS} ${CFLAGS}|" \
-e "s|@TERMUX_CXXFLAGS@|${CPPFLAGS} ${CXXFLAGS}|" \
-e "s|@TERMUX_LDFLAGS@|${LDFLAGS}|" \
"${TERMUX_PKG_BUILDER_DIR}/qmake.conf" > "/tmp/target-qmake.conf"
}
termux_step_configure () {
export PKG_CONFIG_SYSROOT_DIR="${TERMUX_PREFIX}"
unset CC CXX LD CFLAGS LDFLAGS
"${TERMUX_PKG_SRCDIR}"/configure -v \
-opensource \
-confirm-license \
-release \
-xplatform termux \
-optimized-qmake \
-no-rpath \
-no-use-gold-linker \
-prefix "${TERMUX_PREFIX}" \
-docdir "${TERMUX_PREFIX}/share/doc/qt" \
-headerdir "${TERMUX_PREFIX}/include/qt" \
@ -26,14 +61,47 @@ termux_step_configure () {
-datadir "${TERMUX_PREFIX}/share/qt" \
-sysconfdir "${TERMUX_PREFIX}/etc/xdg" \
-examplesdir "${TERMUX_PREFIX}/share/doc/qt/examples" \
-xplatform "linux-termux-clang" \
-plugindir "$TERMUX_PREFIX/libexec/qt" \
-opensource \
-confirm-license \
-no-rpath \
-optimized-qmake \
-nomake examples \
-gui \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtcharts \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdeclarative \
-skip qtdoc \
-skip qtgamepad \
-skip qtgraphicaleffects \
-skip qtimageformats \
-skip qtlocation \
-skip qtmacextras \
-skip qtmultimedia \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtquickcontrols \
-skip qtquickcontrols2 \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtserialbus \
-skip qtserialport \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtvirtualkeyboard \
-skip qtwayland \
-skip qtwebchannel \
-skip qtwebengine \
-skip qtwebglplugin \
-skip qtwebsockets \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-no-dbus \
-no-accessibility \
-no-glib \
@ -68,27 +136,21 @@ termux_step_configure () {
-system-libpng \
-system-libjpeg \
-sql-sqlite \
-no-pulseaudio \
-no-alsa \
-no-gstreamer \
-no-webengine-alsa \
-no-webengine-pulseaudio \
-no-webengine-embedded-build \
-no-feature-dnslookup
}
termux_step_make() {
make -j "${TERMUX_MAKE_PROCESSES}" module-qtbase
make -j "${TERMUX_MAKE_PROCESSES}"
}
termux_step_make_install() {
make -C qtbase install
make install
cd "${TERMUX_PKG_SRCDIR}/qtbase/src/tools/bootstrap" && {
make clean
"${TERMUX_PKG_SRCDIR}/qtbase/bin/qmake" \
-spec "${TERMUX_PKG_SRCDIR}/qtbase/mkspecs/linux-termux-clang"
-spec "${TERMUX_PKG_SRCDIR}/qtbase/mkspecs/termux"
make -j "${TERMUX_MAKE_PROCESSES}"
}
@ -98,7 +160,7 @@ termux_step_make_install() {
make clean
"${TERMUX_PKG_SRCDIR}/qtbase/bin/qmake" \
-spec "${TERMUX_PKG_SRCDIR}/qtbase/mkspecs/linux-termux-clang"
-spec "${TERMUX_PKG_SRCDIR}/qtbase/mkspecs/termux"
sed \
-i 's@-lpthread@@g' \
@ -118,16 +180,25 @@ termux_step_make_install() {
make \
-j "${TERMUX_MAKE_PROCESSES}" \
AR="${AR} cqs" \
CC="${CC}" \
CXX="${CXX}" \
LINK="${CXX}" \
STRIP="${STRIP}" \
QMAKESPEC="${TERMUX_PKG_SRCDIR}/qtbase/mkspecs/linux-termux-clang" \
AR="${TERMUX_HOST_PLATFORM}-ar cqs" \
CC="${TERMUX_HOST_PLATFORM}-clang" \
CXX="${TERMUX_HOST_PLATFORM}-clang++" \
LINK="${TERMUX_HOST_PLATFORM}-clang++" \
STRIP="${TERMUX_HOST_PLATFORM}-strip" \
QMAKESPEC="${TERMUX_PKG_SRCDIR}/qtbase/mkspecs/termux" \
QMAKE_LFLAGS="${TERMUX_PREFIX}/lib/libc++_shared.so"
install \
-Dm700 "${TERMUX_PKG_BUILDDIR}/qtbase/bin/qmake" \
"${TERMUX_PREFIX}/libexec/qt-bin/qmake"
install \
-Dm700 "${TERMUX_PKG_BUILDER_DIR}/qmake" \
"${TERMUX_PREFIX}/bin/qmake"
}
install \
-Dm600 \
"/tmp/target-qmake.conf" \
"${TERMUX_PREFIX}/lib/qt/mkspecs/termux/qmake.conf"
}

View File

@ -1,6 +0,0 @@
#ifndef FAKE_EXECINFO_H
#define FAKE_EXECINFO_H
int backtrace(void **array, int size) { return 0; }
char **backtrace_symbols(void *const *array, int size) { return 0; }
void backtrace_symbols_fd (void *const *array, int size, int fd) {}
#endif

View File

@ -1,81 +0,0 @@
--- ./qtbase/mkspecs/linux-termux-clang/qmake.conf 1970-01-01 05:30:00.000000000 +0530
+++ ./qtbase/mkspecs/linux-termux-clang/qmake.conf 2017-07-14 23:06:45.553367565 +0530
@@ -0,0 +1,32 @@
+MAKEFILE_GENERATOR = UNIX
+CONFIG += incremental unversioned_libname unversioned_soname plugin_with_soname qt
+QMAKE_INCREMENTAL_STYLE = sublib
+
+include(../common/linux.conf)
+include(../common/gcc-base-unix.conf)
+include(../common/clang.conf)
+
+QMAKE_CC = @TERMUX_HOST_PLATFORM@-clang
+QMAKE_CXX = @TERMUX_HOST_PLATFORM@-clang++
+QMAKE_LINK = @TERMUX_HOST_PLATFORM@-clang++
+QMAKE_LINK_SHLIB = @TERMUX_HOST_PLATFORM@-clang++
+
+QMAKE_AR = @TERMUX_HOST_PLATFORM@-ar cqs
+QMAKE_OBJCOPY = @TERMUX_HOST_PLATFORM@-objcopy
+QMAKE_NM = @TERMUX_HOST_PLATFORM@-nm -P
+QMAKE_STRIP = @TERMUX_HOST_PLATFORM@-strip
+
+QMAKE_CFLAGS = @CFLAGS@
+QMAKE_CXXFLAGS = @CXXFLAGS@
+QMAKE_LFLAGS = @LDFLAGS@
+
+QMAKE_LFLAGS_APP = -Wl,--no-undefined -Wl,-z,noexecstack
+QMAKE_LFLAGS_SHLIB = -Wl,--no-undefined -Wl,-z,noexecstack -shared
+QMAKE_LFLAGS_PLUGIN = -Wl,--no-undefined -Wl,-z,noexecstack -shared
+QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
+
+QMAKE_LIBS_THREAD =
+QMAKE_LIBS_X11 =
+QMAKE_LIBS_OPENGL =
+QMAKE_LIBS_OPENGL_ES2 =
+load(qt_config)
--- ./qtbase/mkspecs/linux-termux-clang/qplatformdefs.h 1970-01-01 05:30:00.000000000 +0530
+++ ./qtbase/mkspecs/linux-termux-clang/qplatformdefs.h 2017-07-14 23:08:02.031153237 +0530
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../android-clang/qplatformdefs.h"
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fopen64 fopen

13
x11-packages/qt5-base/qmake Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
##
## A wrapper that corrects paths for qmake.
##
[ -z "${PREFIX}" ] && export PREFIX="/data/data/com.termux/files/usr"
PROOT_EXE="${PREFIX}/bin/proot"
TARGET_EXE="${PREFIX}/libexec/qt-bin/qmake"
exec \
"${PROOT_EXE}" \
-b "${PREFIX}/lib/qt/mkspecs:/mkspecs" \
"${TARGET_EXE}" -spec termux "${@}"

View File

@ -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 = @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 += @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,8 @@
diff -uNr qt-everywhere-src-5.11.1/qtbase/mkspecs/termux/qplatformdefs.h qt-everywhere-src-5.11.1.mod/qtbase/mkspecs/termux/qplatformdefs.h
--- qt-everywhere-src-5.11.1/qtbase/mkspecs/termux/qplatformdefs.h 1970-01-01 03:00:00.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/mkspecs/termux/qplatformdefs.h 2018-09-20 03:22:39.659797353 +0300
@@ -0,0 +1,4 @@
+#include "../android-clang/qplatformdefs.h"
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fopen64 fopen

View File

@ -0,0 +1,15 @@
diff -uNr qt-everywhere-src-5.11.1/qtbase/qmake/option.cpp qt-everywhere-src-5.11.1.mod/qtbase/qmake/option.cpp
--- qt-everywhere-src-5.11.1/qtbase/qmake/option.cpp 2018-06-15 10:29:31.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/qmake/option.cpp 2018-09-20 03:23:36.357006976 +0300
@@ -365,6 +365,11 @@
#else
+ "/qmake";
#endif
+
+#ifdef __ANDROID__
+ globals->qmake_abslocation = "@TERMUX_PREFIX@/bin/qmake";
+#endif
+
} else {
globals->qmake_abslocation = QDir::cleanPath(globals->qmake_abslocation);
}

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtbase/src/corelib/global/qsystemdetection.h qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/global/qsystemdetection.h
--- qt-everywhere-src-5.11.1/qtbase/src/corelib/global/qsystemdetection.h 2018-06-15 10:29:31.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/global/qsystemdetection.h 2018-09-15 15:10:50.014669337 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/global/qsystemdetection.h 2018-09-20 03:22:39.659797353 +0300
@@ -108,9 +108,6 @@
# else
# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_unix.cpp qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/io/qfilesystemengine_unix.cpp
--- qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_unix.cpp 2018-06-15 10:29:31.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/io/qfilesystemengine_unix.cpp 2018-09-15 15:16:25.709705452 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/io/qfilesystemengine_unix.cpp 2018-09-20 03:22:39.663130719 +0300
@@ -98,7 +98,7 @@
# define FICLONE _IOW(0x94, 9, int)
#endif

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtbase/src/corelib/thread/qthread_unix.cpp qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/thread/qthread_unix.cpp
--- qt-everywhere-src-5.11.1/qtbase/src/corelib/thread/qthread_unix.cpp 2018-06-15 10:29:31.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/thread/qthread_unix.cpp 2018-09-15 15:10:50.018002688 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/corelib/thread/qthread_unix.cpp 2018-09-20 03:22:39.663130719 +0300
@@ -92,7 +92,7 @@
# define SCHED_IDLE 5
#endif

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtbase/src/network/kernel/qhostinfo_unix.cpp qt-everywhere-src-5.11.1.mod/qtbase/src/network/kernel/qhostinfo_unix.cpp
--- qt-everywhere-src-5.11.1/qtbase/src/network/kernel/qhostinfo_unix.cpp 2018-06-15 10:29:31.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/network/kernel/qhostinfo_unix.cpp 2018-09-15 15:10:50.021336038 +0300
+++ qt-everywhere-src-5.11.1.mod/qtbase/src/network/kernel/qhostinfo_unix.cpp 2018-09-20 03:22:39.663130719 +0300
@@ -84,6 +84,61 @@
NeedResNInit
};

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtlocation/src/plugins/geoservices/geoservices.pro qt-everywhere-src-5.11.1.mod/qtlocation/src/plugins/geoservices/geoservices.pro
--- qt-everywhere-src-5.11.1/qtlocation/src/plugins/geoservices/geoservices.pro 2018-06-12 21:44:12.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtlocation/src/plugins/geoservices/geoservices.pro 2018-09-15 15:10:50.028002739 +0300
+++ qt-everywhere-src-5.11.1.mod/qtlocation/src/plugins/geoservices/geoservices.pro 2018-09-20 03:22:39.666464086 +0300
@@ -8,11 +8,3 @@
qtConfig(geoservices_itemsoverlay): SUBDIRS += itemsoverlay
qtConfig(geoservices_osm): SUBDIRS += osm

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtsensors/src/plugins/sensors/linux/linux.pro qt-everywhere-src-5.11.1.mod/qtsensors/src/plugins/sensors/linux/linux.pro
--- qt-everywhere-src-5.11.1/qtsensors/src/plugins/sensors/linux/linux.pro 2018-06-12 12:10:20.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtsensors/src/plugins/sensors/linux/linux.pro 2018-09-15 15:10:50.028002739 +0300
+++ qt-everywhere-src-5.11.1.mod/qtsensors/src/plugins/sensors/linux/linux.pro 2018-09-20 03:22:39.666464086 +0300
@@ -3,7 +3,6 @@
OTHER_FILES = plugin.json

View File

@ -1,6 +1,6 @@
diff -uNr qt-everywhere-src-5.11.1/qtserialport/src/serialport/qserialport_unix.cpp qt-everywhere-src-5.11.1.mod/qtserialport/src/serialport/qserialport_unix.cpp
--- qt-everywhere-src-5.11.1/qtserialport/src/serialport/qserialport_unix.cpp 2018-06-09 14:09:14.000000000 +0300
+++ qt-everywhere-src-5.11.1.mod/qtserialport/src/serialport/qserialport_unix.cpp 2018-09-15 15:10:50.031336089 +0300
+++ qt-everywhere-src-5.11.1.mod/qtserialport/src/serialport/qserialport_unix.cpp 2018-09-20 03:22:39.666464086 +0300
@@ -73,7 +73,7 @@
# define __ANDROID_API__ 21
# endif