Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorTorbjörn Svensson2020-08-21 13:33:46 +0000
committerJonah Graham2020-08-27 19:42:44 +0000
commit07b50ba2a269bb799d05e69a24b7fa257673a74e (patch)
treef6d98c7d74b1be13ecb667e531d28b95e084c5f8 /native
parent2f05a6348e6a84f321a38d91b02a723c64cf8317 (diff)
downloadorg.eclipse.cdt-07b50ba2a269bb799d05e69a24b7fa257673a74e.tar.gz
org.eclipse.cdt-07b50ba2a269bb799d05e69a24b7fa257673a74e.tar.xz
org.eclipse.cdt-07b50ba2a269bb799d05e69a24b7fa257673a74e.zip
Bug 521515: Do not rely on commit date for reproducible builds
As mentioned in https://devblogs.microsoft.com/oldnewthing/20180103-00/?p=97705, Microsoft has stopped using the _IMAGE_FILE_HEADER.TimeDateStamp as a time stamp and rather as a hash of the source files to make the build result predictable. Change-Id: I4f4a7b9557330e4c478ef7fb25653144c5b2d4ad Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
Diffstat (limited to 'native')
-rw-r--r--native/org.eclipse.cdt.native.serial/native_src/Makefile28
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dllbin381152 -> 381152 bytes
2 files changed, 15 insertions, 13 deletions
diff --git a/native/org.eclipse.cdt.native.serial/native_src/Makefile b/native/org.eclipse.cdt.native.serial/native_src/Makefile
index 77965b18143..f4703b63a81 100644
--- a/native/org.eclipse.cdt.native.serial/native_src/Makefile
+++ b/native/org.eclipse.cdt.native.serial/native_src/Makefile
@@ -17,6 +17,8 @@ ifeq ($(JAVA_HOME),)
$(error Please define JAVA_HOME)
endif
+REPRODUCIBLE_BUILD_WRAPPER := $(shell git rev-parse --show-toplevel)/releng/scripts/reproducible_build_wrapper.py
+
OS_DIR = ../os
CFLAGS += -fPIC -D_REENTRANT
@@ -47,25 +49,25 @@ rebuild: clean all
# Windows DLLs have a build timestamp in them. This makes it impossible to have reproducible builds.
# However, x86_64-w64-mingw32-ld on Debian/Ubuntu has a patch that overrides the current date
-# using the SOURCE_DATE_EPOCH environment variable. Therefore we set SOURCE_DATE_EPOCH to a
-# consistent timestamp that can be reproduced. We base it off of the commit timestamp of the
-# most recent git commit in this directory.
+# using the SOURCE_DATE_EPOCH environment variable. Call REPRODUCIBLE_BUILD_WRAPPER to make sure the
+# same binary is produced for the same source each time.
$(OS_DIR)/win32/x86_64/serial.dll: serial.c
- mkdir -p $(dir $@)
- SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=format:%ct -- .) x86_64-w64-mingw32-gcc -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ serial.c
+ mkdir -p $(dir $@) && \
+ $(REPRODUCIBLE_BUILD_WRAPPER) \
+ x86_64-w64-mingw32-gcc -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ $^
$(OS_DIR)/linux/x86_64/libserial.so: serial.c
- mkdir -p $(dir $@)
- gcc -m64 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
+ mkdir -p $(dir $@) && \
+ gcc -m64 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
$(OS_DIR)/linux/aarch64/libserial.so: serial.c
- mkdir -p $(dir $@)
- aarch64-linux-gnu-gcc $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
+ mkdir -p $(dir $@) && \
+ aarch64-linux-gnu-gcc $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
$(OS_DIR)/linux/ppc64le/libserial.so: serial.c
- mkdir -p $(dir $@)
- gcc -m64 -mcpu=power8 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
+ mkdir -p $(dir $@) && \
+ gcc -m64 -mcpu=power8 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
$(OS_DIR)/macosx/x86_64/libserial.jnilib: serial.c
- mkdir -p $(dir $@)
- x86_64-apple-darwin17-clang $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ serial.c
+ mkdir -p $(dir $@) && \
+ x86_64-apple-darwin17-clang $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ $^
diff --git a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
index 8e377a4dbcf..8383c853b8a 100755
--- a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
+++ b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
Binary files differ

Back to the top