void-packages/common/environment/configure/timestamp-macros.sh
2016-03-01 18:27:49 +01:00

12 lines
468 B
Bash

if [ -n "$SOURCE_DATE_EPOCH" ]; then
CFLAGS+=" -Wno-builtin-macro-redefined -include $XBPS_STATEDIR/timestamp-macros.h"
CXXFLAGS+=" -Wno-builtin-macro-redefined -include $XBPS_STATEDIR/timestamp-macros.h"
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#*,}")
cat >> $XBPS_STATEDIR/timestamp-macros.h <<EOF
#undef __${mcr}__
#define __${mcr}__ "${val}"
EOF
done
fi