summaryrefslogtreecommitdiffstats
path: root/abs/core/klibc-kbd
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/klibc-kbd')
-rw-r--r--abs/core/klibc-kbd/PKGBUILD45
-rw-r--r--abs/core/klibc-kbd/keymap_hook27
-rw-r--r--abs/core/klibc-kbd/keymap_install76
-rw-r--r--abs/core/klibc-kbd/no-exit.patch31
-rw-r--r--abs/core/klibc-kbd/no-isatty.patch58
5 files changed, 237 insertions, 0 deletions
diff --git a/abs/core/klibc-kbd/PKGBUILD b/abs/core/klibc-kbd/PKGBUILD
new file mode 100644
index 0000000..8c4e0db
--- /dev/null
+++ b/abs/core/klibc-kbd/PKGBUILD
@@ -0,0 +1,45 @@
+# $Id: PKGBUILD 1645 2008-05-14 12:09:34Z thomas $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+
+pkgname=klibc-kbd
+pkgver=1.15.20080312
+pkgrel=15
+pkgdesc="Keytable files and keyboard utilities"
+arch=('i686' 'x86_64')
+url="ftp://ftp.altlinux.org/pub/people/legion/kbd/"
+license=('GPL')
+groups=('base')
+depends=('klibc' $(basename /lib/klibc-*.so .so) 'kbd')
+source=(ftp://ftp.archlinux.org/other/kbd/kbd-$pkgver.tar.gz
+ #ftp://ftp.altlinux.org/pub/people/legion/kbd/kbd-${pkgver}.tar.gz
+ no-isatty.patch
+ no-exit.patch
+ keymap_install
+ keymap_hook)
+md5sums=('709b087bb9d6c073bade70eda2da7770'
+ '53e9612ac5fc1b23601f793410742ed3'
+ '8c1bec330e8c98355502ac861561667d'
+ '735d7268f567deee4db3bed951a8303a'
+ '85457e44dfd7046224e87f0add8da4b2')
+
+build() {
+ cd ${startdir}/src
+ #cd ${startdir}/src/kbd-${pkgver}
+ patch -Np1 -i ../no-isatty.patch
+ patch -Np1 -i ../no-exit.patch
+
+ aclocal
+ autoconf
+ automake --add-missing
+ ./configure --datadir=/share/kbd --enable-klibc
+
+ cd src/
+ make kbd_mode loadkeys setfont || return 1
+
+ install -D loadkeys ${startdir}/pkg/lib/initcpio/kbd/loadkeys
+ install -D kbd_mode ${startdir}/pkg/lib/initcpio/kbd/kbd_mode
+ install -D setfont ${startdir}/pkg/lib/initcpio/kbd/setfont
+ # install hook
+ install -Dm644 ${startdir}/src/keymap_hook ${startdir}/pkg/lib/initcpio/hooks/keymap
+ install -Dm644 ${startdir}/src/keymap_install ${startdir}/pkg/lib/initcpio/install/keymap
+}
diff --git a/abs/core/klibc-kbd/keymap_hook b/abs/core/klibc-kbd/keymap_hook
new file mode 100644
index 0000000..913b247
--- /dev/null
+++ b/abs/core/klibc-kbd/keymap_hook
@@ -0,0 +1,27 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n ":: Loading keymap..."
+ . /keymap
+ if [ "${UTF8}" = "yes" ]; then
+ /bin/kbd_mode -u
+ printf "\033%%G" >> /dev/console
+ [ -n "${KEYMAP}" ] && /bin/loadkeys -q -u ${KEYMAP}
+ else
+ /bin/kbd_mode -a
+ printf "\033%%@" >> /dev/console
+ [ -n "${KEYMAP}" ] && /bin/loadkeys -q ${KEYMAP}
+ fi
+ if [ -n "${CONSOLEFONT}" ]; then
+ if [ "${UTF8}" = "yes" ]; then
+ CONSOLEMAP=""
+ fi
+ if [ -n "${CONSOLEMAP}" ]; then
+ /bin/setfont -m ${CONSOLEMAP} ${CONSOLEFONT} -C /dev/console
+ else
+ /bin/setfont ${CONSOLEFONT} -C /dev/console
+ fi
+ printf "\033(K" >> /dev/console
+ fi
+ msg "done."
+}
diff --git a/abs/core/klibc-kbd/keymap_install b/abs/core/klibc-kbd/keymap_install
new file mode 100644
index 0000000..e61577e
--- /dev/null
+++ b/abs/core/klibc-kbd/keymap_install
@@ -0,0 +1,76 @@
+# vim: set ft=sh:
+
+# this is needed because kbd utilities compiled with klibc cannot use gunzip
+add_ucfile ()
+{
+ temp=$(mktemp ${TMPDIR}/kbd.XXXX)
+ dest=$(echo "${1}" | sed 's|/usr||' | sed 's|.gz||')
+ name=$(echo "${1}" | sed 's|.*/||')
+
+ if [ $(echo "${1}" | grep '.gz$') ]; then
+ gunzip -c ${1} > ${temp}
+ add_file ${temp} ${dest}
+ else
+ add_file ${1} ${dest}
+ fi
+}
+
+add_includes()
+{
+ for i in $(zgrep -e '^include ".*"' ${1} | cut -d '"' -f 2); do
+ for j in $(find /usr/share/kbd/keymaps -name "${i}" -o -name "${i}.*"); do
+ add_ucfile ${j}
+ add_includes ${j}
+ done
+ done
+}
+
+install ()
+{
+ MODULES=""
+ BINARIES=""
+ FILES=""
+ SCRIPT="keymap"
+ KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)"
+ add_file /lib/initcpio/kbd/loadkeys /bin/loadkeys
+ add_file /lib/initcpio/kbd/kbd_mode /bin/kbd_mode
+ add_file /lib/initcpio/kbd/setfont /bin/setfont
+ eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" -e "^CONSOLEFONT=" -e "^CONSOLEMAP=" /etc/rc.conf)"
+ echo "KEYMAP='${KEYMAP}'" >> ${KEYMAP_FILE}
+ echo "CONSOLEFONT='${CONSOLEFONT}'" >> ${KEYMAP_FILE}
+ echo "CONSOLEMAP='${CONSOLEMAP}'" >> ${KEYMAP_FILE}
+ if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then
+ echo "UTF8='yes'" >> ${KEYMAP_FILE}
+ fi
+ . ${KEYMAP_FILE}
+ add_file ${KEYMAP_FILE} /keymap
+ if [ -n "${KEYMAP}" ]; then
+ for i in $(echo ${KEYMAP}); do
+ for j in $(find /usr/share/kbd/keymaps -name "${i}.map.gz"); do
+ add_ucfile ${j}
+ add_includes ${j}
+ done
+ done
+ fi
+ if [ -n "${CONSOLEFONT}" ]; then
+ for i in $(find /usr/share/kbd/consolefonts -name "${CONSOLEFONT}.*gz"); do
+ add_ucfile ${i}
+ done
+ fi
+ if [ -n "${CONSOLEMAP}" ]; then
+ for i in $(find /usr/share/kbd/unimaps -name "${CONSOLEMAP}.uni"); do
+ add_ucfile ${i}
+ done
+ for i in $(find /usr/share/kbd/consoletrans -name "${CONSOLEMAP}.trans" -o -name "${CONSOLEMAP}"); do
+ add_ucfile ${i}
+ done
+ fi
+}
+
+help ()
+{
+cat<<HELPEOF
+ This hook loads keymap(s) and consolefont specified in rc.conf
+ during early userspace.
+HELPEOF
+}
diff --git a/abs/core/klibc-kbd/no-exit.patch b/abs/core/klibc-kbd/no-exit.patch
new file mode 100644
index 0000000..2f207dc
--- /dev/null
+++ b/abs/core/klibc-kbd/no-exit.patch
@@ -0,0 +1,31 @@
+From 96dc0b9e56da64d2c063d1e74c81034b6b404bc2 Mon Sep 17 00:00:00 2001
+From: Roman Kyrylych <roman@archlinux.org>
+Date: Sat, 15 Mar 2008 21:46:35 +0200
+Subject: [PATCH] Do not exit on ferror during psf font loading when built with klibc
+
+Signed-off-by: Roman Kyrylych <roman@archlinux.org>
+---
+ src/psffontop.c | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/src/psffontop.c b/src/psffontop.c
+index 1b99e9b..75a6048 100644
+--- a/src/psffontop.c
++++ b/src/psffontop.c
+@@ -203,9 +203,13 @@ readpsffont(FILE *fontf, char **allbufp, int *allszp,
+ }
+ n += fread(inputbuf+n, 1, inputbuflth-n, fontf);
+ if (ferror(fontf)) {
++ #ifndef __klibc__
+ char *u = _("%s: Error reading input font");
+ fprintf(stderr, u, progname);
+ exit(EX_DATAERR);
++ #else
++ break;
++ #endif
+ }
+ if (feof(fontf))
+ break;
+--
+1.5.3.7
+
diff --git a/abs/core/klibc-kbd/no-isatty.patch b/abs/core/klibc-kbd/no-isatty.patch
new file mode 100644
index 0000000..ce02a7a
--- /dev/null
+++ b/abs/core/klibc-kbd/no-isatty.patch
@@ -0,0 +1,58 @@
+From 92dc27dd57c83e9e2c798bda41ec111d26e1e3e2 Mon Sep 17 00:00:00 2001
+From: Roman Kyrylych <roman@archlinux.org>
+Date: Sat, 15 Mar 2008 18:57:04 +0200
+Subject: [PATCH] Do not use isatty() when built with klibc
+
+Signed-off-by: Roman Kyrylych <roman@archlinux.org>
+---
+ src/getfd.c | 6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/src/getfd.c b/src/getfd.c
+index 7f6d70e..3cef522 100644
+--- a/src/getfd.c
++++ b/src/getfd.c
+@@ -16,6 +16,7 @@
+ * if someone else used X (which does a chown on /dev/console).
+ */
+
++#ifndef __klibc__
+ static int
+ is_a_console(int fd) {
+ char arg;
+@@ -25,6 +26,7 @@ is_a_console(int fd) {
+ && ioctl(fd, KDGKBTYPE, &arg) == 0
+ && ((arg == KB_101) || (arg == KB_84)));
+ }
++#endif
+
+ static int
+ open_a_console(const char *fnam) {
+@@ -41,10 +43,12 @@ open_a_console(const char *fnam) {
+ fd = open(fnam, O_RDONLY);
+ if (fd < 0)
+ return -1;
++ #ifndef __klibc__
+ if (!is_a_console(fd)) {
+ close(fd);
+ return -1;
+ }
++ #endif
+ return fd;
+ }
+
+@@ -80,9 +84,11 @@ int getfd(const char *fnam) {
+ if (fd >= 0)
+ return fd;
+
++ #ifndef __klibc__
+ for (fd = 0; fd < 3; fd++)
+ if (is_a_console(fd))
+ return fd;
++ #endif
+
+ fprintf(stderr,
+ _("Couldnt get a file descriptor referring to the console\n"));
+--
+1.5.3.7
+