Files
fcitx5-m3ui/scripts/build.sh
T
justmeandClaude Sonnet 5.5 0804634dc1 Add Material 3 candidate window addon for Fcitx5
Fork of the classicui addon (Fcitx5 5.1.23) with a Material 3 look, spring
based animations and a right click action menu for candidates.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 21:58:54 +08:00

49 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Builds libm3ui.so against an upstream Fcitx5 source tree of the same version
# as the Fcitx5 installed on this system. The addon needs Fcitx5's internal
# Wayland protocol wrappers, which are not part of fcitx5-devel, so it is built
# inside the upstream tree.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
work=${WORK_DIR:-$root/build}
version=${FCITX_VERSION:-$(pkg-config --modversion Fcitx5Core)}
# Commit of the yoga submodule pinned by Fcitx5 (third_party/yoga).
yoga_commit=${YOGA_COMMIT:-042f5013152eb81c1552dec945b88f7b95ca350f}
srcdir=$work/fcitx5-$version
mkdir -p "$work"
if [ ! -d "$srcdir" ]; then
echo ">> fetching Fcitx5 $version"
curl -fsSL "https://github.com/fcitx/fcitx5/archive/refs/tags/$version.tar.gz" |
tar -xz -C "$work"
fi
if [ ! -f "$srcdir/third_party/yoga/yoga/CMakeLists.txt" ]; then
echo ">> fetching yoga $yoga_commit"
rm -rf "$srcdir/third_party/yoga"
mkdir -p "$srcdir/third_party/yoga"
curl -fsSL "https://github.com/facebook/yoga/archive/$yoga_commit.tar.gz" |
tar -xz -C "$srcdir/third_party/yoga" --strip-components=1
fi
echo ">> overlaying m3ui"
rm -rf "$srcdir/src/ui/m3ui"
cp -r "$root/src" "$srcdir/src/ui/m3ui"
if ! grep -q 'add_subdirectory(m3ui)' "$srcdir/src/ui/CMakeLists.txt"; then
sed -i 's/^add_subdirectory(classic)$/add_subdirectory(classic)\nadd_subdirectory(m3ui)/' \
"$srcdir/src/ui/CMakeLists.txt"
fi
echo ">> configuring"
cmake -S "$srcdir" -B "$work/cmake" -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX:-$HOME/.local/m3ui}" \
-DENABLE_X11=On -DENABLE_WAYLAND=On \
-DENABLE_TEST=Off -DENABLE_TESTING_ADDONS=Off -DENABLE_ENCHANT=Off \
-DENABLE_DOC=Off -DENABLE_XDGAUTOSTART=Off -DENABLE_EMOJI=Off
echo ">> building"
ninja -C "$work/cmake" m3ui src/ui/m3ui/m3ui.conf
echo ">> done, run scripts/install.sh"