unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/9] gnu: Add ttfautohint.
@ 2016-04-06  4:32 ericbavier
  2016-04-06  4:32 ` [PATCH 2/9] gnu: Add woff-tools ericbavier
                   ` (9 more replies)
  0 siblings, 10 replies; 34+ messages in thread
From: ericbavier @ 2016-04-06  4:32 UTC (permalink / raw)
  To: guix-devel; +Cc: Eric Bavier

From: Eric Bavier <bavier@member.fsf.org>

* 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.
---
 gnu-system.am                                      |  1 +
 gnu/packages/fontutils.scm                         | 36 ++++++++++-
 .../patches/ttfautohint-source-date-epoch.patch    | 70 ++++++++++++++++++++++
 3 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/ttfautohint-source-date-epoch.patch

diff --git a/gnu-system.am b/gnu-system.am
index c8048b7..764e564 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -747,6 +747,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/tidy-CVE-2015-5522+5523.patch		\
   gnu/packages/patches/tinyxml-use-stl.patch			\
   gnu/packages/patches/tk-find-library.patch			\
+  gnu/packages/patches/ttfautohint-source-date-epoch.patch	\
   gnu/packages/patches/tophat-build-with-later-seqan.patch	\
   gnu/packages/patches/torsocks-dns-test.patch			\
   gnu/packages/patches/tvtime-gcc41.patch			\
diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index ff10a4a..a0701d5 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;;
@@ -29,6 +29,8 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages python)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages bison)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages gtk)
@@ -70,6 +72,38 @@ anti-aliased glyph bitmap generation with 256 gray levels.")
    (license license:freetype)           ; some files have other licenses
    (home-page "http://www.freetype.org/")))
 
+(define-public ttfautohint
+  (package
+    (name "ttfautohint")
+    (version "1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://savannah/freetype/ttfautohint-"
+                           version ".tar.gz"))
+       (sha256
+        (base32
+         ;; /gnu/store/5kzmy7061aimljpga9qfz49227283sfr-ttfautohint-1.5.tar.gz
+         "1lgghck46p33z3hg8dnl76jryig4fh6d8rhzms837zp7x4hyfkv4"))
+       (patches (map search-patch '("ttfautohint-source-date-epoch.patch")))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("flex" ,flex)
+       ("bison" ,bison)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("freetype" ,freetype)
+       ("harfbuzz" ,harfbuzz)))
+    (arguments
+     `(#:configure-flags '("--with-qt=no"))) ;no gui
+    (synopsis "Automated font hinting")
+    (description
+     "ttfautohint provides a 99% automated hinting process and a platform for
+finely hand-hinting the last 1%.  It is ideal for web fonts and supports many
+scripts.")
+    (license license:gpl2+)             ;or FreeType license
+    (home-page "http://www.freetype.org/ttfautohint/")))
+
 (define-public fontconfig
   (package
    (name "fontconfig")
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 0000000..e42fdbf
--- /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 */
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2016-04-14 14:44 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-06  4:32 [PATCH 1/9] gnu: Add ttfautohint ericbavier
2016-04-06  4:32 ` [PATCH 2/9] gnu: Add woff-tools ericbavier
2016-04-07  6:18   ` Efraim Flashner
2016-04-07 14:25     ` Eric Bavier
2016-04-13 21:37     ` Ludovic Courtès
2016-04-06  4:32 ` [PATCH 3/9] gnu: Add ttf2eot ericbavier
2016-04-07  6:24   ` Efraim Flashner
2016-04-07 14:30     ` Eric Bavier
2016-04-08  3:49     ` Eric Bavier
2016-04-13 21:39       ` Ludovic Courtès
2016-04-06  4:32 ` [PATCH 4/9] gnu: Add brotli ericbavier
2016-04-13 21:44   ` Ludovic Courtès
2016-04-06  4:32 ` [PATCH 5/9] gnu: Add woff2 ericbavier
2016-04-06  4:32 ` [PATCH 6/9] gnu: fontforge: Make SVG builds reproducible ericbavier
2016-04-06 17:36   ` Leo Famulari
2016-04-06 17:44     ` Eric Bavier
2016-04-06 17:56       ` Leo Famulari
2016-04-06  4:32 ` [PATCH 7/9] gnu: Add font-fantasque-sans ericbavier
2016-04-06  4:33 ` [PATCH 8/9] gnu: fontforge: Use modify-phases ericbavier
2016-04-06  4:33 ` [PATCH 9/9] gnu: fontforge: Install 'showttf' tool ericbavier
2016-04-06 12:13 ` [PATCH 1/9] gnu: Add ttfautohint Alex Kost
2016-04-06 14:57   ` Eric Bavier
2016-04-07  9:52     ` Specifying package patches in a more convenient form Alex Kost
2016-04-07 10:08       ` Andy Wingo
2016-04-07 14:41         ` Eric Bavier
2016-04-08  8:05         ` Alex Kost
2016-04-09 14:43           ` Ludovic Courtès
2016-04-07 21:54       ` Ludovic Courtès
2016-04-09  8:22         ` Alex Kost
2016-04-09 11:42         ` Andreas Enge
2016-04-09 16:40           ` Alex Kost
2016-04-13 21:40     ` [PATCH 1/9] gnu: Add ttfautohint Ludovic Courtès
2016-04-13 21:36 ` Ludovic Courtès
2016-04-14 14:43   ` Eric Bavier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).