environment/configure: move macro definition to a header file and include it.
This prevents escaping issues with command line options.
This commit is contained in:
parent
995c356e30
commit
69cb0beb58
|
@ -1,8 +1,12 @@
|
||||||
if [ -n "$XBPS_COMMIT_TIMESTAMP" ]; then
|
if [ -n "$XBPS_COMMIT_TIMESTAMP" ]; then
|
||||||
CFLAGS+=" -Wno-builtin-macro-redefined"
|
CFLAGS+=" -Wno-builtin-macro-redefined -include $XBPS_STATEDIR/timestamp-macros.h"
|
||||||
CXXFLAGS+=" -Wno-builtin-macro-redefined"
|
CXXFLAGS+=" -Wno-builtin-macro-redefined -include $XBPS_STATEDIR/timestamp-macros.h"
|
||||||
for i in "DATE,%b\x20%d\x20%Y" "TIME,%H:%M:%S" "DATETIME,%b\x20%d\x20%Y\x20%H:%M:%S"; do
|
for i in "DATE,%b %d %Y" "TIME,%H:%M:%S" "DATETIME,%b %d %Y %H:%M:%S"; do
|
||||||
CFLAGS+=" -U__${i%%,*}__ -D__${i%%,*}__=\\\"$(LC_ALL=C date --date "$XBPS_COMMIT_TIMESTAMP" +"${i#*,}")\\\""
|
mcr=${i%%,*}
|
||||||
CXXFLAGS+=" -U__${i%%,*}__ -D__${i%%,*}__=\\\"$(LC_ALL=C date --date "$XBPS_COMMIT_TIMESTAMP" +"${i#*,}")\\\""
|
val=$(LC_ALL=C date --date "$XBPS_COMMIT_TIMESTAMP" +"${i#*,}")
|
||||||
|
cat >> $XBPS_STATEDIR/timestamp-macros.h <<EOF
|
||||||
|
#undef __${mcr}__
|
||||||
|
#define __${mcr}__ "${val}"
|
||||||
|
EOF
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue