summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-Jin Park <sj76.park@samsung.com>2016-04-06 18:01:57 +0900
committerSung-Jin Park <sj76.park@samsung.com>2016-04-06 18:01:57 +0900
commitf7b6c06d4c43a1d4429a36d0c4d925852a43d399 (patch)
tree0d30007a861c4c8e4f182a3c715e4760f227279a
parenta2c62c2bbfffee6cd9d8f3ae4d3c31da50d78137 (diff)
downloadxkeyboard-config-f7b6c06d4c43a1d4429a36d0c4d925852a43d399.tar.gz
xkeyboard-config-f7b6c06d4c43a1d4429a36d0c4d925852a43d399.tar.bz2
xkeyboard-config-f7b6c06d4c43a1d4429a36d0c4d925852a43d399.zip
Fix build error in aarch64submit/tizen/20160406.090342
Change-Id: Ic0ebc8c48c8fd9c7f2068d660bc775289a4cb6a6
-rw-r--r--cache/cache.c409
-rw-r--r--packaging/xkeyboard-config.spec9
2 files changed, 217 insertions, 201 deletions
diff --git a/cache/cache.c b/cache/cache.c
index 5420e990..42aea5a7 100644
--- a/cache/cache.c
+++ b/cache/cache.c
@@ -1,198 +1,211 @@
-#include <xkbcommon/xkbcommon.h>
-#include <stdio.h>
-#include <string.h>
-
-#define DFLT_RULES "evdev"
-#define DFLT_MODEL "pc105"
-#define DFLT_LAYOUT "us"
-
-#define STRLEN(s) (s ? strlen(s) : 0)
-#define STR(s) (s ? s : "")
-
-void parseArgs(int argc, char **argv, struct xkb_rule_names *names)
-{
- int i;
- char *tmp, *rule_path;
- FILE *file;
- int len_rule_path;
- char buf[1024] = {0, };
-
- if (argc < 2)
- {
- rule_path = getenv("RULE_FILE_PATH");
-
- printf("Cache file rule from %s file\n", rule_path);
-
- file = fopen(rule_path, "r");
- if (!file) return;
-
- while (!feof(file))
- {
- fscanf(file, "%s", buf);
- if (strstr(buf, "rules") > 0)
- {
- tmp = strtok(buf, "=");
- tmp = strtok(NULL, "=");
- if (tmp) names->rules= strdup(tmp);
- }
- else if (strstr(buf, "model") > 0)
- {
- tmp = strtok(buf, "=");
- tmp = strtok(NULL, "=");
- if (tmp) names->model= strdup(tmp);
- }
- else if (strstr(buf, "layout") > 0)
- {
- tmp = strtok(buf, "=");
- tmp = strtok(NULL, "=");
- if (tmp) names->layout= strdup(tmp);
- }
- else if (strstr(buf, "variant") > 0)
- {
- tmp = strtok(buf, "=");
- tmp = strtok(NULL, "=");
- if (tmp) names->variant= strdup(tmp);
- }
- else if (strstr(buf, "options") > 0)
- {
- tmp = strtok(buf, "=");
- tmp = strtok(NULL, "=");
- if (tmp) names->options= strdup(tmp);
- }
- }
-
- fclose(file);
- }
- else
- {
- for (i = 1; i < argc; i++)
- {
- printf("Cache file rule from argument\n");
-
- if (strstr(argv[i], "-rules") > 0)
- {
- tmp = strtok(argv[i], "=");
- tmp = strtok(NULL, "=");
- names->rules= strdup(tmp);
- }
- else if (strstr(argv[i], "-model") > 0)
- {
- tmp = strtok(argv[i], "=");
- tmp = strtok(NULL, "=");
- names->model = strdup(tmp);
- }
- else if (strstr(argv[i], "-layout") > 0)
- {
- tmp = strtok(argv[i], "=");
- tmp = strtok(NULL, "=");
- names->layout = strdup(tmp);
- }
- else if (strstr(argv[i], "-variant") > 0)
- {
- tmp = strtok(argv[i], "=");
- tmp = strtok(NULL, "=");
- names->variant = strdup(tmp);
- }
- else if (strstr(argv[i], "-options") > 0)
- {
- tmp = strtok(argv[i], "=");
- tmp = strtok(NULL, "=");
- names->options = strdup(tmp);
- }
- }
- }
-}
-
-void checkRules(struct xkb_rule_names *names)
-{
- if (!names->rules)
- {
- printf("Set default rules: %s\n", DFLT_RULES);
- names->rules = strdup(DFLT_RULES);
- }
- else printf("Current rules: %s\n", names->rules);
-
- if (!names->model)
- {
- printf("Set default model: %s\n", DFLT_MODEL);
- names->model = strdup(DFLT_MODEL);
- }
- else printf("Current model: %s\n", names->model);
-
- if (!names->layout)
- {
- printf("Set default layout: %s\n", DFLT_LAYOUT);
- names->layout = strdup(DFLT_LAYOUT);
- }
- else printf("Current layout: %s\n", names->layout);
-
- if (!names->variant) printf("There is no variant\n");
- else printf("Current variant: %s\n", names->variant);
-
- if (!names->options) printf("There is no options\n");
- else printf("Current options: %s\n", names->options);
-}
-
-int main(int argc, char **argv)
-{
- struct xkb_context *ctx;
- struct xkb_keymap *map;
- struct xkb_rule_names names;
- char *keymap_path;
- char *keymap_string;
- char *cache_path;
- FILE *file = NULL;
- int len_cache_path;
-
- memset(&names, 0, sizeof(names));
-
- parseArgs(argc, argv, &names);
-
- checkRules(&names);
-
- ctx = xkb_context_new(0);
- if (!ctx) {
- printf("Failed to generate a xkb context file\n");
- return 0;
- }
-
- if (!keymap_path) keymap_path = getenv("LOCAL_KEYMAP_PATH");
-
- xkb_context_include_path_append(ctx, keymap_path);
-
- map = xkb_map_new_from_names(ctx, &names, 0);
-
- keymap_string = xkb_map_get_as_string(map);
- if (!keymap_string) {
- printf("Failed convert keymap to string\n");
- return 0;
- }
-
- len_cache_path = STRLEN(names.rules) + STRLEN(names.model) + STRLEN(names.layout) + STRLEN(names.variant) + STRLEN(names.options) + sizeof("xkb") + 5;
- cache_path = (char *)calloc(1, len_cache_path);
- snprintf(cache_path, len_cache_path, "%s-%s-%s-%s-%s.xkb", STR(names.rules), STR(names.model), STR(names.layout), STR(names.variant), STR(names.options));
-
- file = fopen(cache_path, "w");
- if (fputs(keymap_string, file) < 0)
- {
- printf("Failed to write keymap file: %s\n", cache_path);
- fclose(file);
- unlink(cache_path);
- }
- else
- {
- printf("Success to make keymap file: %s\n", cache_path);
- fclose(file);
- }
-
- if (names.rules) free(names.rules);
- if (names.model) free(names.model);
- if (names.layout) free(names.layout);
- if (names.variant) free(names.variant);
- if (names.options) free(names.options);
- if (cache_path) free(cache_path);
- xkb_keymap_unref(map);
- xkb_context_unref(ctx);
-
- return 0;
-}
+#include <xkbcommon/xkbcommon.h>
+#include <stdio.h>
+#include <string.h>
+
+#define DFLT_RULES "evdev"
+#define DFLT_MODEL "pc105"
+#define DFLT_LAYOUT "us"
+
+#define STRLEN(s) (s ? strlen(s) : 0)
+#define STR(s) (s ? s : "")
+
+void parseArgs(int argc, char **argv, struct xkb_rule_names *names)
+{
+ int i;
+ char *tmp, *rule_path;
+ FILE *file;
+ int len_rule_path;
+ char buf[1024] = {0, };
+
+ if (argc < 2)
+ {
+ rule_path = getenv("RULE_FILE_PATH");
+
+ if (!rule_path)
+ {
+ printf("Failed to get RULE_FILE_PATH !\n");
+ return;
+ }
+
+ printf("Cache file rule from %s file\n", rule_path);
+
+ file = fopen(rule_path, "r");
+ if (!file) return;
+
+ while (!feof(file))
+ {
+ fscanf(file, "%s", buf);
+ if (strstr(buf, "rules") > 0)
+ {
+ tmp = strtok(buf, "=");
+ tmp = strtok(NULL, "=");
+ if (tmp) names->rules= strdup(tmp);
+ }
+ else if (strstr(buf, "model") > 0)
+ {
+ tmp = strtok(buf, "=");
+ tmp = strtok(NULL, "=");
+ if (tmp) names->model= strdup(tmp);
+ }
+ else if (strstr(buf, "layout") > 0)
+ {
+ tmp = strtok(buf, "=");
+ tmp = strtok(NULL, "=");
+ if (tmp) names->layout= strdup(tmp);
+ }
+ else if (strstr(buf, "variant") > 0)
+ {
+ tmp = strtok(buf, "=");
+ tmp = strtok(NULL, "=");
+ if (tmp) names->variant= strdup(tmp);
+ }
+ else if (strstr(buf, "options") > 0)
+ {
+ tmp = strtok(buf, "=");
+ tmp = strtok(NULL, "=");
+ if (tmp) names->options= strdup(tmp);
+ }
+ }
+
+ fclose(file);
+ }
+ else
+ {
+ for (i = 1; i < argc; i++)
+ {
+ printf("Cache file rule from argument\n");
+
+ if (strstr(argv[i], "-rules") > 0)
+ {
+ tmp = strtok(argv[i], "=");
+ tmp = strtok(NULL, "=");
+ names->rules= strdup(tmp);
+ }
+ else if (strstr(argv[i], "-model") > 0)
+ {
+ tmp = strtok(argv[i], "=");
+ tmp = strtok(NULL, "=");
+ names->model = strdup(tmp);
+ }
+ else if (strstr(argv[i], "-layout") > 0)
+ {
+ tmp = strtok(argv[i], "=");
+ tmp = strtok(NULL, "=");
+ names->layout = strdup(tmp);
+ }
+ else if (strstr(argv[i], "-variant") > 0)
+ {
+ tmp = strtok(argv[i], "=");
+ tmp = strtok(NULL, "=");
+ names->variant = strdup(tmp);
+ }
+ else if (strstr(argv[i], "-options") > 0)
+ {
+ tmp = strtok(argv[i], "=");
+ tmp = strtok(NULL, "=");
+ names->options = strdup(tmp);
+ }
+ }
+ }
+}
+
+void checkRules(struct xkb_rule_names *names)
+{
+ if (!names->rules)
+ {
+ printf("Set default rules: %s\n", DFLT_RULES);
+ names->rules = strdup(DFLT_RULES);
+ }
+ else printf("Current rules: %s\n", names->rules);
+
+ if (!names->model)
+ {
+ printf("Set default model: %s\n", DFLT_MODEL);
+ names->model = strdup(DFLT_MODEL);
+ }
+ else printf("Current model: %s\n", names->model);
+
+ if (!names->layout)
+ {
+ printf("Set default layout: %s\n", DFLT_LAYOUT);
+ names->layout = strdup(DFLT_LAYOUT);
+ }
+ else printf("Current layout: %s\n", names->layout);
+
+ if (!names->variant) printf("There is no variant\n");
+ else printf("Current variant: %s\n", names->variant);
+
+ if (!names->options) printf("There is no options\n");
+ else printf("Current options: %s\n", names->options);
+}
+
+int main(int argc, char **argv)
+{
+ struct xkb_context *ctx;
+ struct xkb_keymap *map;
+ struct xkb_rule_names names;
+ char *keymap_path = NULL;
+ char *keymap_string = NULL;
+ char *cache_path = NULL;
+ FILE *file = NULL;
+ int len_cache_path;
+
+ memset(&names, 0, sizeof(names));
+
+ parseArgs(argc, argv, &names);
+
+ checkRules(&names);
+
+ ctx = xkb_context_new(0);
+ if (!ctx) {
+ printf("Failed to generate a xkb context file\n");
+ return 0;
+ }
+
+ keymap_path = getenv("LOCAL_KEYMAP_PATH");
+
+ if (!keymap_path)
+ {
+ printf("Failed to get LOCAL_KEYMAP_PATH !\n");
+ return 0;
+ }
+
+ xkb_context_include_path_append(ctx, keymap_path);
+
+ map = xkb_map_new_from_names(ctx, &names, 0);
+
+ keymap_string = xkb_map_get_as_string(map);
+
+ if (!keymap_string) {
+ printf("Failed convert keymap to string\n");
+ return 0;
+ }
+
+ len_cache_path = STRLEN(names.rules) + STRLEN(names.model) + STRLEN(names.layout) + STRLEN(names.variant) + STRLEN(names.options) + sizeof("xkb") + 5;
+ cache_path = (char *)calloc(1, len_cache_path);
+ snprintf(cache_path, len_cache_path, "%s-%s-%s-%s-%s.xkb", STR(names.rules), STR(names.model), STR(names.layout), STR(names.variant), STR(names.options));
+
+ file = fopen(cache_path, "w");
+ if (fputs(keymap_string, file) < 0)
+ {
+ printf("Failed to write keymap file: %s\n", cache_path);
+ fclose(file);
+ unlink(cache_path);
+ }
+ else
+ {
+ printf("Success to make keymap file: %s\n", cache_path);
+ fclose(file);
+ }
+
+ if (names.rules) free(names.rules);
+ if (names.model) free(names.model);
+ if (names.layout) free(names.layout);
+ if (names.variant) free(names.variant);
+ if (names.options) free(names.options);
+ if (cache_path) free(cache_path);
+ xkb_keymap_unref(map);
+ xkb_context_unref(ctx);
+
+ return 0;
+}
diff --git a/packaging/xkeyboard-config.spec b/packaging/xkeyboard-config.spec
index 24076128..56c13840 100644
--- a/packaging/xkeyboard-config.spec
+++ b/packaging/xkeyboard-config.spec
@@ -79,10 +79,13 @@ sed -i 's/evdev/tizen_%{?profile}/g' %{buildroot}/%{TZ_SYS_RO_SHARE}/X11/xkb/rul
ln -sf tizen_"%{?profile}" %{buildroot}/%{TZ_SYS_RO_SHARE}/X11/xkb/rules/evdev
export LOCAL_KEYMAP_PATH=%{buildroot}/%{TZ_SYS_RO_SHARE}/X11/xkb
./remove_unused_files.sh
-export RULE_FILE_PATH=%{TZ_SYS_RO_SHARE}/X11/xkb/xkb.rule
-%{buildroot}%{_bindir}/cache
-rm %{buildroot}%{_bindir}/cache
+#export RULE_FILE_PATH=%{TZ_SYS_RO_SHARE}/X11/xkb/xkb.rule
+if [ -e %{buildroot}%{_bindir}/cache ]; then
+ %{buildroot}%{_bindir}/cache
+ rm -f %{buildroot}%{_bindir}/cache
+fi
mkdir -p %{buildroot}/%{TZ_SYS_VAR}/lib/xkb/
+touch %{buildroot}/%{TZ_SYS_VAR}/lib/xkb/dummy.xkb
cp *.xkb %{buildroot}/%{TZ_SYS_VAR}/lib/xkb/
#for license notification