From ee462ea178dcb11e075b6d7b6759d584a0124092 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Fri, 21 Jan 2022 00:28:31 +0100 Subject: [PATCH] fix(@desktop/input): deploy Qt plugin to support fcitx Qt provides support for various input methods through plugins. Since the fcitx plugin is not delivered with Qt, it needs to be built and deployed by us. Fixes: #4436 --- .gitmodules | 3 +++ Makefile | 21 ++++++++++++++++++++- ci/Dockerfile | 17 ++++++++++++++++- ci/Jenkinsfile.linux | 2 +- vendor/fcitx5-qt | 1 + 5 files changed, 41 insertions(+), 3 deletions(-) create mode 160000 vendor/fcitx5-qt diff --git a/.gitmodules b/.gitmodules index b9b152b7a2..6e7bb3e8c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,6 @@ [submodule "vendor/nim-result"] path = vendor/nim-result url = https://github.com/arnetheduck/nim-result +[submodule "vendor/fcitx5-qt"] + path = vendor/fcitx5-qt + url = https://github.com/fcitx/fcitx5-qt diff --git a/Makefile b/Makefile index c16c7bb05f..338a5a7c5c 100644 --- a/Makefile +++ b/Makefile @@ -344,8 +344,24 @@ STATUS_CLIENT_APPIMAGE ?= pkg/Status.AppImage STATUS_CLIENT_TARBALL ?= pkg/Status.tar.gz STATUS_CLIENT_TARBALL_FULL ?= $(shell realpath $(STATUS_CLIENT_TARBALL)) +ifeq ($(detected_OS),Linux) + FCITX5_QT := vendor/fcitx5-qt/build/qt5/platforminputcontext/libfcitx5platforminputcontextplugin.so + FCITX5_QT_CMAKE_PARAMS := -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY_PLUGIN=ON -DENABLE_QT4=OFF -DENABLE_QT5=ON + FCITX5_QT_BUILD_CMD := cmake --build . --config Release $(HANDLE_OUTPUT) +endif + +$(FCITX5_QT): | deps + echo -e $(BUILD_MSG) "fcitx5-qt" + + cd vendor/fcitx5-qt && \ + mkdir -p build && \ + cd build && \ + rm -f CMakeCache.txt && \ + cmake $(FCITX5_QT_CMAKE_PARAMS) \ + .. $(HANDLE_OUTPUT) && \ + $(FCITX5_QT_BUILD_CMD) + $(STATUS_CLIENT_APPIMAGE): override RESOURCES_LAYOUT := -d:production -$(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop +$(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop $(FCITX5_QT) rm -rf pkg/*.AppImage rm -rf tmp/linux/dist mkdir -p tmp/linux/dist/usr/bin @@ -376,6 +392,9 @@ $(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop echo -e $(BUILD_MSG) "AppImage" linuxdeployqt tmp/linux/dist/nim-status.desktop -no-copy-copyright-files -qmldir=ui -qmlimport=$(QTDIR)/qml -bundle-non-qt-libs + # Qt plugins + cp $(FCITX5_QT) tmp/linux/dist/usr/plugins/platforminputcontexts/ + rm tmp/linux/dist/AppRun cp AppRun tmp/linux/dist/. diff --git a/ci/Dockerfile b/ci/Dockerfile index 696826807c..a2094a612d 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -8,20 +8,35 @@ ENV QTDIR="${QT_PATH}/${QT_VERSION}/${QT_PLATFORM}" ENV LD_LIBRARY_PATH="${QTDIR}/lib:${LD_LIBRARY_PATH}" # $OPENSSL_PREFIX is provided by the docker image ENV LIBRARY_PATH="${OPENSSL_PREFIX}/lib:${LIBRARY_PATH}" +ENV OPENSSL_ROOT_DIR="${OPENSSL_PREFIX}" RUN export DEBIAN_FRONTEND=noninteractive \ && sudo apt update -yq \ && sudo apt install -yq software-properties-common \ && sudo add-apt-repository -y ppa:git-core/ppa \ + && sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test \ && sudo apt update -yq \ && sudo apt purge -yq gnupg \ && sudo apt install -yq --fix-missing \ - build-essential cmake jq git s3cmd gnupg2 ca-certificates \ + jq git s3cmd gnupg2 ca-certificates \ + build-essential extra-cmake-modules gcc-9 g++-9 \ libpcre3-dev libnss3 libxcomposite1 libxtst6 libpcsclite-dev \ gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-ugly gstreamer1.0-libav \ gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-pulseaudio +# C++17 is required +RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-9 + +# CMake 3.16 or higher is required +RUN wget https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-x86_64.sh \ + && chmod +x cmake-3.22.1-linux-x86_64.sh \ + && sudo mkdir /opt/cmake \ + && sudo sh cmake-3.22.1-linux-x86_64.sh --prefix=/opt/cmake --exclude-subdir --skip-license \ + && rm -f cmake-3.22.1-linux-x86_64.sh +ENV PATH="/opt/cmake/bin:${PATH}" + # Fix LetsEncrypt X3 root certificate expliration RUN sudo sed -i 's#\(mozilla/DST_Root_CA_X3.crt\)#!\1#' /etc/ca-certificates.conf \ && sudo dpkg-reconfigure -fnoninteractive ca-certificates diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index 0b56e7c194..6e90860db7 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -4,7 +4,7 @@ pipeline { agent { docker { label 'linux' - image 'statusteam/nim-status-client-build:1.1.2' + image 'statusteam/nim-status-client-build:1.1.3' /* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */ args '--entrypoint="" --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse' } diff --git a/vendor/fcitx5-qt b/vendor/fcitx5-qt new file mode 160000 index 0000000000..fd06094f48 --- /dev/null +++ b/vendor/fcitx5-qt @@ -0,0 +1 @@ +Subproject commit fd06094f48e8281b6dc3fd4aaadfcd216c426a5a