Created
May 17, 2025 22:46
-
-
Save wengxt/811543a7cd5b77907158a709159902b9 to your computer and use it in GitHub Desktop.
PKGBUILD for keyman
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Vitrum <[email protected]> | |
# Contributor: CSSlayer <[email protected]> | |
pkgbase=keyman | |
pkgname=(keyman ibus-keyman) | |
pkgver=18.0.236 | |
pkgrel=2 | |
pkgdesc="Keyboard engine supporting over 2000 languages" | |
arch=('i686' 'x86_64') | |
url="https://keyman.com/linux/" | |
makedepends=('cmake' 'meson' 'libibus' 'icu' 'gtk3' 'systemd-libs' 'libevdev' | |
# the following dependences are only needed for keyman-config | |
'python-build' 'python-installer' 'python-setuptools' 'help2man') | |
optdepends=('keyman-onboard: on-screen keyboard') | |
source=("https://downloads.keyman.com/linux/stable/$pkgver/keyman-$pkgver.tar.gz" | |
https://downloads.keyman.com/linux/stable/$pkgver/keyman-$pkgver.tar.gz.asc) | |
sha256sums=('b3ce70a5a59602674812e1a06dc6701bbb08d9115f7cedeb70b0bd6ff8d71355' | |
'SKIP') | |
validpgpkeys=('6C8EEADE607D434C74FD34FDC8E614F58F1B65E0') | |
prepare(){ | |
cd "$srcdir/keyman/linux" | |
# GCC 15 warning | |
sed -i 's/^#define __ORDEROUTPUTDEVICE_H__/#define __ORDEREDOUTPUTDEVICE_H__/' \ | |
keyman-system-service/src/OrderedOutputDevice.h | |
# avoid adding `dpkg` dependency | |
sed -i 's/if dpkg --compare-versions .*; then/if false; then/' \ | |
keyman-config/build.sh | |
# Remove --werror | |
sed -i 's/--werror//' ibus-keyman/build.sh | |
} | |
build() { | |
# build and config are based on the project's DEB packaging | |
# https://github.com/keymanapp/keyman/blob/master/linux/debian/rules | |
cd "$srcdir/keyman" | |
linux/keyman-system-service/build.sh configure -- \ | |
--wrap-mode=nodownload \ | |
--prefix=/usr \ | |
--sysconfdir=/etc \ | |
--localstatedir=/var \ | |
--libdir=lib \ | |
--libexecdir=lib | |
core/build.sh --no-tests configure:arch build:arch -- \ | |
--wrap-mode=nodownload \ | |
--prefix=/usr \ | |
--sysconfdir=/etc \ | |
--localstatedir=/var \ | |
--libdir=lib \ | |
--libexecdir=lib | |
linux/ibus-keyman/build.sh configure build -- \ | |
--wrap-mode=nodownload \ | |
--prefix=/usr \ | |
--sysconfdir=/etc \ | |
--localstatedir=/var \ | |
--libdir=lib \ | |
--libexecdir=lib \ | |
-Dkeyman_deb_pkg_build=false | |
linux/keyman-config/build.sh configure build | |
cd "$srcdir/keyman/linux/keyman-config" | |
sed -i -e "s/^__pkgversion__ = \"[^\"]*\"/__pkgversion__ = \"$pkgver\"/g" \ | |
keyman_config/version.py | |
make compile-po | |
} | |
package_keyman() { | |
license=('MIT') | |
depends=('libevdev' 'icu' 'glib2' 'glibc' 'gcc-libs' 'systemd-libs' 'python' 'libibus' 'gtk3' 'dconf' | |
'gdk-pixbuf2' 'webkit2gtk' 'hicolor-icon-theme' | |
'python-gobject' 'python-setuptools' 'python-packaging' | |
'python-qrcode' 'python-sentry_sdk' 'python-fonttools' | |
'python-pyxdg' 'python-dbus' 'python-requests' 'python-requests-cache' | |
'python-numpy' 'python-pillow' 'python-magic' 'python-lxml') | |
cd "$srcdir/keyman" | |
DESTDIR=$pkgdir core/build.sh --no-tests install:arch | |
DESTDIR=$pkgdir linux/keyman-system-service/build.sh install | |
# Fix path to follow archlinux standard. | |
sed -i 's|/usr/libexec|/usr/lib|g' $pkgdir/usr/lib/systemd/system/systemd-keyman.service | |
# Install MIT License from keyman | |
install -Dm644 --target-directory="$pkgdir/usr/share/licenses/keyman/" LICENSE.md | |
# keyman-config | |
cd "$srcdir/keyman/linux/keyman-config" | |
python -m installer --destdir="$pkgdir" build/*.whl | |
# icons | |
install -d "$pkgdir/usr/share/keyman/icons" | |
cp keyman_config/icons/* "$pkgdir/usr/share/keyman/icons" | |
# man pages | |
install -d "$pkgdir/usr/share/man/man1" | |
cp ../../debian/man/*.1 "$pkgdir/usr/share/man/man1" | |
# locales | |
install -d "$pkgdir/usr/share/" | |
cp -r locale/ "$pkgdir/usr/share/" | |
rm "$pkgdir/usr/share/locale/"*.po* | |
# desktop | |
install -Dm644 --target-directory="$pkgdir/usr/share/applications" resources/km-config.desktop | |
# mime | |
install -Dm644 resources/keyman.sharedmimeinfo "$pkgdir/usr/share/mime/packages/keyman.xml" | |
# app icons | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/24x24/apps" icons/24/km-config.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/32x32/apps" icons/32/km-config.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/48x48/apps" icons/48/km-config.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/64x64/apps" icons/64/km-config.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/128x128/apps" icons/128/km-config.png | |
# mime icons | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/16x16/mimetypes" icons/16/application-x-kmp.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/24x24/mimetypes" icons/24/application-x-kmp.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/32x32/mimetypes" icons/32/application-x-kmp.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/48x48/mimetypes" icons/48/application-x-kmp.png | |
install -Dm644 --target-directory="$pkgdir/usr/share/icons/hicolor/64x64/mimetypes" icons/64/application-x-kmp.png | |
# glib schemas | |
install -Dm644 --target-directory="$pkgdir/usr/share/glib-2.0/schemas" resources/com.keyman.gschema.xml | |
# bash completions | |
install -Dm644 --target-directory="$pkgdir/usr/share/bash-completion/completions/" *.bash-completion | |
for file in $pkgdir/usr/share/bash-completion/completions/*; do | |
mv -- "$file" "${file%%.bash-completion}" | |
done | |
} | |
package_ibus-keyman() { | |
license=('GPL-2.0-or-later') | |
pkgdesc="IBus engine for keyman" | |
depends=('ibus' 'keyman' 'gtk3' 'glib2') | |
cd "$srcdir/keyman" | |
DESTDIR=$pkgdir linux/ibus-keyman/build.sh install | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment