From a1900a1118fd4df11d853c6a448635a9219108d3 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 20 Sep 2014 20:59:45 +0200 Subject: [PATCH] kbd: merge fixes/patches from Alpine to allow musl builds. --- ...-Replace-u_short-with-unsigned-short.patch | 92 +++++++++++++++++++ .../0002-Fix-required-header-includes.patch | 42 +++++++++ ...-inluclude-kernel-headers-with-glibc.patch | 28 ++++++ srcpkgs/kbd/template | 16 +++- 4 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/kbd/patches/0001-Replace-u_short-with-unsigned-short.patch create mode 100644 srcpkgs/kbd/patches/0002-Fix-required-header-includes.patch create mode 100644 srcpkgs/kbd/patches/0003-Only-inluclude-kernel-headers-with-glibc.patch diff --git a/srcpkgs/kbd/patches/0001-Replace-u_short-with-unsigned-short.patch b/srcpkgs/kbd/patches/0001-Replace-u_short-with-unsigned-short.patch new file mode 100644 index 00000000000..8e23f587a1d --- /dev/null +++ b/srcpkgs/kbd/patches/0001-Replace-u_short-with-unsigned-short.patch @@ -0,0 +1,92 @@ +From 4c61d59e9c85e26cee306ed1b964030c1e862e00 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +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 +--- + 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 + diff --git a/srcpkgs/kbd/patches/0002-Fix-required-header-includes.patch b/srcpkgs/kbd/patches/0002-Fix-required-header-includes.patch new file mode 100644 index 00000000000..202fcd7e0b4 --- /dev/null +++ b/srcpkgs/kbd/patches/0002-Fix-required-header-includes.patch @@ -0,0 +1,42 @@ +From b856e52cd6e76a105aad8ddfcd2b123203b687c1 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +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 +--- + 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 + #include + #include ++#include + #include + #include + #include +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 + #include + #include ++#include ++#include + #include + #include + #include +-- +2.1.0 + diff --git a/srcpkgs/kbd/patches/0003-Only-inluclude-kernel-headers-with-glibc.patch b/srcpkgs/kbd/patches/0003-Only-inluclude-kernel-headers-with-glibc.patch new file mode 100644 index 00000000000..007b5b575be --- /dev/null +++ b/srcpkgs/kbd/patches/0003-Only-inluclude-kernel-headers-with-glibc.patch @@ -0,0 +1,28 @@ +From 3c5c7acc7ef874b919b26583d3892e21b907833f Mon Sep 17 00:00:00 2001 +From: Natanael Copa +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 +--- + 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 + #if (__GNU_LIBRARY__ >= 6) + #include +-#else ++#elif defined(__GLIBC__) + #include + #include + #endif +-- +2.1.0 + diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template index 29d3e009a06..12c3fd65a38 100644 --- a/srcpkgs/kbd/template +++ b/srcpkgs/kbd/template @@ -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 }