makekeys: Receive the keysym files as arguments Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
diff --git a/configure.ac b/configure.ac
index e6a8f15..786556c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,19 +77,18 @@ AC_MSG_CHECKING([for X11 includedir])
includex11dir="`$PKG_CONFIG --variable=includex11dir xproto`"
AC_MSG_RESULT([$includex11dir])
-# Obtain full path for keysymdef header file
-AC_MSG_CHECKING([for keysymdef.h])
-KEYSYMDEF_H="$includex11dir/keysymdef.h"
-test -f "$KEYSYMDEF_H" || AC_MSG_ERROR([can't locate keysymdef.h in $includex11dir])
-AC_MSG_RESULT([$KEYSYMDEF_H])
-AC_SUBST([KEYSYMDEF_H])
-
-# Obtain full path for XF86keysym header file
-AC_MSG_CHECKING([for XF86keysym.h])
-XF86KEYSYM_H="$includex11dir/XF86keysym.h"
-test -f "$XF86KEYSYM_H" || AC_MSG_ERROR([can't locate XF86keysym.h in $includex11dir])
-AC_MSG_RESULT([$XF86KEYSYM_H])
-AC_SUBST([XF86KEYSYM_H])
+AC_MSG_CHECKING([keysym definitions])
+KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11
+FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
+for i in $FILES; do
+ if test -f "$KEYSYMDEFDIR/$i"; then
+ KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i"
+ elif test "x$i" = "xkeysymdef.h"; then
+ AC_MSG_ERROR([Cannot find keysymdef.h])
+ fi
+done
+AC_MSG_RESULT([$KEYSYMDEFS])
+AC_SUBST(KEYSYMDEFS)
# Define a configuration option for the XKB config root
xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
diff --git a/makekeys/Makefile.am b/makekeys/Makefile.am
index 75ed164..a7ef6e0 100644
--- a/makekeys/Makefile.am
+++ b/makekeys/Makefile.am
@@ -2,4 +2,7 @@ AM_CFLAGS = $(X11_CFLAGS) $(CWARNFLAGS)
# need to use build-native compiler
CC = $(CC_FOR_BUILD)
+CPPFLAGS = $(CPPFLAGS_FOR_BUILD)
+CFLAGS = $(CFLAGS_FOR_BUILD)
+LDFLAGS = $(LDFLAGS_FOR_BUILD)
noinst_PROGRAMS = makekeys
diff --git a/makekeys/makekeys.c b/makekeys/makekeys.c
index fdccaf0..1334e15 100644
--- a/makekeys/makekeys.c
+++ b/makekeys/makekeys.c
@@ -170,9 +170,10 @@ int
main(int argc, char *argv[])
{
int ksnum = 0;
+ FILE *fptr;
int max_rehash;
Signature sig;
- int i, j, k, z;
+ int i, j, k, l, z;
char *name;
char c;
int first;
@@ -183,45 +184,54 @@ main(int argc, char *argv[])
char key[128];
char buf[1024];
+ for (l = 1; l < argc; l++) {
+ fptr = fopen(argv[l], "r");
+ if (!fptr) {
+ fprintf(stderr, "couldn't open %s\n", argv[l]);
+ continue;
+ }
- while (fgets(buf, sizeof(buf), stdin)) {
- int ret;
+ while (fgets(buf, sizeof(buf), fptr)) {
+ int ret;
- /* Manage keysyms from keysymdef.h */
- ret = get_keysym(buf, key, ksnum);
- if (!ret) {
- ret = get_keysym_alias(buf, key, ksnum);
- if (ret == -1)
- continue;
- }
+ /* Manage keysyms from keysymdef.h */
+ ret = get_keysym(buf, key, ksnum);
+ if (!ret) {
+ ret = get_keysym_alias(buf, key, ksnum);
+ if (ret == -1)
+ continue;
+ }
+
+ /* Manage keysyms from XF86keysym.h */
+ if (!ret)
+ ret = get_xf86_keysym(buf, key, sizeof(key), ksnum);
+ if (!ret) {
+ ret = get_xf86_keysym_alias(buf, key, sizeof(key), ksnum);
+ if (ret < 1)
+ continue;
+ }
- /* Manage keysyms from XF86keysym.h */
- if (!ret)
- ret = get_xf86_keysym(buf, key, sizeof(key), ksnum);
- if (!ret) {
- ret = get_xf86_keysym_alias(buf, key, sizeof(key), ksnum);
- if (ret < 1)
+ if (info[ksnum].val > 0x1fffffff) {
+ fprintf(stderr,
+ "ignoring illegal keysym (%s), remove it from .h file!\n",
+ key);
continue;
+ }
+ name = malloc((unsigned)strlen(key) + 1);
+ if (!name) {
+ fprintf(stderr, "makekeys: out of memory!\n");
+ exit(1);
+ }
+ (void)strcpy(name, key);
+ info[ksnum].name = name;
+ ksnum++;
+ if (ksnum == KTNUM) {
+ fprintf(stderr, "makekeys: too many keysyms!\n");
+ exit(1);
+ }
}
- if (info[ksnum].val > 0x1fffffff) {
- fprintf(stderr,
- "ignoring illegal keysym (%s), remove it from .h file!\n",
- key);
- continue;
- }
- name = malloc((unsigned)strlen(key) + 1);
- if (!name) {
- fprintf(stderr, "makekeys: out of memory!\n");
- exit(1);
- }
- (void)strcpy(name, key);
- info[ksnum].name = name;
- ksnum++;
- if (ksnum == KTNUM) {
- fprintf(stderr, "makekeys: too many keysyms!\n");
- exit(1);
- }
+ fclose(fptr);
}
/* Special case NoSymbol. */
diff --git a/src/Makefile.am b/src/Makefile.am
index b9a12b9..9df6f81 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,5 +26,5 @@ libxkbcommon_la_SOURCES = \
BUILT_SOURCES = ks_tables.h
CLEANFILES = $(BUILT_SOURCES)
-ks_tables.h: $(top_builddir)/makekeys/makekeys$(EXEEXT) $(KEYSYMDEF_H) $(XF86KEYSYM_H)
- $(AM_V_GEN)cat $(KEYSYMDEF_H) $(XF86KEYSYM_H) | $(top_builddir)/makekeys/makekeys$(EXEEXT) > $@
+ks_tables.h: $(KEYSYMDEFS) $(top_builddir)/makekeys/makekeys$(EXEEXT)
+ $(top_builddir)/makekeys/makekeys $(KEYSYMDEFS) > $@