1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Add support for reproducible builds.

Suggested by Richard Purdie <richard.purdie@linuxfoundation.org> in
<https://lists.gnu.org/archive/html/bug-gperf/2022-07/msg00000.html>.

* autogen.sh: Import also lib/filename.h.
* Makefile.in (IMPORTED_FILES): Add lib/filename.h.
* src/options.cc: Include filename.h.
(Options::print_options): Print only the base name of the program name.
* tests/*.exp: Update.
This commit is contained in:
Bruno Haible
2022-07-05 07:51:46 +02:00
parent 4a6274f6ca
commit 1862c6e57a
19 changed files with 44 additions and 17 deletions

View File

@@ -26,6 +26,7 @@
#include <string.h> /* declares strcmp() */
#include <ctype.h> /* declares isdigit() */
#include <limits.h> /* defines CHAR_MAX */
#include "filename.h"
#include "getopt.h"
#include "version.h"
@@ -280,6 +281,16 @@ Options::print_options () const
{
const char *arg = _argument_vector[i];
if (i == 0)
{
/* _argument_vector[0] is the program name. Print only its base name.
This is useful for reproducible builds. */
const char *p = arg + strlen (arg);
while (p > arg && ! ISSLASH (p[-1]))
p--;
arg = p;
}
/* Escape arg if it contains shell metacharacters. */
if (*arg == '-')
{