Support SOURCE_DATE_EPOCH
for reproducible builds (#1035)
If the `SOURCE_DATE_EPOCH` environment variable is set, use its value for timestamps in the generated TTF files to make builds reproducible: https://reproducible-builds.org/docs/source-date-epoch/
This commit is contained in:
parent
b9baee2c65
commit
6556e4f883
1 changed files with 6 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
|||
const { Ot } = require("ot-builder");
|
||||
|
||||
module.exports = function () {
|
||||
return {
|
||||
var font = {
|
||||
head: new Ot.Head.Table(),
|
||||
hhea: new Ot.MetricHead.Hhea(),
|
||||
os2: new Ot.Os2.Table(4),
|
||||
|
@ -11,4 +11,9 @@ module.exports = function () {
|
|||
maxp: Ot.Maxp.Table.TrueType(),
|
||||
name: new Ot.Name.Table()
|
||||
};
|
||||
if (process.env.SOURCE_DATE_EPOCH) {
|
||||
font.head.created = new Date(process.env.SOURCE_DATE_EPOCH * 1000);
|
||||
font.head.modified = new Date(process.env.SOURCE_DATE_EPOCH * 1000);
|
||||
}
|
||||
return font;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue