summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <pwu@redhat.com>2019-11-27 15:09:24 +0800
committerPeng Wu <pwu@redhat.com>2020-02-19 15:09:11 +0800
commit0c7769929c46e8e81c2fabaae638c73604e5042e (patch)
tree0e0a19d48bade835dcb88e824d2fa2b37918c585
parent25114a520211408fc9e24b826bfd4fadfdfe2612 (diff)
downloadibus-hangul-0c7769929c46e8e81c2fabaae638c73604e5042e.tar.gz
Update autoconf to compile ibus-hangul tests
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac18
-rw-r--r--src/Makefile.am27
-rw-r--r--tests/Makefile.am75
-rw-r--r--tests/meta.test.in4
5 files changed, 120 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 3deaff8..fcb70d3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@
SUBDIRS = \
src \
+ tests \
setup \
icons \
data \
diff --git a/configure.ac b/configure.ac
index 1a1b992..664c2a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,11 @@ PKG_CHECK_MODULES(HANGUL, [
libhangul >= 0.1.0
])
+# check gtk
+PKG_CHECK_MODULES(GTK, [
+ gtk+-3.0 >= 3.0.0
+])
+
# check env
AC_PATH_PROG(ENV_PROG, env)
AC_SUBST(ENV_PROG)
@@ -84,6 +89,18 @@ AC_DEFINE_UNQUOTED(
[Define to the read-only architecture-independent data directory.]
)
+# --enable-installed-tests
+AC_ARG_ENABLE(installed-tests,
+ AS_HELP_STRING([--enable-installed-tests],
+ [Enable to installed tests]),
+ [enable_installed_tests=$enableval],
+ [enable_installed_tests=no]
+)
+AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], [test x"$enable_installed_tests" = x"yes"])
+if test x"$enable_installed_tests" = x"no"; then
+ enable_installed_tests="no (disabled, use --enable-installed-tests to enable)"
+fi
+
# OUTPUT files
AC_CONFIG_FILES([
po/Makefile.in
@@ -91,6 +108,7 @@ Makefile
ibus-hangul.spec
src/Makefile
src/hangul.xml.in
+tests/Makefile
setup/Makefile
icons/Makefile
data/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 2efff43..bda8a04 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,27 @@ AM_LDFLAGS = \
@HANGUL_LIBS@ \
$(NULL)
+noinst_LIBRARIES = \
+ libinternal.a
+ $(NULL)
+
+libinternal_a_SOURCES = \
+ engine.c \
+ engine.h \
+ ustring.c \
+ ustring.h \
+ i18n.h \
+ $(NULL)
+
+libinternal_a_CFLAGS = \
+ @IBUS_CFLAGS@ \
+ @HANGUL_CFLAGS@ \
+ -DPKGDATADIR=\"$(pkgdatadir)\" \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DIBUSHANGUL_DATADIR=\"$(datadir)/ibus-hangul\" \
+ $(NULL)
+
check_PROGRAMS = \
test-ustring
$(NULL)
@@ -40,11 +61,6 @@ libexec_PROGRAMS = ibus-engine-hangul
ibus_engine_hangul_SOURCES = \
main.c \
- engine.c \
- engine.h \
- ustring.c \
- ustring.h \
- i18n.h \
$(NULL)
ibus_engine_hangul_CFLAGS = \
@@ -57,6 +73,7 @@ ibus_engine_hangul_CFLAGS = \
$(NULL)
ibus_engine_hangul_LDADD = \
+ libinternal.a \
@IBUS_LIBS@ \
@HANGUL_LIBS@ \
$(NULL)
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..a32a780
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,75 @@
+# vim:set noet ts=4:
+#
+# ibus-hangul - The Hangul engine for IBus
+#
+# Copyright (c) 2019 Peng Wu <alexepico@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+TESTS = \
+ ibus-hangul \
+ $(NULL)
+
+CLEANFILES = $(test_metas)
+
+EXTRA_DIST = $(test_metas_in)
+
+noinst_PROGRAMS = $(TESTS)
+
+TESTS_ENVIRONMENT = \
+ top_builddir=$(top_builddir) \
+ top_srcdir=$(top_srcdir) \
+ builddir=$(builddir) \
+ srcdir=$(srcdir) \
+ LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$(top_builddir)/src" \
+ DISABLE_GUI_TESTS="$(DISABLE_GUI_TESTS)" \
+ $(NULL)
+
+if ENABLE_INSTALLED_TESTS
+test_execs = ibus-hangul
+test_metas_in = meta.test.in
+test_metas = $(addsuffix .test, $(test_execs))
+test_sources_DATA = $(test_metas)
+test_sourcesdir = $(datadir)/installed-tests/ibus-hangul
+test_execs_PROGRAMS = $(TESTS)
+test_execsdir = $(libexecdir)/installed-tests/ibus-hangul
+endif
+
+ibus_hangul_SOURCES = ibus-hangul.c
+ibus_hangul_CFLAGS = \
+ @IBUS_CFLAGS@ \
+ @HANGUL_CFLAGS@ \
+ @GTK_CFLAGS@ \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src \
+ -DPKGDATADIR=\"$(pkgdatadir)\" \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DIBUSHANGUL_DATADIR=\"$(datadir)/ibus-hangul\" \
+ $(NULL)
+
+ibus_hangul_LDADD = \
+ ../src/libinternal.a \
+ @IBUS_LIBS@ \
+ @HANGUL_LIBS@ \
+ @GTK_LIBS@ \
+ $(NULL)
+
+$(test_metas): $(test_metas_in) $(test_programs)
+ f=`echo $@ | sed -e 's/\.test//'`; \
+ TEST_EXEC=$(test_execsdir)/$$f; \
+ sed -e "s|@TEST_EXEC[@]|$$TEST_EXEC|g" $(test_metas_in) > $@.tmp; \
+ mv $@.tmp $@; \
+ $(NULL)
diff --git a/tests/meta.test.in b/tests/meta.test.in
new file mode 100644
index 0000000..ae2b299
--- /dev/null
+++ b/tests/meta.test.in
@@ -0,0 +1,4 @@
+[Test]
+Type=session
+Exec=@TEST_EXEC@ --tap
+Output=TAP