mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-03 21:45:51 +08:00
Cygwin: Add initial support for SOURCE_DATE_EPOCH
If specified, set version timestamp to this value. Enable deterministic archives for ar and ranlib. Set cygwin1.dll PE and export table header timestamps to zero. Signed-off-by: Christian Franke <christian.franke@t-online.de>
This commit is contained in:
parent
5bbe0e56c6
commit
f5e37b93a0
@ -572,6 +572,10 @@ toollib_DATA = \
|
|||||||
libgmon_a_SOURCES = $(GMON_FILES)
|
libgmon_a_SOURCES = $(GMON_FILES)
|
||||||
libgmon_a_LIBADD =
|
libgmon_a_LIBADD =
|
||||||
|
|
||||||
|
# Enable deterministic archives for reproducible builds.
|
||||||
|
ARFLAGS = cr$${SOURCE_DATE_EPOCH:+D}
|
||||||
|
override RANLIB := $(RANLIB)$${SOURCE_DATE_EPOCH:+ -D}
|
||||||
|
|
||||||
# cygserver library
|
# cygserver library
|
||||||
cygserver_blddir = ${target_builddir}/winsup/cygserver
|
cygserver_blddir = ${target_builddir}/winsup/cygserver
|
||||||
LIBSERVER = $(cygserver_blddir)/libcygserver.a
|
LIBSERVER = $(cygserver_blddir)/libcygserver.a
|
||||||
@ -589,12 +593,14 @@ $(LDSCRIPT): $(LDSCRIPT).in
|
|||||||
$(AM_V_GEN)$(CC) -E - -P < $^ -o $@
|
$(AM_V_GEN)$(CC) -E - -P < $^ -o $@
|
||||||
|
|
||||||
# cygwin dll
|
# cygwin dll
|
||||||
|
# Set PE and export table header timestamps to zero for reproducible builds.
|
||||||
$(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
|
$(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
|
||||||
$(newlib_build)/libm.a $(newlib_build)/libc.a
|
$(newlib_build)/libm.a $(newlib_build)/libc.a
|
||||||
$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
|
$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
|
||||||
-mno-use-libstdc-wrappers \
|
-mno-use-libstdc-wrappers \
|
||||||
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \
|
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \
|
||||||
-Wl,--dynamicbase -static \
|
-Wl,--dynamicbase -static \
|
||||||
|
$${SOURCE_DATE_EPOCH:+-Wl,--no-insert-timestamp} \
|
||||||
-Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
|
-Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
|
||||||
-e @DLL_ENTRY@ $(DEF_FILE) \
|
-e @DLL_ENTRY@ $(DEF_FILE) \
|
||||||
-Wl,-whole-archive libdll.a -Wl,-no-whole-archive \
|
-Wl,-whole-archive libdll.a -Wl,-no-whole-archive \
|
||||||
|
@ -92,8 +92,12 @@ for my $f (keys %text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Enable deterministic archives for reproducible builds.
|
||||||
|
my $opts = 'crs';
|
||||||
|
$opts .= 'D' if ($ENV{'SOURCE_DATE_EPOCH'} != '');
|
||||||
|
|
||||||
unlink $libdll;
|
unlink $libdll;
|
||||||
system $ar, 'crus', $libdll, glob('*.o'), @ARGV;
|
system $ar, $opts, $libdll, glob('*.o'), @ARGV;
|
||||||
unlink glob('*.o');
|
unlink glob('*.o');
|
||||||
exit 1 if $?;
|
exit 1 if $?;
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ parse_preproc_flags $CC
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Load the current date so we can work on individual fields
|
# Load the current date (or SOURCE_DATE_EPOCH) so we can work on individual fields
|
||||||
#
|
#
|
||||||
set -$- $(date -u +"%m %d %Y %H:%M")
|
set -$- $(date ${SOURCE_DATE_EPOCH:+-d @}${SOURCE_DATE_EPOCH} -u +"%m %d %Y %H:%M")
|
||||||
m=$1 d=$2 y=$3 hhmm=$4
|
m=$1 d=$2 y=$3 hhmm=$4
|
||||||
#
|
#
|
||||||
# Set date into YYYY-MM-DD HH:MM:SS format
|
# Set date into YYYY-MM-DD HH:MM:SS format
|
||||||
|
@ -74,7 +74,11 @@ EOF
|
|||||||
close $as_fd or exit 1;
|
close $as_fd or exit 1;
|
||||||
system $objcopy, '-j', '.idata$7', $iname_o;
|
system $objcopy, '-j', '.idata$7', $iname_o;
|
||||||
|
|
||||||
$res = system $ar, 'crus', $lib, sort keys %extract;
|
# Enable deterministic archives for reproducible builds.
|
||||||
|
my $opts = 'crs';
|
||||||
|
$opts .= 'D' if ($ENV{'SOURCE_DATE_EPOCH'} != '');
|
||||||
|
|
||||||
|
$res = system $ar, $opts, $lib, sort keys %extract;
|
||||||
unlink keys %extract;
|
unlink keys %extract;
|
||||||
die "$0: ar creation of $lib exited with non-zero status\n" if $res;
|
die "$0: ar creation of $lib exited with non-zero status\n" if $res;
|
||||||
exit 0;
|
exit 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user