environment/build: overwrite __DATE__, __TIME__, and __TIMESTAMP__ macros.
This commit overwrites timestamps that depend on timestamps with the commit date of a package.
This commit is contained in:
1
common/environment/build/timestamp-macros.sh
Symbolic link
1
common/environment/build/timestamp-macros.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../configure/timestamp-macros.sh
|
||||
8
common/environment/configure/timestamp-macros.sh
Normal file
8
common/environment/configure/timestamp-macros.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
if [ -n "$XBPS_COMMIT_TIMESTAMP" ]; then
|
||||
CFLAGS+=" -Wno-builtin-macro-redefined"
|
||||
CXXFLAGS+=" -Wno-builtin-macro-redefined"
|
||||
for i in "DATE,%b\x20%d\x20%Y" "TIME,%H:%M:%S" "DATETIME,%b\x20%d\x20%Y\x20%H:%M:%S"; do
|
||||
CFLAGS+=" -U__${i%%,*}__ -D__${i%%,*}__=\\\"$(LC_ALL=C date --date "$XBPS_COMMIT_TIMESTAMP" +"${i#*,}")\\\""
|
||||
CXXFLAGS+=" -U__${i%%,*}__ -D__${i%%,*}__=\\\"$(LC_ALL=C date --date "$XBPS_COMMIT_TIMESTAMP" +"${i#*,}")\\\""
|
||||
done
|
||||
fi
|
||||
1
common/environment/install/timestamp-macros.sh
Symbolic link
1
common/environment/install/timestamp-macros.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../configure/timestamp-macros.sh
|
||||
10
common/environment/setup/git.sh
Normal file
10
common/environment/setup/git.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
|
||||
# only run this, if XBPS_COMMIT_TIMESTAMP isn't set
|
||||
if [ -z "$XBPS_USE_BUILD_MTIME" ] && [ -z "${XBPS_COMMIT_TIMESTAMP}" ]; then
|
||||
if command -v chroot-git &>/dev/null; then
|
||||
GIT_CMD=$(command -v chroot-git)
|
||||
elif command -v git &>/dev/null; then
|
||||
GIT_CMD=$(command -v git)
|
||||
fi
|
||||
export XBPS_COMMIT_TIMESTAMP="$($GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} log --pretty='%ci' --date=iso -n1 .)"
|
||||
fi
|
||||
Reference in New Issue
Block a user