aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-04-14 16:31:24 -0700
committerPaul Eggert2019-04-14 17:06:09 -0700
commit5c2f94a182a1154766154040eb5b4b39275fd3b6 (patch)
tree04ae030b12f1e993173fe33b34ea1975ec9340c7 /src
parent661f44946d2bba21d16d718cf86372345c929a39 (diff)
downloademacs-5c2f94a182a1154766154040eb5b4b39275fd3b6.tar.gz
emacs-5c2f94a182a1154766154040eb5b4b39275fd3b6.zip
Replace executable’s fingerprint in place
* admin/merge-gnulib (GNULIB_MODULES): Add memmem-simple. (AVOIDED_MODULES): Add memchr. * configure.ac (HAVE_PDUMPER): AC_SUBST it, too, for use in makefiles. * lib/Makefile.in (libgnu_a_OBJECTS): Add fingerprint.o. * lib/fingerprint.c: New file. * lib/memmem.c, lib/str-two-way.h, m4/memmem.m4: New files, copied from Gnulib. * lib/fingerprint.h: Rename from src/fingerprint.h. * lib-src/make-fingerprint.c: Include limits.h, sys/stat.h, fingerprint.h, intprops.h, min-max.h. (SSIZE_MAX): New macro, if not already defined. (main): Without -r, Replace the fingerprint in the input file instead of generating a fingerprint.c. * lib/Makefile.in (libgnu_a_OBJECTS): Add fingerprint.o. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * src/Makefile.in (HAVE_PDUMPER, MAKE_PDUMPER_FINGERPRINT): New macros. (temacs$(EXEEXT)): Use them to replace the fingerprint instead of precalculating it. (mostlyclean, ctagsfiles1): Do not worry about fingerprint.c.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in30
-rw-r--r--src/fingerprint.h29
2 files changed, 18 insertions, 41 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 2348c8dae4c..3aab5270a4a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -332,6 +332,7 @@ UNEXEC_OBJ = @UNEXEC_OBJ@
332 332
333DUMPING=@DUMPING@ 333DUMPING=@DUMPING@
334CHECK_STRUCTS = @CHECK_STRUCTS@ 334CHECK_STRUCTS = @CHECK_STRUCTS@
335HAVE_PDUMPER = @HAVE_PDUMPER@
335 336
336# 'make' verbosity. 337# 'make' verbosity.
337AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 338AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -627,19 +628,25 @@ LIBEGNU_ARCHIVE = $(lib)/lib$(if $(HYBRID_MALLOC),e)gnu.a
627$(LIBEGNU_ARCHIVE): $(config_h) 628$(LIBEGNU_ARCHIVE): $(config_h)
628 $(MAKE) -C $(dir $@) all 629 $(MAKE) -C $(dir $@) all
629 630
630FINGERPRINTED = $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) 631ifeq ($(HAVE_PDUMPER),yes)
631fingerprint.c: $(FINGERPRINTED) $(libsrc)/make-fingerprint$(EXEEXT) 632 MAKE_PDUMPER_FINGERPRINT = $(libsrc)/make-fingerprint$(EXEEXT)
632 $(AM_V_GEN)$(libsrc)/make-fingerprint$(EXEEXT) $(FINGERPRINTED) >$@.tmp 633else
633 $(AM_V_at)mv $@.tmp $@ 634 MAKE_PDUMPER_FINGERPRINT =
635endif
634 636
635## We have to create $(etc) here because init_cmdargs tests its 637## We have to create $(etc) here because init_cmdargs tests its
636## existence when setting Vinstallation_directory (FIXME?). 638## existence when setting Vinstallation_directory (FIXME?).
637## This goes on to affect various things, and the emacs binary fails 639## This goes on to affect various things, and the emacs binary fails
638## to start if Vinstallation_directory has the wrong value. 640## to start if Vinstallation_directory has the wrong value.
639temacs$(EXEEXT): fingerprint.o $(charsets) $(charscript) 641temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \
640 $(AM_V_CCLD)$(CC) -o $@ $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ 642 $(charsets) $(charscript) $(MAKE_PDUMPER_FINGERPRINT)
641 $(ALLOBJS) fingerprint.o \ 643 $(AM_V_CCLD)$(CC) -o $@.tmp \
642 $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) 644 $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
645 $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
646ifeq ($(HAVE_PDUMPER),yes)
647 $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp
648endif
649 $(AM_V_at)mv $@.tmp $@
643 $(MKDIR_P) $(etc) 650 $(MKDIR_P) $(etc)
644ifeq ($(DUMPING),unexec) 651ifeq ($(DUMPING),unexec)
645 ifneq ($(PAXCTL_notdumped),) 652 ifneq ($(PAXCTL_notdumped),)
@@ -676,7 +683,7 @@ ns-app: emacs$(EXEEXT) $(pdmp)
676 683
677mostlyclean: 684mostlyclean:
678 rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o 685 rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o
679 rm -f dmpstruct.h fingerprint.c 686 rm -f dmpstruct.h
680 rm -f emacs.pdmp 687 rm -f emacs.pdmp
681 rm -f ../etc/DOC 688 rm -f ../etc/DOC
682 rm -f bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp) 689 rm -f bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
@@ -716,10 +723,9 @@ ETAGS = ../lib-src/etags${EXEEXT}
716${ETAGS}: FORCE 723${ETAGS}: FORCE
717 $(MAKE) -C $(dir $@) $(notdir $@) 724 $(MAKE) -C $(dir $@) $(notdir $@)
718 725
719# Remove macuvs.h and fingerprint.c since they'd cause `src/emacs` 726# Remove macuvs.h since it'd cause `src/emacs`
720# to be built before we can get TAGS. 727# to be built before we can get TAGS.
721ctagsfiles1 = $(filter-out ${srcdir}/macuvs.h ${srcdir}/fingerprint.c, \ 728ctagsfiles1 = $(filter-out ${srcdir}/macuvs.h, $(wildcard ${srcdir}/*.[hc]))
722 $(wildcard ${srcdir}/*.[hc]))
723ctagsfiles2 = $(wildcard ${srcdir}/*.m) 729ctagsfiles2 = $(wildcard ${srcdir}/*.m)
724 730
725## In out-of-tree builds, TAGS are generated in the build dir, like 731## In out-of-tree builds, TAGS are generated in the build dir, like
diff --git a/src/fingerprint.h b/src/fingerprint.h
deleted file mode 100644
index 0b195fd0ca7..00000000000
--- a/src/fingerprint.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* Header file for the Emacs build fingerprint.
2
3Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or (at
10your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef EMACS_FINGERPRINT_H
21#define EMACS_FINGERPRINT_H
22
23/* We generate fingerprint.c and fingerprint.o from all the sources in
24 Emacs. This way, we have a unique value that we can use to pair
25 data files (like a portable dump image) with a specific build of
26 Emacs. */
27extern unsigned char const fingerprint[32];
28
29#endif