termux-packages/x11-packages/qt5-base/termux-build-qmake.sh

168 lines
4.4 KiB
Bash
Executable File

#!/bin/sh
##
## A script for building qmake on device.
## Use in Termux only !
##
## Usage:
##
## git clone https://github.com/termux/x11-packages
## cp termux-build-qmake.sh x11-packages/packages/qt5-base/
## cd x11-packages/packages/qt5-base/
## bash 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 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 \
-optimized-qmake \
-no-rpath \
-no-use-gold-linker \
-prefix "${TERMUX_PREFIX}" \
-docdir "${TERMUX_PREFIX}/share/doc/qt" \
-headerdir "${TERMUX_PREFIX}/include/qt" \
-archdatadir "${TERMUX_PREFIX}/lib/qt" \
-datadir "${TERMUX_PREFIX}/share/qt" \
-sysconfdir "${TERMUX_PREFIX}/etc/xdg" \
-examplesdir "${TERMUX_PREFIX}/share/doc/qt/examples" \
-plugindir "$TERMUX_PREFIX/libexec/qt" \
-nomake examples \
-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 \
-no-eventfd \
-no-inotify \
-icu \
-system-pcre \
-system-zlib \
-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 \
-system-xcb \
-no-libudev \
-no-evdev \
-no-libinput \
-no-mtdev \
-no-tslib \
-system-xkbcommon-x11 \
-no-xkbcommon-evdev \
-gif \
-ico \
-system-libpng \
-system-libjpeg \
-sql-sqlite \
-no-feature-dnslookup
}
if [ ! -e "qt-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz" ]; then
echo "[*] Downloading Qt sources..."
curl -L --output "qt-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz" "${TERMUX_PKG_SRCURL}"
fi
echo "[*] Unpacking Qt sources..."
rm -rf "qt-everywhere-src-${TERMUX_PKG_VERSION}"
tar xf "qt-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz"
tar xf termux-prebuilt-qmake.txz
cd "qt-everywhere-src-${TERMUX_PKG_VERSION}" && {
## On-device hostbuild patch.
patch -p1 -i ../termux-prebuilt-qmake/misc/qt5-termux-build-host.patch
## We need only qmake generated by configure, so ignoring
## errors here.
set +e
echo "[*] Running ./configure..."
termux_step_configure
set -e
cd qtbase/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-android-$(uname -m)'."
cp "qt-everywhere-src-${TERMUX_PKG_VERSION}/qtbase/qmake/qmake" "./qmake-android-$(uname -m)"