diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-08-19 13:03:53 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-08-20 08:02:58 +0000 |
commit | b07dc2349d3e60bef40a9974f8b20e8158d989e8 (patch) | |
tree | 6ec2d24acc3a3764c77002d0e9629f2d26b2bc32 /main/kbd | |
parent | c899e9941b773827ef155a4b42c6b9a950841f80 (diff) | |
download | aports-b07dc2349d3e60bef40a9974f8b20e8158d989e8.tar.bz2 aports-b07dc2349d3e60bef40a9974f8b20e8158d989e8.tar.xz |
main/kbd: fix build with musl and upgrade to 2.0.2
ref #2977
Diffstat (limited to 'main/kbd')
-rw-r--r-- | main/kbd/0001-Replace-u_short-with-unsigned-short.patch | 92 | ||||
-rw-r--r-- | main/kbd/0002-Fix-required-header-includes.patch | 42 | ||||
-rw-r--r-- | main/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch | 28 | ||||
-rw-r--r-- | main/kbd/APKBUILD | 39 | ||||
-rw-r--r-- | main/kbd/error.h | 20 | ||||
-rw-r--r-- | main/kbd/kbd.patch | 246 |
6 files changed, 210 insertions, 257 deletions
diff --git a/main/kbd/0001-Replace-u_short-with-unsigned-short.patch b/main/kbd/0001-Replace-u_short-with-unsigned-short.patch new file mode 100644 index 0000000000..cefcbe8e15 --- /dev/null +++ b/main/kbd/0001-Replace-u_short-with-unsigned-short.patch @@ -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 +--- a/src/libkeymap/dump.c ++++ b/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 +--- a/src/libkeymap/kmap.c ++++ b/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 +--- a/src/libkeymap/summary.c ++++ b/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/main/kbd/0002-Fix-required-header-includes.patch b/main/kbd/0002-Fix-required-header-includes.patch new file mode 100644 index 0000000000..dff221ecef --- /dev/null +++ b/main/kbd/0002-Fix-required-header-includes.patch @@ -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 +--- a/src/kbdrate.c ++++ b/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 +--- a/src/openvt.c ++++ b/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 + diff --git a/main/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch b/main/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch new file mode 100644 index 0000000000..1b01f3608e --- /dev/null +++ b/main/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch @@ -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 +--- a/src/resizecons.c ++++ b/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 + diff --git a/main/kbd/APKBUILD b/main/kbd/APKBUILD index 2e88b4e111..e42cf218f0 100644 --- a/main/kbd/APKBUILD +++ b/main/kbd/APKBUILD @@ -1,17 +1,22 @@ # Contributor: Natanael Copa <ncopa@alpinelinux.org> # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=kbd -pkgver=2.0.1 -pkgrel=1 +pkgver=2.0.2 +pkgrel=0 pkgdesc="Tools for configuring the console (keyboard, virtual terminals, etc.)" url="http://ftp.altlinux.org/pub/people/legion/kbd" -arch="" +arch="all" license="GPL2+" depends="kbd-misc" makedepends="bison flex autoconf automake linux-pam-dev check-dev" install="" subpackages="$pkgname-misc $pkgname-doc" -source="ftp://ftp.altlinux.org/pub/people/legion/kbd/kbd-$pkgver.tar.gz" +source="ftp://ftp.altlinux.org/pub/people/legion/kbd/kbd-$pkgver.tar.gz + 0001-Replace-u_short-with-unsigned-short.patch + 0002-Fix-required-header-includes.patch + 0003-Only-inluclude-kernel-headers-with-glibc.patch + error.h + " _builddir="$srcdir"/kbd-$pkgver prepare() { @@ -22,14 +27,14 @@ prepare() { *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done - aclocal -I m4 && automake --add-missing && autoreconf || return 1 - sed -i '1i#include <stdarg.h>' src/libkeymap/keymap/common.h +# aclocal -I m4 && automake --add-missing && autoreconf || 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 - mv qwerty/fi.map qwerty/fi-old.map - cp qwerty/fi-latin9.map qwerty/fi.map cp qwerty/pt-latin9.map qwerty/pt.map cp qwerty/sv-latin1.map qwerty/se-latin1.map @@ -93,6 +98,18 @@ misc() { mv "$pkgdir"/lib/kbd "$subpkgdir"/lib/ } -md5sums="cc0ee9f2537d8636cae85a8c6541ed2e kbd-2.0.1.tar.gz" -sha256sums="75e78834e60adc1e95a479f9946a836f8a4f1e05bc0332660d3582c44bbc3019 kbd-2.0.1.tar.gz" -sha512sums="666b5ad251036a69ae32dcac6d436602aa0c8da9adf8babb56ff4489fe61757d3ce10fc749694fbb5d1a5192da0999694ac7643a562fb88ab2a58897e0090dc2 kbd-2.0.1.tar.gz" +md5sums="f1f75f0dd5f7dde89ce47585274366f8 kbd-2.0.2.tar.gz +7945e2d7f13cc2896233bf5e1de8e4e2 0001-Replace-u_short-with-unsigned-short.patch +4e04e0c7307e89193b7dc2cd889be0a5 0002-Fix-required-header-includes.patch +31027a70335ff0a5e9f3b779d70920ce 0003-Only-inluclude-kernel-headers-with-glibc.patch +1a5b152db18674deec07ab7c6209267a error.h" +sha256sums="b1e4c796601039d3b63da908c27431a36e7af06d4d964cd3f8821a880eb3c021 kbd-2.0.2.tar.gz +d55432213b14d677af73eb5b919327bd9fe03dd6fcad059f5d345901d6029e96 0001-Replace-u_short-with-unsigned-short.patch +e1e6c482d4c00ace48938f4888a23992ae3cc16674a0d5d1f1f07eb57afac550 0002-Fix-required-header-includes.patch +e2d49d91309b6b2450de7aa32be1807284958cf66cd9e4ee823dbb0afaf11772 0003-Only-inluclude-kernel-headers-with-glibc.patch +0124ef103407469af4ea19884e2ed7e4546f08b58c129e1e8ef36569831f4b36 error.h" +sha512sums="68832bddd6b91693110d1e26d3911bcd3c151003f83905571dcba05480ba484adc5bfe7d31a3b987bd930703d153724fb8eb9ae7cc26cff97be65a4f5ccb547b kbd-2.0.2.tar.gz +0487a90382201a162405618e983fb2a227c6f07258a498c6850b5ddcd36d5c836446b4c7883a494421a3dc34a60b164bb6ce10350c777bc0cb1f610d4fe6a0ca 0001-Replace-u_short-with-unsigned-short.patch +c3689db8777566dd92c6d38fadc1d8676d00926c711d5bb8b561547aaeb4d93b67998ac3f2b17faaa475e7c85a9e51c71b87cd92b6099ee118c19de58bc195aa 0002-Fix-required-header-includes.patch +13af714a54562ebc1ac6b19f24f75704b452faf543705e9e6a8c53e8080f5edffb49ddde26a876da71e6ca34b275c3407525d6d3446c543181d2eff2b784541b 0003-Only-inluclude-kernel-headers-with-glibc.patch +c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h" diff --git a/main/kbd/error.h b/main/kbd/error.h new file mode 100644 index 0000000000..5eb8ed5115 --- /dev/null +++ b/main/kbd/error.h @@ -0,0 +1,20 @@ +#ifndef ERROR_H +#define ERROR_H + +#include <stdio.h> +#include <stdarg.h> +#include <err.h> + +static inline void error(int status, int errnum, const char *fmt, ...) +{ + va_list ap; + void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx }; + void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx }; + fflush(stdout); + va_start(ap, fmt); + if (status != 0) + errfunc[errnum==0](status, fmt, ap); /* does not return */ + warnfunc[errnum==0](fmt, ap); + va_end(ap); +} +#endif diff --git a/main/kbd/kbd.patch b/main/kbd/kbd.patch deleted file mode 100644 index 83440ef8f7..0000000000 --- a/main/kbd/kbd.patch +++ /dev/null @@ -1,246 +0,0 @@ ---- kbd-1.15.3/src/dumpkeys.c 2011-04-26 20:29:35.000000000 +0000 -+++ kbd-1.15.3.patched/src/dumpkeys.c 2012-11-02 20:55:42.405000003 +0000 -@@ -107,7 +107,7 @@ - } - - static int --get_bind(u_char kb_index, u_char kb_table) { -+get_bind(unsigned char kb_index, unsigned char kb_table) { - struct kbentry ke; - - ke.kb_index = kb_index; -@@ -169,7 +169,7 @@ - return status; - } - --static u_char -+static unsigned char - maximum_val(int t) { - struct kbentry ke, ke0; - int i; -@@ -440,7 +440,7 @@ - (val >= 'a' && val <= 'z'))); - 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 -ur kbd-1.15.3/src/kbdinfo.c kbd-1.15.3.patched/src/kbdinfo.c ---- kbd-1.15.3/src/kbdinfo.c 2011-04-26 20:29:35.000000000 +0000 -+++ kbd-1.15.3.patched/src/kbdinfo.c 2012-11-02 21:22:31.081000003 +0000 -@@ -1,6 +1,5 @@ - #include <stdio.h> - #include <errno.h> --#include <error.h> - #include <unistd.h> - #include <sys/ioctl.h> - #include <linux/kd.h> -@@ -8,10 +7,12 @@ - #include "getfd.h" - #include "nls.h" - #include "version.h" -+#include "error.c" - - static const char *action = NULL; - static const char *value = NULL; - -+ - static void attr_noreturn - usage(int code) { - fprintf(stderr, -diff -ur kbd-1.15.3/src/kbdrate.c kbd-1.15.3.patched/src/kbdrate.c ---- kbd-1.15.3/src/kbdrate.c 2011-03-05 14:41:20.000000000 +0000 -+++ kbd-1.15.3.patched/src/kbdrate.c 2012-11-02 20:57:25.869000003 +0000 -@@ -74,6 +74,7 @@ - #include <errno.h> - #include <sys/file.h> - #include <sys/ioctl.h> -+#include <fcntl.h> - - #ifdef __sparc__ - #include <asm/param.h> -diff -ur kbd-1.15.3/src/loadkeys.c kbd-1.15.3.patched/src/loadkeys.c ---- kbd-1.15.3/src/loadkeys.c 2011-05-01 23:22:35.000000000 +0000 -+++ kbd-1.15.3.patched/src/loadkeys.c 2012-11-02 20:55:48.743000003 +0000 -@@ -114,7 +114,7 @@ - int alt_is_meta = 0; - - /* the kernel structures we want to set or print */ --u_short *key_map[MAX_NR_KEYMAPS]; -+unsigned short *key_map[MAX_NR_KEYMAPS]; - char *func_table[MAX_NR_FUNC]; - - accent_entry accent_table[MAX_DIACR]; -@@ -255,7 +255,7 @@ - - if (!key_map[k_table]) { - key_map[k_table] = -- (u_short *) xmalloc(NR_KEYS * sizeof(u_short)); -+ (unsigned short *) xmalloc(NR_KEYS * sizeof(unsigned short)); - for (i = 0; i < NR_KEYS; i++) - (key_map[k_table])[i] = K_HOLE; - } -@@ -566,7 +566,7 @@ - return kd.kb_cnt; - } - --static void do_constant_key(int i, u_short key) -+static void do_constant_key(int i, unsigned short key) - { - int typ, val, j; - -@@ -575,7 +575,7 @@ - - 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]; -@@ -620,7 +620,7 @@ - - for (i = 0; i < NR_KEYS; i++) { - if (key_is_constant[i]) { -- u_short key; -+ unsigned short key; - - if (!key_map[r0]) - lkfatal(_("impossible error in do_constant")); -@@ -800,7 +800,7 @@ - keymap_count++; - if (i) - printf("static "); -- printf("u_short %s_map[NR_KEYS] = {", mk_mapname(i)); -+ printf("unsigned short %s_map[NR_KEYS] = {", mk_mapname(i)); - for (j = 0; j < NR_KEYS; j++) { - if (!(j % 8)) - printf("\n"); -@@ -904,7 +904,7 @@ - { - int i, j; - -- //u_char *p; -+ //unsigned char *p; - char flag, magic[] = "bkeymap"; - unsigned short v; - -diff -ur kbd-1.15.3/src/loadkeys.y kbd-1.15.3.patched/src/loadkeys.y ---- kbd-1.15.3/src/loadkeys.y 2011-05-01 23:19:11.000000000 +0000 -+++ kbd-1.15.3.patched/src/loadkeys.y 2012-11-02 20:55:42.410000003 +0000 -@@ -55,7 +55,7 @@ - int alt_is_meta = 0; - - /* the kernel structures we want to set or print */ --u_short *key_map[MAX_NR_KEYMAPS]; -+unsigned short *key_map[MAX_NR_KEYMAPS]; - char *func_table[MAX_NR_FUNC]; - - accent_entry accent_table[MAX_DIACR]; -@@ -196,7 +196,7 @@ - - if (!key_map[k_table]) { - key_map[k_table] = -- (u_short *) xmalloc(NR_KEYS * sizeof(u_short)); -+ (unsigned short *) xmalloc(NR_KEYS * sizeof(unsigned short)); - for (i = 0; i < NR_KEYS; i++) - (key_map[k_table])[i] = K_HOLE; - } -@@ -507,7 +507,7 @@ - return kd.kb_cnt; - } - --static void do_constant_key(int i, u_short key) -+static void do_constant_key(int i, unsigned short key) - { - int typ, val, j; - -@@ -516,7 +516,7 @@ - - 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]; -@@ -561,7 +561,7 @@ - - for (i = 0; i < NR_KEYS; i++) { - if (key_is_constant[i]) { -- u_short key; -+ unsigned short key; - - if (!key_map[r0]) - lkfatal(_("impossible error in do_constant")); -@@ -741,7 +741,7 @@ - keymap_count++; - if (i) - printf("static "); -- printf("u_short %s_map[NR_KEYS] = {", mk_mapname(i)); -+ printf("unsigned short %s_map[NR_KEYS] = {", mk_mapname(i)); - for (j = 0; j < NR_KEYS; j++) { - if (!(j % 8)) - printf("\n"); -@@ -845,7 +845,7 @@ - { - int i, j; - -- //u_char *p; -+ //unsigned char *p; - char flag, magic[] = "bkeymap"; - unsigned short v; - -diff -ur kbd-1.15.3/src/openvt.c kbd-1.15.3.patched/src/openvt.c ---- kbd-1.15.3/src/openvt.c 2011-05-01 23:27:13.000000000 +0000 -+++ kbd-1.15.3.patched/src/openvt.c 2012-11-02 20:59:45.516000002 +0000 -@@ -10,7 +10,7 @@ - #include <sys/vt.h> - #include <sys/wait.h> - #include <sys/file.h> -- -+#include <fcntl.h> - #include "version.h" - #include "xmalloc.h" - #include "getfd.h" -diff -ur kbd-1.15.3/src/setvtrgb.c kbd-1.15.3.patched/src/setvtrgb.c ---- kbd-1.15.3/src/setvtrgb.c 2011-04-26 20:29:35.000000000 +0000 -+++ kbd-1.15.3.patched/src/setvtrgb.c 2012-11-02 21:22:50.566000002 +0000 -@@ -5,7 +5,7 @@ - #include <sys/ioctl.h> - #include <linux/kd.h> - #include <errno.h> --#include <error.h> -+#include "error.c" - #include "kbd.h" - #include "getfd.h" - #include "nls.h" ---- /dev/null 2012-10-16 17:31:41.304000002 +0000 -+++ kbd-1.15.3.patched/src/error.c 2012-11-02 21:22:07.812000002 +0000 -@@ -0,0 +1,24 @@ -+#include <stdio.h> -+#include <stdarg.h> -+ -+static void error(int status, int errnum, const char *fmt, ...) { -+ fflush(stdout); -+ char dest[4096]; -+ va_list ap; -+ va_start(ap, fmt); -+ ssize_t result = vsnprintf(dest, sizeof(dest), fmt, ap); -+ va_end(ap); -+ dprintf(2, "program_name: %s", dest); -+ if(errnum) { -+ dprintf(2, ": "); -+ perror(fmt); -+ exit (status); -+ } else { -+ dprintf(2, "\n"); -+ } -+} -+ -+ -+ -+ -+ |