Skip to content

Commit

Permalink
src: Fix to build libibus-1.0.la twice
Browse files Browse the repository at this point in the history
The purpose of autotools is to automatically handle dependencies. By
calling $(MAKE) manually and without specifying any dependencies below,
we are going out of our way to prevent automake from doing its job.

    ibusunicodegen.h:
           $(MAKE) $(AM_MAKEFLAGS) dicts/unicode-blocks.dict

This avoids a build error whereby libibus-1.0.la is built twice
simultaneously, races with itself, and breaks the build.

    dicts/unicode-blocks.dict ibusunicodegen.h: unicode-parser

The two build targets let `make ibusunicodegen.h` try to make
`dicts/unicode-blocks.dict` and `ibusunicodegen.h` with unicode-parser.

Unlike `ibusunicodegen.h`, we cannot add `ibusemojigen.h` to the rule
that produces it (as a side-effect) because the rule is specified with
GNU Make syntax:

    dicts/emoji-%.dict: emoji-parser

and doing so yields an error:

    config.status: error: Something went wrong bootstrapping makefile
        fragments for automatic dependency tracking.  If GNU make was
        not used, consider re-running the configure script with
        MAKE="gmake" (or whatever is necessary).  You can also try
        re-running configure with the '--disable-dependency-tracking'
        option to at least be able to build the package (albeit without
        support for automatic dependency tracking).

So instead, add a prerequisite to the rule.

Both emoji-parser and unicode-parser has $(libibus) in LDADD
and $(libibus) is built before emoji-parser and unicode-parser are
built.

BUG=#2523
  • Loading branch information
mattst88 authored and fujiwarat committed Jul 5, 2023
1 parent be1f1d0 commit f25c48a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,9 @@ dicts/emoji-%.dict: emoji-parser
echo "Skip $$plus_comment $@"; \
fi;

ibusemojigen.h:
$(MAKE) $(AM_MAKEFLAGS) dicts/emoji-en.dict
# #2523 Should use autotool dependency
ibusemojigen.h: dicts/emoji-en.dict
$(MAKE) $(AM_MAKEFLAGS) $^

# 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.
Expand Down Expand Up @@ -424,7 +425,8 @@ dicts/unicode-names.dict: unicode-parser
echo "Generated $@"; \
fi;

dicts/unicode-blocks.dict: unicode-parser
# #2523 Should use autotool dependency
dicts/unicode-blocks.dict ibusunicodegen.h: unicode-parser
$(AM_V_at)input_file="$(UCD_DIR)/Blocks.txt"; \
if test ! -f "$$input_file" ; then \
echo "WARNING: Not found $$input_file" 1>&2; \
Expand All @@ -436,9 +438,6 @@ dicts/unicode-blocks.dict: unicode-parser
echo "Generated $@"; \
fi;

ibusunicodegen.h:
$(MAKE) $(AM_MAKEFLAGS) dicts/unicode-blocks.dict

unicode_parser_SOURCES = \
unicode-parser.c \
$(parser_extra_sources) \
Expand Down

0 comments on commit f25c48a

Please sign in to comment.