tools/widl/write_msft.c: add support for overriding recorded time, allowing binary-identical compilation.

Paul Millar paul at astro.gla.ac.uk
Sun Oct 28 11:31:03 CDT 2007


The following patch is a trivial change.  It allows allows someone to specify
what time-stamp is recorded within widl-generated files using the
WIDL_TIME_OVERRIDE environment variable.

If this variable is not set, the current behaviour is preserved and the actual
time is recorded.

Setting WIDL_TIME_OVERRIDE allows the generation of binary identical files,
i.e. repeated compilation will result in files that have identical MD5
checksums.

Cheers,

Paul.

ChangeLog:
Add support for overriding recorded time, allowing binary-identical compilation.

---
 tools/widl/write_msft.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index dd29c73..f5ea2f7 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -2473,6 +2473,7 @@ int create_msft_typelib(typelib_t *typelib)
     int failed = 0;
     typelib_entry_t *entry;
     time_t cur_time;
+    char *time_override;
     unsigned int version = 5 << 24 | 1 << 16 | 164; /* 5.01.0164 */
     GUID midl_time_guid    = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; 
     GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; 
@@ -2518,7 +2519,8 @@ 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 */
-    cur_time = time(NULL);
+    time_override = getenv( "WIDL_TIME_OVERRIDE");
+    cur_time = time_override ? atol( time_override) : time(NULL);
     set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset);
     set_custdata(msft, &midl_version_guid, VT_UI4, &version, &msft->typelib_header.CustomDataOffset);
 
-- 
1.5.3.4



More information about the wine-patches mailing list