Files
Schedule/scripts/setup-fcitx5-qt6-plugin.sh
T
Misaki 5be7f7f04b feat: implement AI schedule app with multi-device sync
- Qt 6 desktop client with day/month/year views, AI scheduling, and TOML settings\n- Go sync server with SQLite change stream, WebSocket notifications, and Docker deployment\n- Client outbox/LWW sync, offline retry, and dual-client integration tests\n- Linux fcitx5 setup, validation reports, and Windows MinGW preset
2026-10-26 13:58:45 +08:00

84 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build and install the fcitx5 Qt6 platform input context plugin against the
# project's custom Qt installation.
#
# Why: distro packages such as fcitx5-frontend-qt6 are built against the distro
# Qt (e.g. 6.4) and use Qt private APIs. They cannot be loaded by a custom Qt
# 6.6.x, so Chinese input silently fails in QLineEdit-based widgets.
#
# Usage:
# ./scripts/setup-fcitx5-qt6-plugin.sh
# QT_ROOT=/path/to/Qt/6.6.3/gcc_64 ./scripts/setup-fcitx5-qt6-plugin.sh
# WORK_DIR=/tmp/fcitx-build ./scripts/setup-fcitx5-qt6-plugin.sh
#
# Network access to GitHub is required on first run (set HTTPS_PROXY if needed).
set -euo pipefail
QT_ROOT="${QT_ROOT:-/home/misaki/Qt6.3/6.6.3/gcc_64}"
WORK_DIR="${WORK_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/schedule-fcitx5-qt}"
ECM_VERSION="${ECM_VERSION:-v5.115.0}"
FCITX_QT_VERSION="${FCITX_QT_VERSION:-5.1.4}"
if [[ ! -x "${QT_ROOT}/bin/qmake" ]]; then
echo "Qt not found at QT_ROOT=${QT_ROOT}" >&2
exit 1
fi
for tool in git cmake; do
if ! command -v "${tool}" >/dev/null 2>&1; then
echo "Missing required tool: ${tool}" >&2
exit 1
fi
done
mkdir -p "${WORK_DIR}"
ECM_SRC="${WORK_DIR}/extra-cmake-modules"
ECM_BUILD="${WORK_DIR}/ecm-build"
ECM_INSTALL="${WORK_DIR}/ecm-install"
FCITX_SRC="${WORK_DIR}/fcitx5-qt"
FCITX_BUILD="${WORK_DIR}/fcitx5-qt-build"
PLUGIN_SRC="${FCITX_BUILD}/qt6/platforminputcontext/libfcitx5platforminputcontextplugin.so"
PLUGIN_DEST="${QT_ROOT}/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so"
if [[ ! -d "${ECM_SRC}/.git" ]]; then
git clone --depth 1 --branch "${ECM_VERSION}" \
https://github.com/KDE/extra-cmake-modules.git "${ECM_SRC}"
fi
if [[ ! -f "${ECM_INSTALL}/share/ECM/cmake/ECMConfig.cmake" ]]; then
cmake -S "${ECM_SRC}" -B "${ECM_BUILD}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${ECM_INSTALL}" \
-DBUILD_TESTING=OFF
cmake --build "${ECM_BUILD}" -j"$(nproc)"
cmake --install "${ECM_BUILD}"
fi
if [[ ! -d "${FCITX_SRC}/.git" ]]; then
git clone --depth 1 --branch "${FCITX_QT_VERSION}" \
https://github.com/fcitx/fcitx5-qt.git "${FCITX_SRC}"
fi
cmake -S "${FCITX_SRC}" -B "${FCITX_BUILD}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${QT_ROOT};${ECM_INSTALL}" \
-DBUILD_ONLY_PLUGIN=ON \
-DBUILD_STATIC_PLUGIN=OFF \
-DENABLE_QT4=OFF \
-DENABLE_QT5=OFF \
-DENABLE_QT6=ON \
-DENABLE_X11=ON \
-DENABLE_QT6_WAYLAND_WORKAROUND=OFF
cmake --build "${FCITX_BUILD}" -j"$(nproc)"
if [[ ! -f "${PLUGIN_SRC}" ]]; then
echo "Plugin build did not produce ${PLUGIN_SRC}" >&2
exit 1
fi
install -Dm755 "${PLUGIN_SRC}" "${PLUGIN_DEST}"
echo "Installed: ${PLUGIN_DEST}"
echo "Restart the application. If Chinese input still fails, run:"
echo " QT_DEBUG_PLUGINS=1 <path-to-Schedule> 2>&1 | grep -i fcitx"