From 635c64c46041c247976dfd2ab95e2c4bda205ee2 Mon Sep 17 00:00:00 2001
From: Joshua Watt <JPEWhacker@gmail.com>
Date: Sat, 9 Nov 2019 20:01:48 -0600
Subject: [PATCH] Add option to control configure args
Embedding the configure time options into the executable can lead to
non-reproducible builds, since configure options often have embedded
paths. Add a configure time option to control if the configure args are
embedded so this can be disabled.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
configure.ac | 6 ++++++
src/args.c | 6 ++++++
src/textconf.c | 2 ++
3 files changed, 14 insertions(+)
diff --git a/configure.ac b/configure.ac
index 6abe53100..4414484e5 100644
a
|
b
|
dnl Clarify do we really need GModule |
546 | 546 | AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \ |
547 | 547 | test x"$textmode_x11_support" = x"yes" -o x"$enable_aspell" = x"yes"]) |
548 | 548 | |
| 549 | AC_ARG_ENABLE([configure-args], |
| 550 | AS_HELP_STRING([--enable-configure-args], [Handle all compiler warnings as errors])) |
| 551 | if test "x$enable_configure_args" != xno; then |
| 552 | AC_DEFINE([ENABLE_CONFIGURE_ARGS], 1, [Define to enable showing configure arguments in help]) |
| 553 | fi |
| 554 | |
549 | 555 | AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments]) |
550 | 556 | |
551 | 557 | AC_CONFIG_FILES( |
diff --git a/src/args.c b/src/args.c
index baef1a1c8..f8dc24020 100644
a
|
b
|
static gboolean mc_args__nouse_subshell = FALSE; |
95 | 95 | #endif /* ENABLE_SUBSHELL */ |
96 | 96 | static gboolean mc_args__show_datadirs = FALSE; |
97 | 97 | static gboolean mc_args__show_datadirs_extended = FALSE; |
| 98 | #ifdef ENABLE_CONFIGURE_ARGS |
98 | 99 | static gboolean mc_args__show_configure_opts = FALSE; |
| 100 | #endif |
99 | 101 | |
100 | 102 | static GOptionGroup *main_group; |
101 | 103 | |
… |
… |
static const GOptionEntry argument_main_table[] = { |
125 | 127 | NULL |
126 | 128 | }, |
127 | 129 | |
| 130 | #ifdef ENABLE_CONFIGURE_ARGS |
128 | 131 | /* show configure options */ |
129 | 132 | { |
130 | 133 | "configure-options", '\0', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, |
… |
… |
static const GOptionEntry argument_main_table[] = { |
132 | 135 | N_("Print configure options"), |
133 | 136 | NULL |
134 | 137 | }, |
| 138 | #endif |
135 | 139 | |
136 | 140 | { |
137 | 141 | "printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, |
… |
… |
mc_args_show_info (void) |
758 | 762 | return FALSE; |
759 | 763 | } |
760 | 764 | |
| 765 | #ifdef ENABLE_CONFIGURE_ARGS |
761 | 766 | if (mc_args__show_configure_opts) |
762 | 767 | { |
763 | 768 | show_configure_options (); |
764 | 769 | return FALSE; |
765 | 770 | } |
| 771 | #endif |
766 | 772 | |
767 | 773 | return TRUE; |
768 | 774 | } |
diff --git a/src/textconf.c b/src/textconf.c
index 1e0613e58..f39b9e028 100644
a
|
b
|
show_datadirs_extended (void) |
232 | 232 | |
233 | 233 | /* --------------------------------------------------------------------------------------------- */ |
234 | 234 | |
| 235 | #ifdef ENABLE_CONFIGURE_ARGS |
235 | 236 | void |
236 | 237 | show_configure_options (void) |
237 | 238 | { |
238 | 239 | (void) printf ("%s\n", MC_CONFIGURE_ARGS); |
239 | 240 | } |
| 241 | #endif |
240 | 242 | |
241 | 243 | /* --------------------------------------------------------------------------------------------- */ |