Skip to content

Commit

Permalink
src: Fix to build emoji-*.dict in CLDR 38
Browse files Browse the repository at this point in the history
root.xml and sr_Cyrl.xml have included no contents since
cldr-emoji-annotation-38 and make install failed because of no
emoji-root.dict and emoji-sr.Cyrl.dict.
Now the build creates the no content files but remove those files
in the install hook.

BUG=rhbz#1898065
  • Loading branch information
fujiwarat committed Nov 20, 2020
1 parent 02338ce commit aa558de
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
61 changes: 29 additions & 32 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ibus - The Input Bus
#
# Copyright (c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2015-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -248,6 +248,7 @@ AM_CPPFLAGS += -DENABLE_EMOJI_DICT
dictdir = $(pkgdatadir)/dicts
LANG_FILES = $(basename $(notdir $(wildcard $(EMOJI_ANNOTATION_DIR)/*.xml)))
EMOJI_DICT_FILES = $(patsubst %,dicts/emoji-%.dict,$(LANG_FILES))
# emoji-root.dict, emoji-sr_Cyrl.dict have no contents.
dict_DATA = $(EMOJI_DICT_FILES)

noinst_PROGRAMS += emoji-parser
Expand All @@ -265,6 +266,7 @@ dicts/emoji-%.dict: emoji-parser
xml_derived_option="--xml-derived $(EMOJI_ANNOTATION_DIR)/../annotationsDerived/$*.xml"; \
plus_comment="derived"; \
fi; \
is_skip=0; \
if test x"$*" = xen ; then \
$(builddir)/emoji-parser \
--unicode-emoji-dir $(UNICODE_EMOJI_DIR) \
Expand All @@ -279,48 +281,43 @@ dicts/emoji-%.dict: emoji-parser
--xml $(EMOJI_ANNOTATION_DIR)/$*.xml \
$$xml_derived_option \
--out $@; \
retval=$$?; \
if test $$retval -eq 99 ; then \
is_skip=1; \
touch $@; \
elif test $$retval -ne 0 ; then \
echo "Fail to generate $@"; \
abrt; \
fi; \
fi; \
echo "Generated $$plus_comment $@"
if test $$is_skip -eq 0 ; then \
echo "Generated $$plus_comment $@"; \
else \
echo "Skip $$plus_comment $@"; \
fi;

ibusemojigen.h: dicts/emoji-en.dict
$(NULL)

install-data-hook: $(dict_DATA)
@$(NORMAL_INSTALL)
# We put dicts/emoji-%.dict as the make target for the parallel build
# and the make target has to be genarated even if the file size is zero.
# But we don't want to install the zero size files and delete them
# in install-data-hook.
install-data-hook:
$(AM_V_at)list='$(wildcard dicts/*.dict)'; \
test -n "$(dictdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(dictdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(dictdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -s "$$d$$p"; then continue; fi; \
basename "$$p"; \
done | \
while read files; do \
if [ x$(AM_DEFAULT_VERBOSITY) = x1 ] ; then \
echo "$(INSTALL_DATA) $$files '$(DESTDIR)$(dictdir)'"; \
else \
echo "Installing $$files"; \
fi; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(dictdir)" || exit $$?; \
while read file; do \
if test -f "$(DESTDIR)$(dictdir)/$$file"; then \
echo "Delete $(DESTDIR)$(dictdir)/$$file"; \
rm "$(DESTDIR)$(dictdir)/$$file" || exit $$?; \
fi; \
done

dict__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
cd "$$dir" && rm -f $$files; }; \
}

# for make dist
uninstall-hook:
@$(NORMAL_UNINSTALL)
$(AM_V_at)list='$(wildcard dicts/*.dict)'; \
test -n "$(dictdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(dictdir)'; $(dict__uninstall_files_from_dir)

emoji_parser_SOURCES = \
emoji-parser.c \
$(NULL)
Expand Down
4 changes: 3 additions & 1 deletion src/emoji-parser.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2016-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
* Copyright (C) 2016-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
* Copyright (C) 2016 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -1294,6 +1294,8 @@ main (int argc, char *argv[])
category_file_save (output_category, list);
if (list)
g_slist_free (list);
else
return 99;

return 0;
}

0 comments on commit aa558de

Please sign in to comment.