@@ -1,64 +1,53 @@
1−{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, which, zlib, bzip2, libpng, gnumake
2−, glib /* passthru only */
3−
4− # FreeType supports sub-pixel rendering. This is patented by
5− # Microsoft, so it is disabled by default. This option allows it to
6− # be enabled. See http://www.freetype.org/patents.html.
7−, useEncumberedCode ? true
8−, useInfinality ? true
1+{
2+ stdenv, lib, fetchurl, copyPathsToStore,
3+ pkgconfig, which,
4+ zlib, bzip2, libpng, gnumake, glib,
5+
6+ # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
7+ # LCD filtering is also known as ClearType and covered by several Microsoft patents.
8+ # This option allows it to be disabled. See http://www.freetype.org/patents.html.
9+ useEncumberedCode ? true,
910}:
1011
11−assert useInfinality -> useEncumberedCode;
12+with { inherit (stdenv.lib) optional optionals optionalString; };
1213
13−let
14− version = "2.6.5";
14+let version = "2.7.1"; name = "freetype-" + version; in
1515
16− infinality = fetchFromGitHub {
17− owner = "archfan";
18− repo = "infinality_bundle";
19− rev = "5c0949a477bf43d2ac4e57b4fc39bcc3331002ee";
20− sha256 = "17389aqm6rlxl4b5mv1fx4b22x2v2n60hfhixfxqxpd8ialsdi6l";
21− };
16+stdenv.mkDerivation {
17+ inherit name;
2218
23−in
24−with { inherit (stdenv.lib) optional optionals optionalString; };
25−stdenv.mkDerivation rec {
26− name = "freetype-${version}";
19+ meta = with stdenv.lib; {
20+ description = "A font rendering engine";
21+ longDescription = ''
22+ FreeType is a portable and efficient library for rendering fonts. It
23+ supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
24+ fonts. It has a bytecode interpreter and has an automatic hinter called
25+ autofit which can be used instead of hinting instructions included in
26+ fonts.
27+ '';
28+ homepage = https://www.freetype.org/;
29+ license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
30+ platforms = platforms.all;
31+ maintainers = with maintainers; [ ttuegel ];
32+ };
2733
2834 src = fetchurl {
2935 url = "mirror://savannah/freetype/${name}.tar.bz2";
30− sha256 = "1w5c87s4rpx9af5b3mk5cjd1yny3c4dq5p9iv3ixb3vr00a6w2p2";
36+ sha256 = "121gm15ayfg3rglby8ifh8384mcjb9dhmx9j40zl7yszw72b4frs";
3137 };
3238
33− patches = [
34− # Patch for validation of OpenType and GX/AAT tables.
35− (fetchurl {
36− name = "freetype-2.2.1-enable-valid.patch";
37− url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990";
38− sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l";
39− })
40− ] ++ optionals (!useInfinality && useEncumberedCode) [
41− # Patch to enable subpixel rendering.
42− # See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html.
43− (fetchurl {
44− name = "freetype-2.3.0-enable-spr.patch";
45− url = http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.3.0-enable-spr.patch?id=9a81147af83b1166a5f301e379f85927cc610990;
46− sha256 = "13ni9n5q3nla38wjmxd4f8cy29gp62kjx2l6y6nqhdyiqp8fz8nd";
47− })
48− ];
49−
50− prePatch = optionalString useInfinality ''
51− patches="$patches $(ls ${infinality}/*_freetype2-iu/*-infinality-*.patch)"
52− '';
53−
54− outputs = [ "out" "dev" ];
55−
5639 propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
5740 # dependence on harfbuzz is looser than the reverse dependence
5841 nativeBuildInputs = [ pkgconfig which ]
5942 # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
6043 ++ optional (!stdenv.isLinux) gnumake;
6144
45+ patches =
46+ [ ./enable-table-validation.patch ]
47+ ++ optional useEncumberedCode ./enable-subpixel-rendering.patch;
48+
49+ outputs = [ "out" "dev" ];
50+
6251 configureFlags = [ "--disable-static" "--bindir=$(dev)/bin" ];
6352
6453 # The asm for armel is written with the 'asm' keyword.
@@ -76,19 +65,4 @@ stdenv.mkDerivation rec {
7665 # know why it's on the PATH.
7766 configureFlags = "--disable-static CC_BUILD=gcc";
7867 };
79−
80− meta = with stdenv.lib; {
81− description = "A font rendering engine";
82− longDescription = ''
83− FreeType is a portable and efficient library for rendering fonts. It
84− supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
85− fonts. It has a bytecode interpreter and has an automatic hinter called
86− autofit which can be used instead of hinting instructions included in
87− fonts.
88− '';
89− homepage = https://www.freetype.org/;
90− license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
91− #ToDo: encumbered = useEncumberedCode;
92− platforms = platforms.all;
93− };
9468}