gcc: add support for SOURCE_DATE_EPOCH environment

+ Create symlinks from gcc/patches/libcpp-source_date_epoch.patch to cross-*/files/
+ Make all the _apply_patch() functions the same
This commit is contained in:
Jürgen Buchmüller 2016-03-08 05:22:12 +01:00
parent f0affd9a3b
commit c459dade15
48 changed files with 257 additions and 99 deletions

View file

@ -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
}