Hello Santiago, Daiki,
> I believe you might have heard about the "reproducible builds" effort:
>
> https://reproducible-builds.org/
Yes. This effort is said to be important for GNU. While some GNU packages
(like emacs or clisp) will have a hard time to achieve this goal, for
GNU gettext it is worth the effort, IMO.
> Would you please reconsider about msgfmt default behaviour?
Yes. And since the industry trend of endianness goes in favour of little-
endian CPUs (even PowerPC and ARM now exist in little-endian flavour),
the default behaviour should be to generate little-endian .mo file.
In 2012, in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=671257,
I wrote "Users of PowerPC systems have the same right to optimized
MO files as users of x86 systems. Therefore I would like to have the
issue solved in Debian's build system." But now the goal is to make
reproducible builds not only possible, but also easy, and this has
higher importance than a few CPU cycles on big-endian PowerPC or ARM.
> This is the patch that the Debian gettext package has for this issue
> since version 0.18.1.1-8 (dated May 2012).
>
> Is there a possibility that we don't need this patch anymore some day?
>
> If adopting the patch "as is" is not possible
Yup. The idea of the patch is good, though. Find here a proposed patch
which includes doc changes.
Bruno
>From 6e7e7c50092414d64a510674a3604a823f0caa02 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Thu, 14 Jan 2016 09:31:48 +0100
Subject: [PATCH] Change msgfmt to produce little-endian .mo files by default.
* gettext-tools/src/msgfmt.c (main): Initialize 'byteswap' so as to
produce little-endian .mo files by default.
* gettext-tools/doc/gettext.texi: Update documentation.
* gettext-tools/doc/msgfmt.texi (--endianness): Likewise.
---
NEWS | 3 +++
gettext-tools/doc/gettext.texi | 4 ++--
gettext-tools/doc/msgfmt.texi | 5 ++---
gettext-tools/src/msgfmt.c | 1 +
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index b9507ed..7ce5505 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+* Support for reproducible builds:
+ - msgfmt now produces little-endian .mo files by default.
+
Version 0.19.7 - December 2015
* Programming languages support:
diff --git a/gettext-tools/doc/gettext.texi b/gettext-tools/doc/gettext.texi
index 204ab38..c87fb72 100644
--- a/gettext-tools/doc/gettext.texi
+++ b/gettext-tools/doc/gettext.texi
@@ -5325,8 +5325,8 @@ which appears below.
@cindex magic signature of MO files
The first two words serve the identification of the file. The magic
number will always signal GNU MO files. The number is stored in the
-byte order of the generating machine, so the magic number really is
-two numbers: @code{0x950412de} and @code{0xde120495}.
+byte order used when the MO file was generated, so the magic number
+really is two numbers: @code{0x950412de} and @code{0xde120495}.
The second word describes the current revision of the file format,
composed of a major and a minor revision number. The revision numbers
diff --git a/gettext-tools/doc/msgfmt.texi b/gettext-tools/doc/msgfmt.texi
index a6fefcd..90350cb 100644
--- a/gettext-tools/doc/msgfmt.texi
+++ b/gettext-tools/doc/msgfmt.texi
@@ -382,14 +382,13 @@ Align strings to @var{number} bytes (default: 1).
@item --endianness=@var{byteorder}
@opindex --endianness@r{, @code{msgfmt} option}
Write out 32-bit numbers in the given byte order. The possible values are
-@code{big} and @code{little}. The default depends on the platform, namely
-on the endianness of the CPU.
+@code{big} and @code{little}. The default is @code{little}.
MO files of any endianness can be used on any platform. When a MO file has
an endianness other than the platform's one, the 32-bit numbers from the MO
file are swapped at runtime. The performance impact is negligible.
-This option can be useful to produce MO files that are independent of the
+This option can be useful to produce MO files that are optimized for one
platform.
@item --no-hash
diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c
index 7b48d21..7055fa0 100644
--- a/gettext-tools/src/msgfmt.c
+++ b/gettext-tools/src/msgfmt.c
@@ -251,6 +251,7 @@ main (int argc, char *argv[])
/* Set default value for global variables. */
alignment = DEFAULT_OUTPUT_ALIGNMENT;
+ byteswap = 0 ^ ENDIANNESS;
/* Set program name for messages. */
set_program_name (argv[0]);
--
2.6.4