From mboxrd@z Thu Jan 1 00:00:00 1970 From: ericbavier@openmailbox.org Subject: [PATCH 1/9] gnu: Add ttfautohint. Date: Tue, 5 Apr 2016 23:32:53 -0500 Message-ID: <1459917181-19626-1-git-send-email-ericbavier@openmailbox.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anf9r-0006XC-CF for guix-devel@gnu.org; Wed, 06 Apr 2016 00:33:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anf9n-0000NB-JP for guix-devel@gnu.org; Wed, 06 Apr 2016 00:33:35 -0400 Received: from smtp29.openmailbox.org ([62.4.1.63]:49538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anf9n-0000Mg-66 for guix-devel@gnu.org; Wed, 06 Apr 2016 00:33:31 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org Cc: Eric Bavier From: Eric Bavier * 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.pa= tch 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 =3D \ 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 =C2=A9 2013, 2014, 2015 Andreas Enge -;;; Copyright =C2=A9 2014 Eric Bavier +;;; Copyright =C2=A9 2014, 2016 Eric Bavier ;;; Copyright =C2=A9 2016 Mark H Weaver ;;; Copyright =C2=A9 2016 Efraim Flashner ;;; @@ -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 lev= els.") (license license:freetype) ; some files have other licenses (home-page "http://www.freetype.org/"))) =20 +(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=3Dno"))) ;no gui + (synopsis "Automated font hinting") + (description + "ttfautohint provides a 99% automated hinting process and a platfor= m 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/g= nu/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 emb= edded +modification date in TTF/TTC files. + +--- a/lib/tatime.c ++++ b/lib/tatime.c +@@ -15,6 +15,8 @@ +=20 + #include + #include ++#include ++#include +=20 + #include "ta.h" +=20 +@@ -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 =3D 24107 * 24 * 60 * 60; +- TA_ULongLong seconds_to_today =3D seconds_to_1970 + (TA_ULongLong)tim= e(NULL); ++ const TA_ULongLong seconds_to_1970 =3D 24107 * 24 * 60 * 60; ++ TA_ULongLong seconds_to_build; +=20 ++ time_t now; ++ char *source_date_epoch, *endptr; ++ TA_ULongLong epoch; ++ source_date_epoch =3D getenv("SOURCE_DATE_EPOCH"); ++ if (source_date_epoch) { ++ errno =3D 0; ++ epoch =3D strtoull(source_date_epoch, &endptr, 10); ++ if ((errno =3D=3D ERANGE && (epoch =3D=3D ULLONG_MAX || epoch =3D=3D= 0)) ++ || (errno !=3D 0 && epoch =3D=3D 0)) { ++ fprintf(stderr, ++ "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", ++ strerror(errno)); ++ exit(EXIT_FAILURE); ++ } ++ if (endptr =3D=3D source_date_epoch) { ++ fprintf(stderr, ++ "Environment variable $SOURCE_DATE_EPOCH: No digits were found: = %s\n", ++ endptr); ++ exit(EXIT_FAILURE); ++ } ++ if (*endptr !=3D '\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 =3D epoch; ++ } else { ++ now =3D time(NULL); ++ } +=20 +- *high =3D (FT_ULong)(seconds_to_today >> 32); +- *low =3D (FT_ULong)seconds_to_today; ++ seconds_to_build =3D seconds_to_1970 + (TA_ULongLong)now; ++ ++ *high =3D (FT_ULong)(seconds_to_build >> 32); ++ *low =3D (FT_ULong)seconds_to_build; + } +=20 + /* end of tatime.c */ --=20 2.7.3