syslinux/syslinux-4.04-reproducible.patch

225 lines
8.3 KiB
Diff

commit be645d7a9848847388a662f6c0f7571d52ed7a05
Author: Philippe Coval <philippe.coval@open.eurogiciel.org>
Date: Wed Dec 17 16:46:29 2014 -0500
build: sort sources to build in a more deterministic way
It has been observed that binaries contents
are depending on the order of linked objects.
This order is caused by GNU make's wildcard function
and the position of sources on filesystem.
This change tries to prevent this kind of randomness.
Also consider building using -j1 flag
to make it even more reproductible.
Change-Id: Ie8eee7f336e6f1fa2863c4150d967afd15519f1d
Bug: http://bugzilla.syslinux.org/show_bug.cgi?id=57#related
Signed-off-by: Philippe Coval <philippe.coval at open.eurogiciel.org>
Index: syslinux-4.04/com32/cmenu/Makefile
===================================================================
--- syslinux-4.04.orig/com32/cmenu/Makefile
+++ syslinux-4.04/com32/cmenu/Makefile
@@ -28,7 +28,7 @@ CFLAGS += -I./libmenu
LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
-CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
+CMENUS = $(sort $(patsubst %.c,%.c32,$(wildcard *.c)))
IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
MENUS = $(CMENUS) $(IMENUS)
@@ -56,7 +56,7 @@ clean: tidy menuclean libclean
rm -f *.lss *.c32 *.com
menuclean:
- rm -f $(patsubst %.menu,%.c,$(wildcard *.menu))
+ rm -f $(patsubst %.menu,%.c,$(sort $(wildcard *.menu)))
spotless: clean libclean menuclean
rm -f *~ \#*
Index: syslinux-4.04/com32/rosh/Makefile
===================================================================
--- syslinux-4.04.orig/com32/rosh/Makefile
+++ syslinux-4.04/com32/rosh/Makefile
@@ -24,7 +24,7 @@ include MCONFIG
# official release. Otherwise, substitute a hex string that is pretty much
# guaranteed to be unique to be unique from build to build.
ifndef HEXDATE
-HEXDATE := $(shell $(PERL) $(topdir)/now.pl $(SRCS) $(wildcard *.h))
+HEXDATE := $(shell $(PERL) $(topdir)/now.pl $(SRCS) $(sort $(wildcard *.h)))
endif
ifndef DATE
DATE := $(shell sh $(topdir)/gen-id.sh $(VERSION) $(HEXDATE))
Index: syslinux-4.04/core/Makefile
===================================================================
--- syslinux-4.04.orig/core/Makefile
+++ syslinux-4.04/core/Makefile
@@ -37,10 +37,10 @@ BTARGET = kwdhash.gen \
isolinux.bin isolinux-debug.bin pxelinux.0
# All primary source files for the main syslinux files
-NASMSRC := $(wildcard *.asm)
-NASMHDR := $(wildcard *.inc)
-CSRC := $(wildcard *.c */*.c */*/*.c)
-SSRC := $(wildcard *.S */*.S */*/*.S)
+NASMSRC := $(sort $(wildcard *.asm))
+NASMHDR := $(sort $(wildcard *.inc))
+CSRC := $(sort $(wildcard *.c */*.c */*/*.c))
+SSRC := $(sort $(wildcard *.S */*.S */*/*.S))
CHDR := $(wildcard *.h)
OTHERSRC := keywords
ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
Index: syslinux-4.04/gpxe/src/Makefile.housekeeping
===================================================================
--- syslinux-4.04.orig/gpxe/src/Makefile.housekeeping
+++ syslinux-4.04/gpxe/src/Makefile.housekeeping
@@ -246,9 +246,9 @@ endif
#
# BIN has the form bin[-[arch-]platform]
-ARCHS := $(patsubst arch/%,%,$(wildcard arch/*))
+ARCHS := $(patsubst arch/%,%,$(sort $(wildcard arch/*)))
PLATFORMS := $(patsubst config/defaults/%.h,%,\
- $(wildcard config/defaults/*.h))
+ $(sort $(wildcard config/defaults/*.h)))
archs :
@$(ECHO) $(ARCHS)
@@ -307,8 +307,8 @@ srcdirs :
# SRCS lists all .c or .S files found in any SRCDIR
#
-SRCS += $(wildcard $(patsubst %,%/*.c,$(SRCDIRS)))
-SRCS += $(wildcard $(patsubst %,%/*.S,$(SRCDIRS)))
+SRCS += $(sort $(wildcard $(patsubst %,%/*.c,$(SRCDIRS))))
+SRCS += $(sort $(wildcard $(patsubst %,%/*.S,$(SRCDIRS))))
srcs :
@$(ECHO) $(SRCS)
@@ -677,7 +677,7 @@ endef
$(BIN)/%.objs : $(BIN)/%.tmp
$(Q)$(ECHO) $(call objs_list,$<)
$(BIN)/%.sizes : $(BIN)/%.tmp
- $(Q)$(SIZE) -t $(foreach OBJ,$(call objs_list,$<),$(wildcard $(BIN)/$(subst _,?,$(OBJ)).o)) | \
+ $(Q)$(SIZE) -t $(foreach OBJ,$(call objs_list,$<),$(sort $(wildcard $(BIN)/$(subst _,?,$(OBJ)).o))) | \
sort -g
# Get dependency list for the specified target
@@ -807,7 +807,7 @@ $(BIN)/%.o : payload/%.img
$(Q)$(LD) -b binary -r -o $@ $< --undefined obj_payload \
--defsym obj_$*=0
-BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img))
+BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(sort $(wildcard payload/*.img)))
# The "allXXXs" targets for each suffix
#
Index: syslinux-4.04/lzo/Makefile
===================================================================
--- syslinux-4.04.orig/lzo/Makefile
+++ syslinux-4.04/lzo/Makefile
@@ -15,7 +15,7 @@ include $(topdir)/MCONFIG.build
INCLUDES += -I./include
-LIBOBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
+LIBOBJS = $(sort $(patsubst %.c,%.o,$(wildcard src/*.c)))
LIB = lzo.a
BINS = prepcore
Index: syslinux-4.04/mtools/Makefile
===================================================================
--- syslinux-4.04.orig/mtools/Makefile
+++ syslinux-4.04/mtools/Makefile
@@ -13,7 +13,7 @@ SRCS = syslinux.c \
../libinstaller/setadv.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
- $(wildcard ../libfat/*.c)
+ $(sort $(wildcard ../libfat/*.c))
OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
.SUFFIXES: .c .o .i .s .S
Index: syslinux-4.04/com32/gpllib/Makefile
===================================================================
--- syslinux-4.04.orig/com32/gpllib/Makefile
+++ syslinux-4.04/com32/gpllib/Makefile
@@ -9,7 +9,7 @@ include ../lib/MCONFIG
REQFLAGS += -I../gplinclude
GPLDIRS := . disk dmi vpd acpi
-LIBOBJS := $(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+LIBOBJS := $(sort $(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c))))
BINDIR = /usr/bin
LIBDIR = /usr/lib
Index: syslinux-4.04/com32/hdt/Makefile
===================================================================
--- syslinux-4.04.orig/com32/hdt/Makefile
+++ syslinux-4.04/com32/hdt/Makefile
@@ -25,7 +25,7 @@ CFLAGS += -I$(com32)/cmenu/libmenu
MODULES = hdt.c32
TESTFILES =
-OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
+OBJS = $(sort $(patsubst %.c,%.o,$(wildcard *.c)))
VERSION = $(shell $(SED) -n 's/\#define VERSION \"\(.*\)\"/\1/p' hdt.h)
CODENAME = $(shell $(SED) -n 's/\#define CODENAME \"\(.*\)\"/\1/p' hdt.h)
VERSION_C32 = $(shell echo $(VERSION) | $(SED) -e 's/-/_/g' | $(SED) -e 's/\./_/g')
Index: syslinux-4.04/com32/sysdump/Makefile
===================================================================
--- syslinux-4.04.orig/com32/sysdump/Makefile
+++ syslinux-4.04/com32/sysdump/Makefile
@@ -25,7 +25,7 @@ LNXLIBS = ../libutil/libutil_lnx.a
MODULES = sysdump.c32
TESTFILES =
-SRCS = $(wildcard *.c)
+SRCS = $(sort $(wildcard *.c))
OBJS = $(patsubst %.c,%.o,$(SRCS))
# The DATE is set on the make command line when building binaries for
Index: syslinux-4.04/memdisk/Makefile
===================================================================
--- syslinux-4.04.orig/memdisk/Makefile
+++ syslinux-4.04/memdisk/Makefile
@@ -23,7 +23,7 @@ NASMOPT = -O9999
NFLAGS = -dDATE='"$(DATE)"'
NINCLUDE =
-SRCS = $(wildcard *.asm *.c *.h)
+SRCS = $(sort $(wildcard *.asm *.c *.h))
# The DATE is set on the make command line when building binaries for
# official release. Otherwise, substitute a hex string that is pretty much
Index: syslinux-4.04/win32/Makefile
===================================================================
--- syslinux-4.04.orig/win32/Makefile
+++ syslinux-4.04/win32/Makefile
@@ -57,7 +57,7 @@ LIBSRC = ../libinstaller/fat.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
- $(wildcard ../libfat/*.c)
+ $(sort $(wildcard ../libfat/*.c))
LIBOBJS = $(patsubst %.c,%.obj,$(notdir $(LIBSRC)))
LIB = syslinux.lib
Index: syslinux-4.04/win64/Makefile
===================================================================
--- syslinux-4.04.orig/win64/Makefile
+++ syslinux-4.04/win64/Makefile
@@ -47,7 +47,7 @@ LIBSRC = ../libinstaller/fat.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
- $(wildcard ../libfat/*.c)
+ $(sort $(wildcard ../libfat/*.c))
LIBOBJS = $(patsubst %.c,%.obj,$(notdir $(LIBSRC)))
LIB = syslinux.lib