summary refs log tree commit diff
path: root/pkgs/development/libraries/freetype
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@secure.mailbox.org>2017-03-20 11:43:50 -0500
committerGitHub <noreply@github.com>2017-03-20 11:43:50 -0500
commit1b0d9e9ae64b677c09f345f740f5a94fa41eb468 (patch)
tree1cbb71acfb427c9521ea4552853692898ee755c4 /pkgs/development/libraries/freetype
parent48bc3cf9f497f38d0bfcf0ac6a808a1cd411a855 (diff)
parentd458b5401a36dd87cfd2bd071f634330f095cf5d (diff)
downloadnixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.gz
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.bz2
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.lz
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.xz
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.tar.zst
nixlib-1b0d9e9ae64b677c09f345f740f5a94fa41eb468.zip
Merge pull request #23819 from ttuegel/freetype
FreeType 2.7.1 and Fontconfig defaults
Diffstat (limited to 'pkgs/development/libraries/freetype')
-rw-r--r--pkgs/development/libraries/freetype/default.nix94
-rw-r--r--pkgs/development/libraries/freetype/enable-subpixel-rendering.patch13
-rw-r--r--pkgs/development/libraries/freetype/enable-table-validation.patch22
3 files changed, 69 insertions, 60 deletions
diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix
index adf48df2494e..f966965fa5fa 100644
--- a/pkgs/development/libraries/freetype/default.nix
+++ b/pkgs/development/libraries/freetype/default.nix
@@ -1,64 +1,53 @@
-{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, which, zlib, bzip2, libpng, gnumake
-, glib /* passthru only */
-
-  # FreeType supports sub-pixel rendering.  This is patented by
-  # Microsoft, so it is disabled by default.  This option allows it to
-  # be enabled.  See http://www.freetype.org/patents.html.
-, useEncumberedCode ? true
-, useInfinality ? true
+{
+  stdenv, lib, fetchurl, copyPathsToStore,
+  pkgconfig, which,
+  zlib, bzip2, libpng, gnumake, glib,
+
+  # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
+  # LCD filtering is also known as ClearType and covered by several Microsoft patents.
+  # This option allows it to be disabled. See http://www.freetype.org/patents.html.
+  useEncumberedCode ? true,
 }:
 
-assert useInfinality -> useEncumberedCode;
+with { inherit (stdenv.lib) optional optionals optionalString; };
 
-let
-  version = "2.6.5";
+let version = "2.7.1"; name = "freetype-" + version; in
 
-  infinality = fetchFromGitHub {
-    owner = "archfan";
-    repo = "infinality_bundle";
-    rev = "5c0949a477bf43d2ac4e57b4fc39bcc3331002ee";
-    sha256 = "17389aqm6rlxl4b5mv1fx4b22x2v2n60hfhixfxqxpd8ialsdi6l";
-  };
+stdenv.mkDerivation {
+  inherit name;
 
-in
-with { inherit (stdenv.lib) optional optionals optionalString; };
-stdenv.mkDerivation rec {
-  name = "freetype-${version}";
+  meta = with stdenv.lib; {
+    description = "A font rendering engine";
+    longDescription = ''
+      FreeType is a portable and efficient library for rendering fonts. It
+      supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
+      fonts. It has a bytecode interpreter and has an automatic hinter called
+      autofit which can be used instead of hinting instructions included in
+      fonts.
+    '';
+    homepage = https://www.freetype.org/;
+    license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ttuegel ];
+  };
 
   src = fetchurl {
     url = "mirror://savannah/freetype/${name}.tar.bz2";
-    sha256 = "1w5c87s4rpx9af5b3mk5cjd1yny3c4dq5p9iv3ixb3vr00a6w2p2";
+    sha256 = "121gm15ayfg3rglby8ifh8384mcjb9dhmx9j40zl7yszw72b4frs";
   };
 
-  patches = [
-    # Patch for validation of OpenType and GX/AAT tables.
-    (fetchurl {
-      name = "freetype-2.2.1-enable-valid.patch";
-      url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990";
-      sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l";
-    })
-  ] ++ optionals (!useInfinality && useEncumberedCode) [
-    # Patch to enable subpixel rendering.
-    # See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html.
-    (fetchurl {
-      name = "freetype-2.3.0-enable-spr.patch";
-      url = http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.3.0-enable-spr.patch?id=9a81147af83b1166a5f301e379f85927cc610990;
-      sha256 = "13ni9n5q3nla38wjmxd4f8cy29gp62kjx2l6y6nqhdyiqp8fz8nd";
-    })
-  ];
-
-  prePatch = optionalString useInfinality ''
-    patches="$patches $(ls ${infinality}/*_freetype2-iu/*-infinality-*.patch)"
-  '';
-
-  outputs = [ "out" "dev" ];
-
   propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
   # dependence on harfbuzz is looser than the reverse dependence
   nativeBuildInputs = [ pkgconfig which ]
     # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
     ++ optional (!stdenv.isLinux) gnumake;
 
+  patches =
+    [ ./enable-table-validation.patch ]
+    ++ optional useEncumberedCode ./enable-subpixel-rendering.patch;
+
+  outputs = [ "out" "dev" ];
+
   configureFlags = [ "--disable-static" "--bindir=$(dev)/bin" ];
 
   # The asm for armel is written with the 'asm' keyword.
@@ -76,19 +65,4 @@ stdenv.mkDerivation rec {
     # know why it's on the PATH.
     configureFlags = "--disable-static CC_BUILD=gcc";
   };
-
-  meta = with stdenv.lib; {
-    description = "A font rendering engine";
-    longDescription = ''
-      FreeType is a portable and efficient library for rendering fonts. It
-      supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
-      fonts. It has a bytecode interpreter and has an automatic hinter called
-      autofit which can be used instead of hinting instructions included in
-      fonts.
-    '';
-    homepage = https://www.freetype.org/;
-    license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
-    #ToDo: encumbered = useEncumberedCode;
-    platforms = platforms.all;
-  };
 }
diff --git a/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch b/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
new file mode 100644
index 000000000000..4f908343e8c1
--- /dev/null
+++ b/pkgs/development/libraries/freetype/enable-subpixel-rendering.patch
@@ -0,0 +1,13 @@
+Index: freetype-2.7.1/include/freetype/config/ftoption.h
+===================================================================
+--- freetype-2.7.1.orig/include/freetype/config/ftoption.h
++++ freetype-2.7.1/include/freetype/config/ftoption.h
+@@ -122,7 +122,7 @@ FT_BEGIN_HEADER
+   /* This is done to allow FreeType clients to run unmodified, forcing     */
+   /* them to display normal gray-level anti-aliased glyphs.                */
+   /*                                                                       */
+-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+ 
+ 
+   /*************************************************************************/
diff --git a/pkgs/development/libraries/freetype/enable-table-validation.patch b/pkgs/development/libraries/freetype/enable-table-validation.patch
new file mode 100644
index 000000000000..37419f14f40f
--- /dev/null
+++ b/pkgs/development/libraries/freetype/enable-table-validation.patch
@@ -0,0 +1,22 @@
+Index: freetype-2.7.1/modules.cfg
+===================================================================
+--- freetype-2.7.1.orig/modules.cfg
++++ freetype-2.7.1/modules.cfg
+@@ -120,7 +120,7 @@ AUX_MODULES += cache
+ # TrueType GX/AAT table validation.  Needs ftgxval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+ 
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -143,7 +143,7 @@ AUX_MODULES += bzip2
+ # OpenType table validation.  Needs ftotval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+ 
+ # Auxiliary PostScript driver component to share common code.
+ #