public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Do not build .mo files in source directory (bug 14121)
@ 2017-12-14 18:14 Joseph Myers
  2017-12-14 18:42 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2017-12-14 18:14 UTC (permalink / raw)
  To: libc-alpha

Building and installing glibc leaves .mo files (compiled message
translations) behind in the source directory.  Building those files in
the source directory may once have made sense, if they were included
in release tarballs; now that release tarballs are just the output of
"git archive", building any non-checked-in files in the source
directory does not make sense.  This patch changes these files to be
built in the build directory instead.

This is necessary but not sufficient to avoid build-many-glibcs.py
needing to copy the glibc source directory.  Its list of files to
touch on checkout to avoid subsequent regeneration (configure,
preconfigure, *-kw.h) is incomplete (missing at least INSTALL,
sysdeps/gnu/errlist.c, posix/testcases.h, posix/ptestcases.h,
locale/C-translit.h, (only regenerated for Hurd builds)
sysdeps/mach/hurd/bits/errno.h) - the existing list may be sufficient
to prevent regeneration that actually changes the file contents
depending on the installed build tools, but not to ensure there is no
regeneration at all - and there might well be other things writing
into the source directory in the course of building and testing (so
needing appropriate testing with read-only source directories with
different timestamp orderings to find and eliminate all such cases).

Tested for x86_64.

2017-12-14  Joseph Myers  <joseph@codesourcery.com>

	[BZ #14121]
	* po/Makefile (%.mo): Change to $(objpfx)%.mo.  Use
	$(make-target-directory).
	($(mo-installed)): Use $(objpfx)%.mo.

diff --git a/po/Makefile b/po/Makefile
index 122db23..d72f652 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -80,11 +80,12 @@ libc.pot.files: FORCE
 
 # Compile the binary message object files from the portable object source
 # files of translations for each language.
-%.mo: %.po
+$(objpfx)%.mo: %.po
+	$(make-target-directory)
 	$(MSGFMT) -o $@ $<
 
 # Install the message object files as libc.po in the language directory.
-$(mo-installed): %.mo $(+force); $(do-install) || exit 0
+$(mo-installed): $(objpfx)%.mo $(+force); $(do-install) || exit 0
 
 .PHONY: linguas linguas.mo
 linguas: $(ALL_LINGUAS:=.po)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Do not build .mo files in source directory (bug 14121)
  2017-12-14 18:14 Do not build .mo files in source directory (bug 14121) Joseph Myers
@ 2017-12-14 18:42 ` Florian Weimer
  2017-12-14 21:47   ` Joseph Myers
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2017-12-14 18:42 UTC (permalink / raw)
  To: Joseph Myers, libc-alpha

On 12/14/2017 07:13 PM, Joseph Myers wrote:
> 2017-12-14  Joseph Myers<joseph@codesourcery.com>
> 
> 	[BZ #14121]
> 	* po/Makefile (%.mo): Change to $(objpfx)%.mo.  Use
> 	$(make-target-directory).
> 	($(mo-installed)): Use $(objpfx)%.mo.

I think the realclean and linguas.mo targets should be changed for 
consistency.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Do not build .mo files in source directory (bug 14121)
  2017-12-14 18:42 ` Florian Weimer
@ 2017-12-14 21:47   ` Joseph Myers
  2017-12-15  9:11     ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2017-12-14 21:47 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

On Thu, 14 Dec 2017, Florian Weimer wrote:

> On 12/14/2017 07:13 PM, Joseph Myers wrote:
> > 2017-12-14  Joseph Myers<joseph@codesourcery.com>
> > 
> > 	[BZ #14121]
> > 	* po/Makefile (%.mo): Change to $(objpfx)%.mo.  Use
> > 	$(make-target-directory).
> > 	($(mo-installed)): Use $(objpfx)%.mo.
> 
> I think the realclean and linguas.mo targets should be changed for
> consistency.

I've sent a patch 
<https://sourceware.org/ml/libc-alpha/2017-12/msg00460.html> that removes 
the linguas.mo rule.  Relative to that, here is an updated version of the 
patch to stop building the files in the source directory, which also 
removes the realclean rule (replacing it with entries in the "generated" 
variable).


Do not build .mo files in source directory (bug 14121).

Building and installing glibc leaves .mo files (compiled message
translations) behind in the source directory.  Building those files in
the source directory may once have made sense, if they were included
in release tarballs; now that release tarballs are just the output of
"git archive", building any non-checked-in files in the source
directory does not make sense.  This patch changes these files to be
built in the build directory instead.  The realclean rule is changed
to simply adding the .mo files to the "generated" variable, since once
the files are in the build directory it make no sense to exclude them
from normal cleanup rules.

This is necessary but not sufficient to avoid build-many-glibcs.py
needing to copy the glibc source directory.  Its list of files to
touch on checkout to avoid subsequent regeneration (configure,
preconfigure, *-kw.h) is incomplete (missing at least INSTALL,
sysdeps/gnu/errlist.c, posix/testcases.h, posix/ptestcases.h,
locale/C-translit.h, (only regenerated for Hurd builds)
sysdeps/mach/hurd/bits/errno.h, (only regenerated for 32-bit SPARC
builds) sysdeps/sparc/sparc32/{sdiv,udiv,rem,urem}.S) - the existing
list may be sufficient to prevent regeneration that actually changes
the file contents depending on the installed build tools, but not to
ensure there is no regeneration at all - and there might well be other
things writing into the source directory in the course of building and
testing (so needing appropriate testing with read-only source
directories with different timestamp orderings to find and eliminate
all such cases).

Tested for x86_64.

2017-12-14  Joseph Myers  <joseph@codesourcery.com>

	[BZ #14121]
	* po/Makefile (generated): Add $(ALL_LINGUAS:%=%.mo).
	(%.mo): Change to $(objpfx)%.mo.  Use $(make-target-directory).
	($(mo-installed)): Use $(objpfx)%.mo.
	(realclean): Remove rule.

diff --git a/po/Makefile b/po/Makefile
index 1fdce17..f811d33 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -44,6 +44,8 @@ mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo
 # Files to install: a $(domainname).mo file for each language.
 install-others = $(LINGUAS:%=$(mo-installed))
 
+generated += $(ALL_LINGUAS:%=%.mo)
+
 
 include ../Rules
 
@@ -80,14 +82,12 @@ libc.pot.files: FORCE
 
 # Compile the binary message object files from the portable object source
 # files of translations for each language.
-%.mo: %.po
+$(objpfx)%.mo: %.po
+	$(make-target-directory)
 	$(MSGFMT) -o $@ $<
 
 # Install the message object files as libc.po in the language directory.
-$(mo-installed): %.mo $(+force); $(do-install) || exit 0
-
-realclean:
-	rm -f $(ALL_LINGUAS:=.mo)
+$(mo-installed): $(objpfx)%.mo $(+force); $(do-install) || exit 0
 \f
 # Update translations from the translation project.
 TRANSLATIONS_URL = https://translationproject.org/latest/libc

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Do not build .mo files in source directory (bug 14121)
  2017-12-14 21:47   ` Joseph Myers
@ 2017-12-15  9:11     ` Florian Weimer
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2017-12-15  9:11 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On 12/14/2017 10:46 PM, Joseph Myers wrote:
> 2017-12-14  Joseph Myers<joseph@codesourcery.com>
> 
> 	[BZ #14121]
> 	* po/Makefile (generated): Add $(ALL_LINGUAS:%=%.mo).
> 	(%.mo): Change to $(objpfx)%.mo.  Use $(make-target-directory).
> 	($(mo-installed)): Use $(objpfx)%.mo.
> 	(realclean): Remove rule.

Looks okay to me.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-15  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14 18:14 Do not build .mo files in source directory (bug 14121) Joseph Myers
2017-12-14 18:42 ` Florian Weimer
2017-12-14 21:47   ` Joseph Myers
2017-12-15  9:11     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).