kbd: merge fixes/patches from Alpine to allow musl builds.

This commit is contained in:
Juan RP 2014-09-20 20:59:45 +02:00
parent 01bb130046
commit a1900a1118
4 changed files with 177 additions and 1 deletions

View File

@ -0,0 +1,92 @@
From 4c61d59e9c85e26cee306ed1b964030c1e862e00 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 20 Aug 2014 08:44:41 +0200
Subject: [PATCH 1/4] Replace u_short with unsigned short
u_short is non-standard and causes build failure with musl libc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
src/libkeymap/dump.c | 6 +++---
src/libkeymap/kmap.c | 6 +++---
src/libkeymap/summary.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c
index 0262e24..e0c502e 100644
--- src/libkeymap/dump.c
+++ src/libkeymap/dump.c
@@ -69,7 +69,7 @@ lk_dump_bkeymap(struct lk_ctx *ctx, FILE *fd)
continue;
for (j = 0; j < NR_KEYS / 2; j++) {
- u_short v;
+ unsigned short v;
v = lk_get_key(ctx, i, j);
if (fwrite(&v, sizeof(v), 1, fd) != 1)
@@ -130,7 +130,7 @@ lk_dump_ctable(struct lk_ctx *ctx, FILE *fd)
if (lk_map_exists(ctx, i)) {
if (i)
fprintf(fd, "static ");
- fprintf(fd, "u_short %s_map[NR_KEYS] = {", mk_mapname(i));
+ fprintf(fd, "unsigned short %s_map[NR_KEYS] = {", mk_mapname(i));
for (j = 0; j < NR_KEYS; j++) {
if (!(j % 8))
fprintf(fd, "\n");
@@ -489,7 +489,7 @@ no_shorthands:
isasexpected = 0;
if (isletter) {
- u_short defs[16];
+ unsigned short defs[16];
defs[0] = K(KT_LETTER, val);
defs[1] = K(KT_LETTER, val ^ 32);
defs[2] = defs[0];
diff --git a/src/libkeymap/kmap.c b/src/libkeymap/kmap.c
index 67be81e..8b90654 100644
--- src/libkeymap/kmap.c
+++ src/libkeymap/kmap.c
@@ -173,7 +173,7 @@ lk_add_key(struct lk_ctx *ctx, unsigned int k_table, unsigned int k_index, int k
}
static int
-do_constant_key(struct lk_ctx *ctx, int i, u_short key)
+do_constant_key(struct lk_ctx *ctx, int i, unsigned short key)
{
int typ, val;
unsigned int j;
@@ -183,7 +183,7 @@ do_constant_key(struct lk_ctx *ctx, int i, u_short key)
if ((typ == KT_LATIN || typ == KT_LETTER) &&
((val >= 'a' && val <= 'z') || (val >= 'A' && val <= 'Z'))) {
- u_short defs[16];
+ unsigned short defs[16];
defs[0] = K(KT_LETTER, val);
defs[1] = K(KT_LETTER, val ^ 32);
defs[2] = defs[0];
@@ -235,7 +235,7 @@ lk_add_constants(struct lk_ctx *ctx)
for (i = 0; i < ctx->key_constant->total; i++) {
char *constant;
- u_short key;
+ unsigned short key;
constant = lk_array_get(ctx->key_constant, i);
if (!constant || !(*constant))
diff --git a/src/libkeymap/summary.c b/src/libkeymap/summary.c
index 46df90d..44d4e5f 100644
--- src/libkeymap/summary.c
+++ src/libkeymap/summary.c
@@ -30,7 +30,7 @@ valid_type(int fd, int t)
return (ioctl(fd, KDSKBENT, (unsigned long) &ke) == 0);
}
-static u_char
+static unsigned char
maximum_val(int fd, int t)
{
struct kbentry ke, ke0;
--
2.1.0

View File

@ -0,0 +1,42 @@
From b856e52cd6e76a105aad8ddfcd2b123203b687c1 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 20 Aug 2014 08:47:50 +0200
Subject: [PATCH 2/4] Fix required header includes
We need fcntl.h for open(2) and limits.h for NAME_MAX for compiling
with musl libc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
src/kbdrate.c | 1 +
src/openvt.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/src/kbdrate.c b/src/kbdrate.c
index 2ab8388..aa66622 100644
--- src/kbdrate.c
+++ src/kbdrate.c
@@ -72,6 +72,7 @@ beats rebuilding the kernel!
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
+#include <fcntl.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <linux/kd.h>
diff --git a/src/openvt.c b/src/openvt.c
index 075136f..70d37d8 100644
--- src/openvt.c
+++ src/openvt.c
@@ -5,6 +5,8 @@
#include <dirent.h>
#include <pwd.h>
#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/vt.h>
--
2.1.0

View File

@ -0,0 +1,28 @@
From 3c5c7acc7ef874b919b26583d3892e21b907833f Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 20 Aug 2014 09:00:03 +0200
Subject: [PATCH 3/4] Only inluclude kernel headers with glibc
This fixes compile errors with musl libc
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
src/resizecons.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/resizecons.c b/src/resizecons.c
index 5f84845..691dfcc 100644
--- src/resizecons.c
+++ src/resizecons.c
@@ -80,7 +80,7 @@
#include <sys/ioctl.h>
#if (__GNU_LIBRARY__ >= 6)
#include <sys/perm.h>
-#else
+#elif defined(__GLIBC__)
#include <linux/types.h>
#include <linux/termios.h>
#endif
--
2.1.0

View File

@ -1,7 +1,7 @@
# Template file for 'kbd'
pkgname=kbd
version=2.0.2
revision=1
revision=2
build_style=gnu-configure
configure_args="--datadir=/usr/share/kbd --localedir=/usr/share/kbd/locale"
hostmakedepends="automake libtool gettext-devel flex pkg-config"
@ -26,8 +26,22 @@ pre_configure() {
mv data/keymaps/i386/fgGIod/trf{,-fgGIod}.map
mv data/keymaps/i386/colemak/{en-latin9,colemak}.map
# fixes from fedora
# 7-bit maps are obsolete; so are non-euro maps
cd 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
cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
cd $wrksrc
sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
sed -e 's,tests ,,g' -i Makefile.am
$XBPS_FETCH_CMD http://git.alpinelinux.org/cgit/aports/plain/main/kbd/error.h
autoreconf -fi
}