File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1575,6 +1575,31 @@ impl Build {
1575
1575
} ;
1576
1576
} else {
1577
1577
let ( mut ar, cmd) = self . get_ar ( ) ?;
1578
+
1579
+ // Set an environment variable to tell the OSX archiver to ensure
1580
+ // that all dates listed in the archive are zero, improving
1581
+ // determinism of builds. AFAIK there's not really official
1582
+ // documentation of this but there's a lot of references to it if
1583
+ // you search google.
1584
+ //
1585
+ // You can reproduce this locally on a mac with:
1586
+ //
1587
+ // $ touch foo.c
1588
+ // $ cc -c foo.c -o foo.o
1589
+ //
1590
+ // # Notice that these two checksums are different
1591
+ // $ ar crus libfoo1.a foo.o && sleep 2 && ar crus libfoo2.a foo.o
1592
+ // $ md5sum libfoo*.a
1593
+ //
1594
+ // # Notice that these two checksums are the same
1595
+ // $ export ZERO_AR_DATE=1
1596
+ // $ ar crus libfoo1.a foo.o && sleep 2 && touch foo.o && ar crus libfoo2.a foo.o
1597
+ // $ md5sum libfoo*.a
1598
+ //
1599
+ // In any case if this doesn't end up getting read, it shouldn't
1600
+ // cause that many issues!
1601
+ ar. env ( "ZERO_AR_DATE" , "1" ) ;
1602
+
1578
1603
run (
1579
1604
ar. arg ( "crs" ) . arg ( dst) . args ( & objects) . args ( & self . objects ) ,
1580
1605
& cmd,
You can’t perform that action at this time.
0 commit comments