Merge pull request #3787 from pullmoll/timestamp
gcc: add support for SOURCE_DATE_EPOCH environment
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
|
||||
# only run this, if SOURCE_DATE_EPOCH isn't set.
|
||||
if [ -z "$XBPS_USE_BUILD_MTIME" -a -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
|
||||
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
|
||||
unset SOURCE_DATE_EPOCH
|
||||
return 0
|
||||
fi
|
||||
if [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
|
||||
if command -v chroot-git &>/dev/null; then
|
||||
GIT_CMD=$(command -v chroot-git)
|
||||
elif command -v git &>/dev/null; then
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# Remove leaked CFLAGS and CXXFLAGS parts which were defined
|
||||
# by common/hooks/pre-configure/03-timestamp-macros.sh
|
||||
# from shell scripts, perl scripts, package config files etc.
|
||||
|
||||
hook() {
|
||||
local f mimetype
|
||||
local strip=" -Wno-builtin-macro-redefined -include${XBPS_BUILDDIR}/\.xbps-.*/timestamp-macros\.h"
|
||||
|
||||
[ -n "$XBPS_USE_BUILD_MTIME" ] && return 0
|
||||
[ -z "$SOURCE_DATE_EPOCH" ] && return 0
|
||||
|
||||
# Clean up shell scripts, perl files, pkgconfig files etc.
|
||||
for f in $(grep -r -l -e "$strip" "$PKGDESTDIR" ); do
|
||||
mimetype=$(file --mime-type "$f" | awk '{ print $2 }')
|
||||
if [ "$mimetype" == "text/plain" -o \
|
||||
"$mimetype" == "text/x-makefile" -o \
|
||||
"$mimetype" == "text/x-shellscript" -o \
|
||||
"$mimetype" == "application/xml" ]; then
|
||||
sed -i "$f" -e "s;$strip;;"
|
||||
msg_warn "Cleaned up ${f#${PKGDESTDIR}} ...\n"
|
||||
else
|
||||
# Unhandled mime-type file contains the $strip string
|
||||
# E.g. binaries containing the build environment as a string
|
||||
msg_warn "Can't clean ${f#${PKGDESTDIR}} (mime-type: $mimetype) ...\n"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# This hook overwrites timestamp macros.
|
||||
#
|
||||
hook() {
|
||||
local i mcr val macros="$XBPS_STATEDIR/timestamp-macros.h"
|
||||
|
||||
[ -n "$XBPS_USE_BUILD_MTIME" ] && return 0
|
||||
[ -z "$SOURCE_DATE_EPOCH" ] && return 0
|
||||
msg_normal "Creating $macros\n"
|
||||
CFLAGS+=" -Wno-builtin-macro-redefined -include$macros"
|
||||
CXXFLAGS+=" -Wno-builtin-macro-redefined -include$macros"
|
||||
rm -f "$macros"
|
||||
for i in "DATE,%b %d %Y" "TIME,%H:%M:%S" "DATETIME,%b %d %Y %H:%M:%S"; do
|
||||
mcr=${i%%,*}
|
||||
val=$(LC_ALL=C date --date "@$SOURCE_DATE_EPOCH" +"${i#*,}")
|
||||
echo "#undef __${mcr}__" >> "$macros"
|
||||
echo "#define __${mcr}__ \"${val}\"" >> "$macros"
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user