diff options
author | Eric Bavier <bavier@member.fsf.org> | 2016-03-31 00:36:22 -0500 |
---|---|---|
committer | Eric Bavier <bavier@member.fsf.org> | 2016-04-15 00:23:28 -0500 |
commit | 1e69db8f1487ec61007099b3664e771094b8470b (patch) | |
tree | a6c74bede6f443131fa2a5f18a56d5856d3c2471 /gnu/packages/patches | |
parent | 08fbfa8d21674738cf043bf4cc6fba1a91fc3162 (diff) | |
download | guix-1e69db8f1487ec61007099b3664e771094b8470b.tar.gz |
gnu: Add ttfautohint.
* gnu/packages/fontutils.scm (ttfautohint): New variable. * gnu/packages/patches/ttfautohint-source-date-epoch.patch: New patch. * gnu-system.am (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/ttfautohint-source-date-epoch.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gnu/packages/patches/ttfautohint-source-date-epoch.patch b/gnu/packages/patches/ttfautohint-source-date-epoch.patch new file mode 100644 index 0000000000..e42fdbf6b0 --- /dev/null +++ b/gnu/packages/patches/ttfautohint-source-date-epoch.patch @@ -0,0 +1,70 @@ +Honour an external definition of SOURCE_DATE_EPOCH when updating the embedded +modification date in TTF/TTC files. + +--- a/lib/tatime.c ++++ b/lib/tatime.c +@@ -15,6 +15,8 @@ + + #include <time.h> + #include <stdint.h> ++#include <errno.h> ++#include <limits.h> + + #include "ta.h" + +@@ -27,12 +29,51 @@ TA_get_current_time(FT_ULong* high, + { + /* there have been 24107 days between January 1st, 1904 (the epoch of */ + /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */ +- TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60; +- TA_ULongLong seconds_to_today = seconds_to_1970 + (TA_ULongLong)time(NULL); ++ const TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60; ++ TA_ULongLong seconds_to_build; + ++ time_t now; ++ char *source_date_epoch, *endptr; ++ TA_ULongLong epoch; ++ source_date_epoch = getenv("SOURCE_DATE_EPOCH"); ++ if (source_date_epoch) { ++ errno = 0; ++ epoch = strtoull(source_date_epoch, &endptr, 10); ++ if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0)) ++ || (errno != 0 && epoch == 0)) { ++ fprintf(stderr, ++ "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", ++ strerror(errno)); ++ exit(EXIT_FAILURE); ++ } ++ if (endptr == source_date_epoch) { ++ fprintf(stderr, ++ "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", ++ endptr); ++ exit(EXIT_FAILURE); ++ } ++ if (*endptr != '\0') { ++ fprintf(stderr, ++ "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", ++ endptr); ++ exit(EXIT_FAILURE); ++ } ++ if (epoch > ULONG_MAX) { ++ fprintf(stderr, ++ "Environment variable $SOURCE_DATE_EPOCH: value must be smaller " ++ "than or equal to: %lu but was found to be: %llu \n", ++ ULONG_MAX, epoch); ++ exit(EXIT_FAILURE); ++ } ++ now = epoch; ++ } else { ++ now = time(NULL); ++ } + +- *high = (FT_ULong)(seconds_to_today >> 32); +- *low = (FT_ULong)seconds_to_today; ++ seconds_to_build = seconds_to_1970 + (TA_ULongLong)now; ++ ++ *high = (FT_ULong)(seconds_to_build >> 32); ++ *low = (FT_ULong)seconds_to_build; + } + + /* end of tatime.c */ |