aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-03-02 10:21:45 -0800
committerPaul Eggert2016-03-02 10:24:11 -0800
commit65f692658e81c940df8b3b315be873840dcef92b (patch)
tree6a1b68cef01af388264cc691ab8bf7ec3daa9cbe
parentd5a18a93270bfc8c36e40910f8520b3738a91f43 (diff)
downloademacs-65f692658e81c940df8b3b315be873840dcef92b.tar.gz
emacs-65f692658e81c940df8b3b315be873840dcef92b.zip
Deterministic build improvements
* configure.ac (BUILD_DETAILS): Rename from DETERMINISTIC_DUMP, and negate its sense. Use it via AC_SUBST, not AC_DEFINE, and have its value be either empty or --no-build-details. All uses changed. Change option to --disable-build-details. * doc/lispref/cmdargs.texi (Initial Options): Document --no-build-details. * doc/lispref/internals.texi (Building Emacs): * etc/NEWS: Document --disable-build-details. * doc/lispref/intro.texi (Version Info): Say that emacs-build-time can be nil. * lisp/erc/erc-compat.el (erc-emacs-build-time): Now nil if details are omitted. * lisp/erc/erc.el (erc-cmd-SV): * lisp/version.el (emacs-build-time): Now nil if no build details. (emacs-version): Output build time only if build details. * src/Makefile.in (BUILD_DETAILS): New macro. (temacs, bootstrap-emacs): Use it. * src/emacs.c (build_details): New var. (standard_args, main): Support --no-build-details. (Vdeterministic_dump): Remove; all uses replaced by !build_details. (syms_of_emacs): Set Vbuild_details to a boolean, not to a Lisp_Object. * src/lisp.h (build_details): New decl. * src/sysdep.c (init_system_name): When !build_details, set system-name to nil, not to "elided".
-rw-r--r--configure.ac19
-rw-r--r--doc/emacs/cmdargs.texi7
-rw-r--r--doc/lispref/internals.texi10
-rw-r--r--doc/lispref/intro.texi3
-rw-r--r--etc/NEWS9
-rw-r--r--lisp/erc/erc-compat.el5
-rw-r--r--lisp/erc/erc.el6
-rw-r--r--lisp/version.el24
-rw-r--r--src/Makefile.in7
-rw-r--r--src/emacs.c18
-rw-r--r--src/lisp.h3
-rw-r--r--src/sysdep.c7
12 files changed, 73 insertions, 45 deletions
diff --git a/configure.ac b/configure.ac
index ad90ce8b6cc..0de6736aee1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,18 +546,13 @@ AC_ARG_ENABLE(gtk-deprecation-warnings,
546 [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])], 546 [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
547[ac_enable_gtk_deprecation_warnings="${enableval}"],[]) 547[ac_enable_gtk_deprecation_warnings="${enableval}"],[])
548 548
549AC_ARG_ENABLE(deterministic-dump, 549BUILD_DETAILS=
550[AS_HELP_STRING([--enable-deterministic-dump], 550AC_ARG_ENABLE([build-details],
551 [Make dumping deterministic by removing system-specific 551 [AS_HELP_STRING([--disable-build-details],
552 information from the dump, such as host names and 552 [Make the build more deterministic by omitting host
553 timestamps.])]) 553 names, time stamps, etc. from the output.])],
554if test "x${enableval}" = xno ; then 554 [test "$enableval" = no && BUILD_DETAILS=--no-build-details])
555 AC_DEFINE(DETERMINISTIC_DUMP, false, 555AC_SUBST([BUILD_DETAILS])
556 [Set this to true to make dumping deterministic.])
557else
558 AC_DEFINE(DETERMINISTIC_DUMP, true,
559 [Set this to true to make dumping deterministic.])
560fi
561 556
562dnl This used to use changequote, but, apart from 'changequote is evil' 557dnl This used to use changequote, but, apart from 'changequote is evil'
563dnl per the autoconf manual, we can speed up autoconf somewhat by quoting 558dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index a842cb84abd..646c8da1bb8 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -283,6 +283,13 @@ which will invoke Emacs with @samp{--script} and supply the name of
283the script file as @var{file}. Emacs Lisp then treats the @samp{#!} 283the script file as @var{file}. Emacs Lisp then treats the @samp{#!}
284on this first line as a comment delimiter. 284on this first line as a comment delimiter.
285 285
286@item --no-build-details
287@opindex --no-build-details
288@cindex build details
289@cindex deterministic build
290Omit details like system name and build time from the Emacs executable,
291so that builds are more deterministic.
292
286@item -q 293@item -q
287@opindex -q 294@opindex -q
288@itemx --no-init-file 295@itemx --no-init-file
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 41064df5a28..fedef3d7f46 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -66,6 +66,16 @@ into the dumped Emacs. If you port Emacs to a new operating system,
66and are not able to implement dumping, then Emacs must load 66and are not able to implement dumping, then Emacs must load
67@file{loadup.el} each time it starts. 67@file{loadup.el} each time it starts.
68 68
69@cindex build details
70@cindex deterministic build
71@cindex @option{--disable-build-details} option to @command{configure}
72 By default the dumped @file{emacs} executable records details such
73as the build time and host name. Use the
74@option{--disable-build-details} option of @command{configure} to
75suppress these details, so that building and installing Emacs twice
76from the same sources is more likely to result in identical copies of
77Emacs.
78
69@cindex @file{site-load.el} 79@cindex @file{site-load.el}
70 You can specify additional files to preload by writing a library named 80 You can specify additional files to preload by writing a library named
71@file{site-load.el} that loads them. You may need to rebuild Emacs 81@file{site-load.el} that loads them. You may need to rebuild Emacs
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index 0f42d4d8a7f..2f84aeee39e 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -494,7 +494,8 @@ giving a prefix argument makes @var{here} non-@code{nil}.
494@defvar emacs-build-time 494@defvar emacs-build-time
495The value of this variable indicates the time at which Emacs was 495The value of this variable indicates the time at which Emacs was
496built. It is a list of four integers, like the value of 496built. It is a list of four integers, like the value of
497@code{current-time} (@pxref{Time of Day}). 497@code{current-time} (@pxref{Time of Day}), or is @code{nil}
498if the information is not available.
498 499
499@example 500@example
500@group 501@group
diff --git a/etc/NEWS b/etc/NEWS
index a9ce2653035..cf09350d173 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -25,6 +25,15 @@ otherwise leave it unmarked.
25 25
26* Installation Changes in Emacs 25.2 26* Installation Changes in Emacs 25.2
27 27
28+++
29** New configure option ‘--disable-build-details’ attempts to build an
30Emacs that is more likely to be reproducible; that is, if you build
31and install Emacs twice, the second Emacs is a copy of the first.
32Deterministic builds omit the build date from the output of the
33emacs-version and erc-cmd-SV functions, and the leave the following
34variables nil: emacs-build-system, emacs-build-time,
35erc-emacs-build-time.
36
28 37
29* Startup Changes in Emacs 25.2 38* Startup Changes in Emacs 25.2
30 39
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index 5e03d30bf94..e5e63092df3 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -54,10 +54,10 @@ See `erc-encoding-coding-alist'."
54 (set (make-local-variable 'write-file-functions) new-val)) 54 (set (make-local-variable 'write-file-functions) new-val))
55 55
56(defvar erc-emacs-build-time 56(defvar erc-emacs-build-time
57 (if (stringp emacs-build-time) 57 (if (or (stringp emacs-build-time) (not emacs-build-time))
58 emacs-build-time 58 emacs-build-time
59 (format-time-string "%Y-%m-%d" emacs-build-time)) 59 (format-time-string "%Y-%m-%d" emacs-build-time))
60 "Time at which Emacs was dumped out.") 60 "Time at which Emacs was dumped out, or nil if not available.")
61 61
62;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs 62;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs
63;; has user-init-directory. 63;; has user-init-directory.
@@ -164,4 +164,3 @@ If START or END is negative, it counts from the end."
164;; indent-tabs-mode: t 164;; indent-tabs-mode: t
165;; tab-width: 8 165;; tab-width: 8
166;; End: 166;; End:
167
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 68460d15c4e..52adec1ce46 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3581,7 +3581,7 @@ the message given by REASON."
3581 3581
3582(defun erc-cmd-SV () 3582(defun erc-cmd-SV ()
3583 "Say the current ERC and Emacs version into channel." 3583 "Say the current ERC and Emacs version into channel."
3584 (erc-send-message (format "I'm using ERC with %s %s (%s%s) of %s." 3584 (erc-send-message (format "I'm using ERC with %s %s (%s%s)%s."
3585 (if (featurep 'xemacs) "XEmacs" "GNU Emacs") 3585 (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
3586 emacs-version 3586 emacs-version
3587 system-configuration 3587 system-configuration
@@ -3602,7 +3602,9 @@ the message given by REASON."
3602 x-toolkit-scroll-bars))) 3602 x-toolkit-scroll-bars)))
3603 "") 3603 "")
3604 (if (featurep 'multi-tty) ", multi-tty" "")) 3604 (if (featurep 'multi-tty) ", multi-tty" ""))
3605 erc-emacs-build-time)) 3605 (if erc-emacs-build-time
3606 (concat " of " erc-emacs-build-time)
3607 "")))
3606 t) 3608 t)
3607 3609
3608(defun erc-cmd-SM () 3610(defun erc-cmd-SM ()
diff --git a/lisp/version.el b/lisp/version.el
index ba24964bd25..dc228870d1e 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -38,14 +38,11 @@ This variable first existed in version 19.23.")
38 "Minor version number of this version of Emacs. 38 "Minor version number of this version of Emacs.
39This variable first existed in version 19.23.") 39This variable first existed in version 19.23.")
40 40
41;; FIXME: The next variable should also be a constant if 41(defconst emacs-build-system (system-name)
42;; `deterministic-dump' is t. 42 "Name of the system on which Emacs was built, or nil if not available.")
43(defconst emacs-build-time (current-time)
44 "Time at which Emacs was dumped out.")
45 43
46(defconst emacs-build-system 44(defconst emacs-build-time (if emacs-build-system (current-time))
47 (if deterministic-dump "elided" (system-name)) 45 "Time at which Emacs was dumped out, or nil if not available.")
48 "Name of the system on which Emacs was built.")
49 46
50(defvar motif-version-string) 47(defvar motif-version-string)
51(defvar gtk-version-string) 48(defvar gtk-version-string)
@@ -59,9 +56,7 @@ Don't use this function in programs to choose actions according
59to the system configuration; look at `system-configuration' instead." 56to the system configuration; look at `system-configuration' instead."
60 (interactive "P") 57 (interactive "P")
61 (let ((version-string 58 (let ((version-string
62 (format (if (not (called-interactively-p 'interactive)) 59 (format "GNU Emacs %s (%s%s%s%s)%s"
63 "GNU Emacs %s (%s%s%s%s)\n of %s"
64 "GNU Emacs %s (%s%s%s%s) of %s")
65 emacs-version 60 emacs-version
66 system-configuration 61 system-configuration
67 (cond ((featurep 'motif) 62 (cond ((featurep 'motif)
@@ -80,7 +75,14 @@ to the system configuration; look at `system-configuration' instead."
80 (format ", %s scroll bars" 75 (format ", %s scroll bars"
81 (capitalize (symbol-name x-toolkit-scroll-bars))) 76 (capitalize (symbol-name x-toolkit-scroll-bars)))
82 "") 77 "")
83 (format-time-string "%Y-%m-%d" emacs-build-time)))) 78 (if emacs-build-time
79 (format-time-string (concat
80 (if (called-interactively-p
81 'interactive)
82 "" "\n")
83 " of %Y-%m-%d")
84 emacs-build-time)
85 ""))))
84 (if here 86 (if here
85 (insert version-string) 87 (insert version-string)
86 (if (called-interactively-p 'interactive) 88 (if (called-interactively-p 'interactive)
diff --git a/src/Makefile.in b/src/Makefile.in
index 8dcaf7e4759..c290a6082da 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -313,6 +313,9 @@ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
313 313
314RUN_TEMACS = ./temacs 314RUN_TEMACS = ./temacs
315 315
316# Whether builds should contain details. '--no-build-details' or empty.
317BUILD_DETAILS = @BUILD_DETAILS@
318
316UNEXEC_OBJ = @UNEXEC_OBJ@ 319UNEXEC_OBJ = @UNEXEC_OBJ@
317 320
318CANNOT_DUMP=@CANNOT_DUMP@ 321CANNOT_DUMP=@CANNOT_DUMP@
@@ -534,7 +537,7 @@ emacs$(EXEEXT): temacs$(EXEEXT) \
534ifeq ($(CANNOT_DUMP),yes) 537ifeq ($(CANNOT_DUMP),yes)
535 ln -f temacs$(EXEEXT) $@ 538 ln -f temacs$(EXEEXT) $@
536else 539else
537 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump 540 LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump
538 $(PAXCTL_if_present) -zex $@ 541 $(PAXCTL_if_present) -zex $@
539 ln -f $@ bootstrap-emacs$(EXEEXT) 542 ln -f $@ bootstrap-emacs$(EXEEXT)
540endif 543endif
@@ -740,7 +743,7 @@ bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
740ifeq ($(CANNOT_DUMP),yes) 743ifeq ($(CANNOT_DUMP),yes)
741 ln -f temacs$(EXEEXT) $@ 744 ln -f temacs$(EXEEXT) $@
742else 745else
743 $(RUN_TEMACS) --batch --load loadup bootstrap 746 $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap
744 $(PAXCTL_if_present) -zex emacs$(EXEEXT) 747 $(PAXCTL_if_present) -zex emacs$(EXEEXT)
745 mv -f emacs$(EXEEXT) $@ 748 mv -f emacs$(EXEEXT) $@
746endif 749endif
diff --git a/src/emacs.c b/src/emacs.c
index e7cb4ea4aaa..a381da4fb8f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -181,6 +181,9 @@ bool noninteractive;
181/* True means remove site-lisp directories from load-path. */ 181/* True means remove site-lisp directories from load-path. */
182bool no_site_lisp; 182bool no_site_lisp;
183 183
184/* True means put details like time stamps into builds. */
185bool build_details;
186
184/* Name for the server started by the daemon.*/ 187/* Name for the server started by the daemon.*/
185static char *daemon_name; 188static char *daemon_name;
186 189
@@ -222,6 +225,7 @@ Initialization options:\n\
222--display, -d DISPLAY use X server DISPLAY\n\ 225--display, -d DISPLAY use X server DISPLAY\n\
223", 226",
224 "\ 227 "\
228--no-build-details do not add build details such as time stamps\n\
225--no-desktop do not load a saved desktop\n\ 229--no-desktop do not load a saved desktop\n\
226--no-init-file, -q load neither ~/.emacs nor default.el\n\ 230--no-init-file, -q load neither ~/.emacs nor default.el\n\
227--no-loadup, -nl do not load loadup.el into bare Emacs\n\ 231--no-loadup, -nl do not load loadup.el into bare Emacs\n\
@@ -872,9 +876,6 @@ main (int argc, char **argv)
872 SET_BINARY (fileno (stdout)); 876 SET_BINARY (fileno (stdout));
873#endif /* MSDOS */ 877#endif /* MSDOS */
874 878
875 if (DETERMINISTIC_DUMP)
876 Vdeterministic_dump = Qt;
877
878 /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case. 879 /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case.
879 The build procedure uses this while dumping, to ensure that the 880 The build procedure uses this while dumping, to ensure that the
880 dumped Emacs does not have its system locale tables initialized, 881 dumped Emacs does not have its system locale tables initialized,
@@ -1192,6 +1193,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1192 no_site_lisp 1193 no_site_lisp
1193 = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args); 1194 = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args);
1194 1195
1196 build_details = ! argmatch (argv, argc, "-no-build-details",
1197 "--no-build-details", 7, NULL, &skip_args);
1198
1195#ifdef HAVE_NS 1199#ifdef HAVE_NS
1196 ns_pool = ns_alloc_autorelease_pool (); 1200 ns_pool = ns_alloc_autorelease_pool ();
1197#ifdef NS_IMPL_GNUSTEP 1201#ifdef NS_IMPL_GNUSTEP
@@ -1641,6 +1645,7 @@ static const struct standard_args standard_args[] =
1641 { "-help", "--help", 90, 0 }, 1645 { "-help", "--help", 90, 0 },
1642 { "-nl", "--no-loadup", 70, 0 }, 1646 { "-nl", "--no-loadup", 70, 0 },
1643 { "-nsl", "--no-site-lisp", 65, 0 }, 1647 { "-nsl", "--no-site-lisp", 65, 0 },
1648 { "-no-build-details", "--no-build-details", 63, 0 },
1644 /* -d must come last before the options handled in startup.el. */ 1649 /* -d must come last before the options handled in startup.el. */
1645 { "-d", "--display", 60, 1 }, 1650 { "-d", "--display", 60, 1 },
1646 { "-display", 0, 60, 1 }, 1651 { "-display", 0, 60, 1 },
@@ -2535,13 +2540,6 @@ libraries; only those already known by Emacs will be loaded. */);
2535 Vdynamic_library_alist = Qnil; 2540 Vdynamic_library_alist = Qnil;
2536 Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt); 2541 Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt);
2537 2542
2538 DEFVAR_BOOL ("deterministic-dump", Vdeterministic_dump,
2539 doc: /* If non-nil, attempt to make dumping deterministic by
2540avoiding sources of nondeterminism such as absolute file names, the
2541hostname, or timestamps. */);
2542 Vdeterministic_dump = DETERMINISTIC_DUMP ? Qt : Qnil;
2543 XSYMBOL (intern_c_string ("deterministic-dump"))->constant = 1;
2544
2545#ifdef WINDOWSNT 2543#ifdef WINDOWSNT
2546 Vlibrary_cache = Qnil; 2544 Vlibrary_cache = Qnil;
2547 staticpro (&Vlibrary_cache); 2545 staticpro (&Vlibrary_cache);
diff --git a/src/lisp.h b/src/lisp.h
index 18d986441f0..9c7955e2bc4 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4132,6 +4132,9 @@ extern bool noninteractive;
4132/* True means remove site-lisp directories from load-path. */ 4132/* True means remove site-lisp directories from load-path. */
4133extern bool no_site_lisp; 4133extern bool no_site_lisp;
4134 4134
4135/* True means put details like time stamps into builds. */
4136extern bool build_details;
4137
4135/* Pipe used to send exit notification to the daemon parent at 4138/* Pipe used to send exit notification to the daemon parent at
4136 startup. On Windows, we use a kernel event instead. */ 4139 startup. On Windows, we use a kernel event instead. */
4137#ifndef WINDOWSNT 4140#ifndef WINDOWSNT
diff --git a/src/sysdep.c b/src/sysdep.c
index b01c64d52ac..a01bf1d7c10 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1408,11 +1408,10 @@ setup_pty (int fd)
1408void 1408void
1409init_system_name (void) 1409init_system_name (void)
1410{ 1410{
1411 if (DETERMINISTIC_DUMP && (might_dump || ! NILP (Vpurify_flag))) 1411 if (!build_details)
1412 { 1412 {
1413 /* If we're dumping, set the hostname to a literal so that the 1413 /* Set system-name to nil so that the build is deterministic. */
1414 dump is deterministic. */ 1414 Vsystem_name = Qnil;
1415 Vsystem_name = build_pure_c_string ("elided");
1416 return; 1415 return;
1417 } 1416 }
1418 char *hostname_alloc = NULL; 1417 char *hostname_alloc = NULL;