aboutsummaryrefslogtreecommitdiffstats
path: root/main/kbd
diff options
context:
space:
mode:
authorShiz <hi@shiz.me>2017-05-11 03:07:44 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-05-19 09:50:09 +0000
commitb2ed890e7f876a42229e6181268828c2493c972c (patch)
tree6ce11643843da07c437f8610f2fdd8b43c1cfa3b /main/kbd
parent28a503181e1ac00e9a54722e897e761ee0867908 (diff)
downloadaports-b2ed890e7f876a42229e6181268828c2493c972c.tar.bz2
aports-b2ed890e7f876a42229e6181268828c2493c972c.tar.xz
main/kbd: generate (binary) keymaps from X.org keyboard-config
Diffstat (limited to 'main/kbd')
-rw-r--r--main/kbd/APKBUILD167
-rw-r--r--main/kbd/fix-tests.patch41
2 files changed, 154 insertions, 54 deletions
diff --git a/main/kbd/APKBUILD b/main/kbd/APKBUILD
index 171f05a7fc..b0d3540854 100644
--- a/main/kbd/APKBUILD
+++ b/main/kbd/APKBUILD
@@ -2,81 +2,116 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=kbd
pkgver=2.0.4
-pkgrel=0
+pkgrel=1
pkgdesc="Tools for configuring the console (keyboard, virtual terminals, etc.)"
url="http://ftp.altlinux.org/pub/people/legion/kbd"
arch="all"
license="GPL2+"
depends="kbd-misc"
-makedepends="linux-headers bison flex autoconf automake linux-pam-dev check-dev"
+makedepends="linux-headers linux-pam-dev check-dev ckbcomp xkeyboard-config"
install=""
-subpackages="$pkgname-misc::noarch $pkgname-doc $pkgname-vlock"
+subpackages="$pkgname-bkeymaps::noarch $pkgname-legacy::noarch $pkgname-misc::noarch $pkgname-doc $pkgname-vlock"
source="http://kbd-project.org/download/kbd-$pkgver.tar.gz
error.h
+ fix-tests.patch
"
+builddir="$srcdir"/kbd-$pkgver
+_datadir=/usr/share
+_xmapdir="$_datadir"/keymaps/xkb
+_bmapdir="$_datadir"/bkeymaps
+_badmaps="pk-ara"
-_builddir="$srcdir"/kbd-$pkgver
prepare() {
- # apply patches (if any)
- default_prepare || return 1
-
- # install our error.h
- cp "$srcdir"/error.h . || return 1
-
- # fixes from fedora
- # 7-bit maps are obsolete; so are non-euro maps
- cd "$_builddir"/data/keymaps/i386
- cp qwerty/pt-latin9.map qwerty/pt.map
- cp qwerty/sv-latin1.map qwerty/se-latin1.map
-
- mv azerty/fr.map azerty/fr-old.map
- cp azerty/fr-latin9.map azerty/fr.map
+ default_prepare
- cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
-
- # Rename conflicting keymaps
- mv dvorak/no.map dvorak/no-dvorak.map
- mv fgGIod/trf.map fgGIod/trf-fgGIod.map
- mv olpc/es.map olpc/es-olpc.map
- mv olpc/pt.map olpc/pt-olpc.map
- mv qwerty/cz.map qwerty/cz-qwerty.map
+ cd "$builddir"
+ cp "$srcdir"/error.h .
}
-_datadir=/usr/share
build() {
- cd "$_builddir"
+ cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
--disable-nls \
--prefix=/usr \
- --datadir=${_datadir} \
- --htmldir=/usr/share/html/$pkgname \
- || return 1
- make || return 1
+ --datadir="$_datadir" \
+ --htmldir=/usr/share/html/$pkgname
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+_listxmaps() {
+ local invariant line; invariant=false
+ grep -v '^$' /usr/share/X11/xkb/rules/base.lst | while read line; do
+ case "$line" in
+ '! variant') invariant=true ;;
+ '!'*) invariant=false ;;
+ *) if $invariant; then
+ echo "$line" | cut -d: -f1
+ fi ;;
+ esac
+ done
}
package() {
- cd "$_builddir"
- make DESTDIR="$pkgdir" install || return 1
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ # Move and fixup legacy keymaps
+ mkdir legacy
+ mv "$pkgdir"/usr/share/keymaps/* legacy
+ mv legacy "$pkgdir"/usr/share/keymaps
- # ro_win.map.gz is useless
- rm -f "$pkgdir"${_datadir}/keymaps/i386/qwerty/ro_win.map.gz
+ cd "$pkgdir"/usr/share/keymaps/legacy/i386
+ # Make ISO-8815-9 maps the default, instead of 7-bit ones
+ ln -s pt-latin9.map.gz qwerty/pt.map.gz
+ mv azerty/fr.map.gz azerty/fr-old.map.gz
+ ln -s fr-latin9.map.gz azerty/fr.map.gz
- # Create additional name for Serbian latin keyboard
- ln -s sr-cy.map.gz "$pkgdir"${_datadir}/keymaps/i386/qwerty/sr-latin.map.gz
+ # Add some legacy aliases
+ ln -s fr-latin9.map.gz azerty/fr-latin0.map.gz
+ ln -s sv-latin1.map.gz qwerty/se-latin1.map.gz
+ ln -s sr-cy.map.gz qwerty/sr-latin.map.gz
- # The rhpl keyboard layout table is indexed by kbd layout names,
- # so we need a Korean keyboard
- ln -s us.map.gz "$pkgdir"${_datadir}/keymaps/i386/qwerty/ko.map.gz
+ # Rename conflicting keymaps
+ mv dvorak/no.map.gz dvorak/no-dvorak.map.gz
+ mv fgGIod/trf.map.gz fgGIod/trf-fgGIod.map.gz
+ mv olpc/es.map.gz olpc/es-olpc.map.gz
+ mv olpc/pt.map.gz olpc/pt-olpc.map.gz
+ mv qwerty/cz.map.gz qwerty/cz-qwerty.map.gz
+
+ # Remove useless layouts
+ rm -f i386/qwerty/ro_win.map.gz
+
+ cd "$builddir"
+
+ # Compile keymaps from X.org layouts
+ mkdir -p "$pkgdir$_xmapdir"
+ local layout variant
+ _listxmaps | while read -r variant layout; do
+ if ! test -f "$pkgdir$_xmapdir"/"$layout".map.gz; then
+ echo "Generating keymap $layout..."
+ ckbcomp "$layout" | gzip > "$pkgdir$_xmapdir"/"$layout".map.gz || exit 1
+ fi
+ echo "Generating keymap $layout-$variant..."
+ ckbcomp "$layout" "$variant" | gzip > "$pkgdir$_xmapdir"/"$layout"-"$variant".map.gz || exit 1
+ done
+
+ # Do some fix-ups on X.org keymaps
+ mv "$pkgdir$_xmapdir"/fi.map.gz "$pkgdir$_xmapdir"/fi-kotoistus.map.gz
# Install html documentation
- mkdir -p "$pkgdir"/usr/share/html/$pkgname
- mv docs/doc/*.html "$pkgdir"/usr/share/html/$pkgname/ || return 1
+ mkdir -p "$pkgdir$_datadir"/html/$pkgname
+ mv docs/doc/*.html "$pkgdir$_datadir"/html/$pkgname
# Replace busybox setfont utility.
mkdir -p "$pkgdir"/usr/sbin
- mv "$pkgdir"/usr/bin/setfont "$pkgdir"/usr/sbin/ || return 1
+ mv "$pkgdir"/usr/bin/setfont "$pkgdir"/usr/sbin
# Link open to openvt
ln -s openvt "$pkgdir"/usr/bin/open
@@ -86,24 +121,48 @@ vlock() {
pkgdesc="$pkgname vlock implemantation"
depends=
- # This is the only binary needing linux-pam moving this to a
- # subpackage reduce the amount of depencies of the kbd package.
+ # This is the only binary needing linux-pam so moving this to a
+ # subpackage reduces the amount of depencies of the kbd package.
mkdir -p "$subpkgdir"/usr/bin
- mv "$pkgdir"/usr/bin/vlock \
- "$subpkgdir"/usr/bin/ || return 1
+ mv "$pkgdir"/usr/bin/vlock "$subpkgdir"/usr/bin
+}
+
+bkeymaps() {
+ pkgdesc="X.org-derived binary keymaps"
+ depends=
+ replaces="bkeymaps"
+
+ mkdir -p "$subpkgdir$_bmapdir"
+ local map variant layout; for map in "$pkgdir$_xmapdir"/*.map.gz; do
+ variant="$(basename "$map" | cut -d. -f1)"
+ case "$variant" in $_badmaps) continue ;; esac
+
+ layout="${variant%%-*}"
+ mkdir -p "$subpkgdir$_bmapdir"/$layout
+ echo "Generating binary keymap $variant..."
+ "$pkgdir"/usr/bin/loadkeys -ub "$map" | gzip > "$subpkgdir$_bmapdir"/$layout/$variant.bmap.gz
+ done
+}
+
+legacy() {
+ pkgdesc="kbd legacy keymaps"
+ depends=
+
+ mkdir -p "$subpkgdir$_datadir"/keymaps
+ mv "$pkgdir$_datadir"/keymaps/legacy "$subpkgdir$_datadir"/keymaps
}
misc() {
- pkgdesc="Data for kbd package"
+ pkgdesc="kbd keymaps and console data"
depends=
- mkdir -p "$subpkgdir"${_datadir}
- for dir in consolefonts consoletrans keymaps unimaps; do
- mv "$pkgdir"${_datadir}/${dir} "$subpkgdir"/${_datadir}/ \
- || return 1
+ mkdir -p "$subpkgdir$_datadir"
+ local dir; for dir in consolefonts consoletrans keymaps unimaps; do
+ mv "$pkgdir$_datadir"/$dir "$subpkgdir$_datadir"
done
}
sha512sums="e37bc661c75a8363e9a5ba903310fa7f7ded4f381c2c77aa7edc0b1aca5a63224933fd113cddcf180e7fb85f55407e0d1f47be1cdf69dcf2787e83ac996bbf03 kbd-2.0.4.tar.gz
-c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h"
+c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h
+bb67e5bb933a48f4a04402e07d7d67169a97485e6b469f8ccd4436466eb17ec2ddcf0ef74d22b3aae9e813feaee5bef0822ec50c384e0276a8c91f9325502a5f fix-tests.patch"
diff --git a/main/kbd/fix-tests.patch b/main/kbd/fix-tests.patch
new file mode 100644
index 0000000000..0ca82420c7
--- /dev/null
+++ b/main/kbd/fix-tests.patch
@@ -0,0 +1,41 @@
+busybox readlink doesn't accept -e, and in these cases -f has the same effect.
+--- a/tests/alt-is-meta.in
++++ b/tests/alt-is-meta.in
+@@ -1,6 +1,6 @@
+ #!/bin/sh -efu
+
+-cwd="$(readlink -ev "${0%/*}")"
++cwd="$(readlink -fv "${0%/*}")"
+
+ cd "$cwd"
+
+--- a/tests/dumpkeys-bkeymap.in
++++ b/tests/dumpkeys-bkeymap.in
+@@ -1,6 +1,6 @@
+ #!/bin/sh -efu
+
+-cwd="$(readlink -ev "${0%/*}")"
++cwd="$(readlink -fv "${0%/*}")"
+
+ cd "$cwd"
+
+--- a/tests/dumpkeys-fulltable.in
++++ b/tests/dumpkeys-fulltable.in
+@@ -1,6 +1,6 @@
+ #!/bin/sh -efu
+
+-cwd="$(readlink -ev "${0%/*}")"
++cwd="$(readlink -fv "${0%/*}")"
+
+ cd "$cwd"
+
+--- a/tests/dumpkeys-mktable.in
++++ b/tests/dumpkeys-mktable.in
+@@ -1,6 +1,6 @@
+ #!/bin/sh -efu
+
+-cwd="$(readlink -ev "${0%/*}")"
++cwd="$(readlink -fv "${0%/*}")"
+
+ cd "$cwd"
+