widl: use additionally source date epoch for current time

Signed-off-by: Marko Semet <marko@marko10-000.de>
feature/deterministic
Marko Semet 2020-06-20 18:25:25 +02:00
parent b072c8a345
commit cb6fcfc2bb
2 changed files with 14 additions and 2 deletions

View File

@ -609,7 +609,17 @@ int main(int argc,char *argv[])
#endif
init_argv0_dir( argv[0] );
now = time(NULL);
{
const char* source_time = getenv("SOURCE_DATE_EPOCH");
if (source_time == NULL)
{
now = time(NULL);
}
else
{
now = atol(source_time);
}
}
while((optc = getopt_long_only(argc, argv, short_options, long_options, &opti)) != EOF) {
switch(optc) {

View File

@ -2747,8 +2747,10 @@ int create_msft_typelib(typelib_t *typelib)
/* midl adds two sets of custom data to the library: the current unix time
and midl's version number */
time_override = getenv( "WIDL_TIME_OVERRIDE");
time_override = getenv("SOURCE_DATE_EPOCH");
cur_time = time_override ? atol( time_override) : time(NULL);
time_override = getenv( "WIDL_TIME_OVERRIDE");
cur_time = time_override ? atol( time_override) : cur_time;
sprintf(info_string, "Created by WIDL version %s at %s\n", PACKAGE_VERSION, ctime(&cur_time));
set_custdata(msft, &midl_info_guid, VT_BSTR, info_string, &msft->typelib_header.CustomDataOffset);
set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset);