[PATCH 7/7] Fix the handling of files generated for xgettext

David Shea dshea at redhat.com
Fri Nov 8 14:57:34 UTC 2013


Include the generated files in the archive. Writing files to the source
directory when building from an unpacked distribution archive is a
problem, since VPATH builds expect everything to be written to
$builddir. Gettext insists that all POTFILES be under $srcdir, so
generate the files we need during make dist and pack them up.

To make these dist rules easier, use absolute paths everywhere in
po/Rules-extract. This removes the restriction of target filenames
needing to start with $top_srcdir relative to po. File names can be any
path, either absolute or relative to po, and make will figure out the
rest.
---
 Makefile.am                            |  5 +++++
 data/liveinst/Makefile.am              |  5 +++++
 data/liveinst/console.apps/Makefile.am |  5 +++++
 data/liveinst/gnome/Makefile.am        |  6 ++++++
 po/Rules-extract                       | 16 ++++++++--------
 5 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 69f5278..12393db 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,11 @@ SUBDIRS = data docs dracut po pyanaconda scripts tests widgets utils
 
 EXTRA_DIST = config.rpath COPYING
 
+# Files generated for gettext need to be included in the distribution
+EXTRA_DIST += $(srcdir)/anaconda.po
+$(srcdir)/anaconda.po: $(srcdir)/anaconda
+	@$(MAKE) -C $(top_builddir)/po $(abs_top_srcdir)/$(subdir)/$$(basename $@)
+
 MAINTAINERCLEANFILES = Makefile.in config.guess config.h.in config.sub \
                        depcomp install-sh ltmain.sh missing ABOUT-NLS \
                        INSTALL aclocal.m4 configure *.pyc py-compile \
diff --git a/data/liveinst/Makefile.am b/data/liveinst/Makefile.am
index 9e30c9a..80b1769 100644
--- a/data/liveinst/Makefile.am
+++ b/data/liveinst/Makefile.am
@@ -37,6 +37,11 @@ MAINTAINERCLEANFILES = Makefile.in
 
 @INTLTOOL_DESKTOP_RULE@
 
+# Files generated for gettext need to be included in the distribution
+EXTRA_DIST += $(srcdir)/liveinst.desktop.in.h
+$(srcdir)/liveinst.desktop.in.h: $(srcdir)/liveinst.desktop.in
+	@$(MAKE) -C $(top_builddir)/po $(abs_top_srcdir)/$(subdir)/$$(basename $@)
+
 install-exec-local:
 	$(MKDIR_P) $(DESTDIR)$(bindir)
 	$(LN_S) consolehelper $(DESTDIR)$(bindir)/liveinst
diff --git a/data/liveinst/console.apps/Makefile.am b/data/liveinst/console.apps/Makefile.am
index 19d56a8..9f15979 100644
--- a/data/liveinst/console.apps/Makefile.am
+++ b/data/liveinst/console.apps/Makefile.am
@@ -21,6 +21,11 @@ if IS_LIVEINST_ARCH
 consoledir        = $(sysconfdir)/security/console.apps
 dist_console_DATA = liveinst
 endif
+#
+# Files generated for gettext need to be included in the distribution
+EXTRA_DIST = $(srcdir)/liveinst.h
+$(srcdir)/liveinst.h: $(srcdir)/liveinst
+	@$(MAKE) -C $(top_builddir)/po $(abs_top_srcdir)/$(subdir)/$$(basename $@)
 
 CLEANFILES = *.h
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/data/liveinst/gnome/Makefile.am b/data/liveinst/gnome/Makefile.am
index 706cd10..ae05a5c 100644
--- a/data/liveinst/gnome/Makefile.am
+++ b/data/liveinst/gnome/Makefile.am
@@ -28,3 +28,9 @@ CLEANFILES = fedora-welcome.desktop
 MAINTAINERCLEANFILES = Makefile.in
 
 @INTLTOOL_DESKTOP_RULE@
+
+# Files generated for gettext need to be included in the distribution
+EXTRA_DIST += $(srcdir)/fedora-welcome.po $(srcdir)/fedora-welcome.desktop.in.h
+$(srcdir)/fedora-welcome.po $(srcdir)/fedora-welcome.desktop.in.h: \
+	$(srcdir)/fedora-welcome $(srcdir)/fedora-welcome.desktop.in
+	@$(MAKE) -C $(top_builddir)/po $(abs_top_srcdir)/$(subdir)/$$(basename $@)
diff --git a/po/Rules-extract b/po/Rules-extract
index f7fa669..229d5e5 100644
--- a/po/Rules-extract
+++ b/po/Rules-extract
@@ -10,29 +10,29 @@
 # All output files need to be in $srcdir for gettext to be able to find them.
 
 %.desktop.in.h: %.desktop.in
-	@intltool-extract -q --type=gettext/keys -l $< && \
+	@intltool-extract -q --type=gettext/keys -l --srcdir / $(realpath $<) && \
 	sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \
 	rm -f tmp/$$(basename $@)
 
 %liveinst.h: %liveinst
-	@intltool-extract -q --type=gettext/quoted -l $< && \
+	@intltool-extract -q --type=gettext/quoted -l --srcdir / $(realpath $<) && \
 	sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \
 	rm -f tmp/$$(basename $@)
 
 # Remove the $top_srcdir prefix from files so that xgettext can search for the file
 # relative to $top_srcdir and get the path name right in the .po
 %anaconda.po: %anaconda
-	@input_file="$<" && \
+	@input_file="$(realpath $<)" && \
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --omit-header --directory=$(top_srcdir) \
-		--language=Python -o $@ $${input_file##$(top_srcdir)/}
+		--language=Python -o $@ $${input_file##$(realpath $(top_srcdir))/}
 
 %fedora-welcome.po: %fedora-welcome
-	@input_file="$<" && \
+	@input_file="$(realpath $<)" && \
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --omit-header --directory=$(top_srcdir) \
-		--language=JavaScript -o $@ $${input_file##$(top_srcdir)/}
+		--language=JavaScript -o $@ $${input_file##$(realpath $(top_srcdir))/}
 
-mostlyclean: mostlyclean-extract
-mostlyclean-extract:
+maintainer-clean: maintainer-clean-extract
+maintainer-clean-extract:
 	rm -f \
 		$(top_srcdir)/anaconda.po $(top_srcdir)/data/liveinst/gnome/fedora-welcome.po \
 		$(top_srcdir)/data/liveinst/console.apps/liveinst.h
-- 
1.8.4.2



More information about the anaconda-patches mailing list