Socats build date and time may now be set externally with SOURCE_DATE_EPOCH

This commit is contained in:
Gerhard Rieger 2021-11-08 22:07:48 +01:00
parent 22a738d2d0
commit 39a8a26fae
2 changed files with 12 additions and 3 deletions

View file

@ -10,7 +10,7 @@ Corrections:
Socat since 1.7.4.0 did not compile on Solaris and its derivatives
because the getprotobynumber_r() function prototype differ from the
Linux versino.
Linux version.
configure now checks for the variant.
Thanks to Robert Zybeck for reporting this issue.
@ -30,6 +30,11 @@ Porting:
EPROTOTYPE on most other OSes).
Streams: Must not push ldterm when it is already active (hangs).
Building:
Socats build date and time may now be set externally with environment
variable SOURCE_DATE_EPOCH.
Thanks to Viktor Kleinik for sending a patch.
Testing:
test.sh: many corrections for AIX's older shell utilities, e.g.sleep(1)
does not allow fractions of seconds, grep does not understand '\<';

View file

@ -2123,7 +2123,11 @@ fi
AC_MSG_RESULT($sc_cv_var_environ)
# allow BUILD_DATE to be externally set for build reproducibility
if test "$BUILD_DATE"; then
if test "$SOURCE_DATE_EPOCH"; then
DATE_FMT="%d %b %Y %H:%M:%S"
BUILD_DATE=$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT")
AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"])
elif test "$BUILD_DATE"; then
AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"])
else
AC_DEFINE(BUILD_DATE, [__DATE__" "__TIME__])