インストール: XKBCommon | Linuxでのキーボードライブラリー

XKB (X Keyboard Extension) の仕様に準拠したキーボードのキーマップのライブラリーであるXKBCommonをソースコードからインストールする。
XKBCommonはLinux環境における,GUIライブラリー (Wayland, Qt, GTK+) やFcitxのようなIMEで使われる。
項目 | 説明 |
---|---|
配布元 | xkbcommon – a keyboard handling library |
リポジトリー | GitHub – xkbcommon/libxkbcommon: keymap handling library for toolkits and window systems |
手順 | |
依存情報 | libxkbcommon/PACKAGING at master · xkbcommon/libxkbcommon · GitHub |
依存先 (必須) | Make (GNU Make), meson, pkg-config, libc, bash, grep, sed |
依存先 (任意) |
|
依存元 | fcitx-qt |
sh -eux <<-"EOT"
PKG=libxkbcommon VER=0.8.4 TAG=xkbcommon-$VER
LOCAL=~/.local J=$(grep -cs '^processor' /proc/cpuinfo || echo 2)
mkdir -p "$LOCAL/src"
cd "$LOCAL/src"
if command -v git >/dev/null; then
[ -e $PKG ] || git clone --depth 1 https://github.com/xkbcommon/libxkbcommon $PKG
cd $PKG
git fetch --depth 1 origin tag $TAG
git checkout -f $TAG
git clean -dfX
[ -e .gitmodules ] && git submodule foreach --recursive git clean -dfX
[ -e configure.ac ] && autoreconf -is
else
[ -e $PKG-$VER ] || wget https://xkbcommon.org/download/$PKG-$VER.tar.xz
tar -xf $PKG-$VER.*
cd $PKG-$VER
make -kj $J distclean clean || :
fi
DISABLE_X11=$(pkg-config --exists xcb-xkb || echo --disable-x11)
./configure --prefix="$LOCAL/stow/$PKG-$VER" $DISABLE_X11
make -j $J
make -j $J check
make -j $J install
cd "$LOCAL/stow"
echo $PKG-[0-9]* | xargs -n 1 stow --ignore=dir -D
stow --ignore=dir $PKG-$VER
EOT
日付 | バージョン | OS | 依存関係 |
---|---|---|---|
2019-06-15 | 0.8.4 | Ubuntu 18.04 | GNU Make 4.2.1, GCC 7.4.0, pkg-config 0.29.2 |
XKBCommonではビルドにmesonを使っている。mesonのインストールが必要になる。Autotoolsによるビルドの方が慣れ親しんでおり,そのためのファイルが用意されているので,Autotoolsによりインストールする。
XKBCommonはxkbcommonとxkbcommon-x11の2種類のライブラリーを含んでいる。xkbcommon-x11はX11環境特有の追加ライブラリーが必要となる。
デフォルト設定では,xkbcommonとxkbcommon-x11の両方をビルドしようとする。そのため,./configure実行時に以下のエラーが表示される。
checking for xcb xcb-xkb >= 1.10... no configure: error: xkbcommon-x11 requires xcb-xkb >= 1.10 which was not found. You can disable X11 support with --disable-x11.
今回はfcitx-qtのビルドの依存関係を解消することが目的だ。そのため,上記エラーメッセージに表示されているように,configure実行時に--disable-x11
を指定することで,xkbcommon-x11を無効にしてビルドした。
具体的には,pkg-configコマンドでxkbcommon-x11に必要なxcb-xkbの有無を判定し,存在しない場合にconfigureのオプションを指定する。
DISABLE_X11=$(pkg-config --exists xcb-xkb || echo --disable-x11)
./configure --prefix="$LOCAL/stow/$PKG-$VER" $DISABLE_X11