[gtk+] Build extract-strings tool for build system
- From: Jan-Joost Spanjers <jspanjers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Build extract-strings tool for build system
- Date: Mon, 13 May 2013 15:11:57 +0000 (UTC)
commit 914099dce1bfaef71754c312b2711989fe30929d
Author: Hib Eris <hib hiberis nl>
Date: Sat May 11 16:57:39 2013 +0200
Build extract-strings tool for build system
This fixes cross compiling where build system != host system.
https://bugzilla.gnome.org/show_bug.cgi?id=699690
configure.ac | 6 ++++++
gtk/Makefile.am | 17 +++++++++++------
m4/ax_prog_cc_for_build.m4 | 2 ++
m4/pkg_config_for_build.m4 | 20 ++++++++++++++++++++
4 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9713015..9b90e38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -684,6 +684,12 @@ AM_PATH_GLIB_2_0(glib_required_version, :,
*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
gobject gmodule-no-export)
+PKG_PROG_PKG_CONFIG_FOR_BUILD
+GLIB_CFLAGS_FOR_BUILD=`$PKG_CONFIG_FOR_BUILD --cflags glib-2.0 gobject-2.0 gmodule-no-export-2.0`
+GLIB_LIBS_FOR_BUILD=`$PKG_CONFIG_FOR_BUILD --libs glib-2.0 gobject-2.0 gmodule-no-export-2.0`
+AC_SUBST(GLIB_CFLAGS_FOR_BUILD)
+AC_SUBST(GLIB_LIBS_FOR_BUILD)
+
dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
dnl
gtk_save_LIBS=$LIBS
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 296ef00..21ac74c 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1128,8 +1128,8 @@ template_headers = $(COMPOSITE_TEMPLATES:.ui=.ui.h)
MAINTAINERCLEANFILES += $(template_headers)
-%.ui.h: %.ui extract-strings$(EXEEXT)
- $(AM_V_GEN) ./extract-strings$(EXEEXT) $< > $@
+%.ui.h: %.ui extract-strings$(BUILD_EXEEXT)
+ $(AM_V_GEN) ./extract-strings$(BUILD_EXEEXT) $< > $@
#
# rules to generate built sources
@@ -1401,10 +1401,15 @@ endif
gtk_launch_LDADD = $(LDADDS)
gtk_launch_SOURCES = gtk-launch.c
-noinst_PROGRAMS = extract-strings
-
-extract_strings_SOURCES = extract-strings.c
-extract_strings_LDADD = $(GLIB_LIBS)
+# The extract_strings tool is a build utility that runs on the build system.
+extract_strings_sources = extract-strings.c
+extract_strings_cppflags =
+extract_strings_cflags = $(GLIB_CFLAGS_FOR_BUILD)
+extract_strings_ldadd = $(GLIB_LIBS_FOR_BUILD)
+extract-strings$(BUILD_EXEEXT): $(extract_strings_sources)
+ @rm -f extract-strings$(BUILD_EXEEXT)
+ $(AM_V_CCLD)$(CC_FOR_BUILD) $(extract_strings_cppflags) $(CPPFLAGS_FOR_BUILD)
$(extract_strings_cflags) $(CFLAGS_FOR_BUILD) $^ $(LDFLAGS_FOR_BUILD) $(extract_strings_ldadd)
$(LIBS_FOR_BUILD) -o $@
+EXTRA_DIST += $(extract_strings_sources)
.PHONY: files test test-debug
diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
index 96cd98a..c2adede 100644
--- a/m4/ax_prog_cc_for_build.m4
+++ b/m4/ax_prog_cc_for_build.m4
@@ -57,6 +57,7 @@ pushdef([CPP], CPP_FOR_BUILD)dnl
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
+pushdef([LIBS], LIBS_FOR_BUILD)dnl
pushdef([host], build)dnl
pushdef([host_alias], build_alias)dnl
pushdef([host_cpu], build_cpu)dnl
@@ -98,6 +99,7 @@ popdef([host_vendor])dnl
popdef([host_cpu])dnl
popdef([host_alias])dnl
popdef([host])dnl
+popdef([LIBS])dnl
popdef([LDFLAGS])dnl
popdef([CPPFLAGS])dnl
popdef([CFLAGS])dnl
diff --git a/m4/pkg_config_for_build.m4 b/m4/pkg_config_for_build.m4
new file mode 100644
index 0000000..0422f48
--- /dev/null
+++ b/m4/pkg_config_for_build.m4
@@ -0,0 +1,20 @@
+# PKG_PROG_PKG_CONFIG_FOR_BUILD([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG_FOR_BUILD],
+[m4_pattern_allow([^PKG_CONFIG_FOR_BUILD$])
+AC_ARG_VAR([PKG_CONFIG_FOR_BUILD], [path to build system's pkg-config utility])
+
+if test "x$ac_cv_env_PKG_CONFIG_FOR_BUILD_set" != "xset"; then
+ AC_PATH_PROG([PKG_CONFIG_FOR_BUILD], [pkg-config])
+fi
+if test -n "$PKG_CONFIG_FOR_BUILD"; then
+ _pkg_for_build_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([build system's pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG_FOR_BUILD --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG_FOR_BUILD=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG_FOR_BUILD
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]