freetype+fontconfig: add infinality and enable it

Also add fontconfig checks
, change license to "unfree" if using patented code.

Inspired by Corey O'Connor in #89
27fec0aa26
This commit is contained in:
Vladimír Čunát 2013-02-10 14:41:29 +01:00
parent c53724f317
commit 610796d9f2
3 changed files with 69 additions and 6 deletions

View file

@ -8,6 +8,13 @@ stdenv.mkDerivation rec {
sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
};
infinality_patch = with freetype.infinality; if useInfinality
then let subvers = "1";
in fetchurl {
url = "${base_URL}/fontconfig-infinality-1-${vers}_${subvers}.tar.bz2";
sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
}
else null;
buildInputs = [ pkgconfig freetype expat ];
@ -29,6 +36,10 @@ stdenv.mkDerivation rec {
# Don't try to write to /etc/fonts or /var/cache/fontconfig at install time.
installFlags = "CONFDIR=$(out)/etc/fonts RUN_FC_CACHE_TEST=false fc_cachedir=$(TMPDIR)/dummy";
postInstall = if !freetype.infinality.useInfinality then "" else ''
cd "$out/etc/fonts" && tar xvf ${infinality_patch}
'';
meta = {
description = "A library for font customization and configuration";
homepage = http://fontconfig.org/;

View file

@ -1,22 +1,48 @@
{ stdenv, fetchurl, gnumake
, # FreeType supports sub-pixel rendering. This is patented by
# 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 ? false
, useEncumberedCode ? false
, useInfinality ? true
}:
assert !(useEncumberedCode && useInfinality); # probably wouldn't make sense
let
version = "2.4.11";
infinality = rec {
inherit useInfinality;
vers = "20130104";
subvers = "04";
sha256 = "0dqglig34lfcw0w6sm6vmich0pcvq303vyh8jzqapvxgvrpr2156";
base_URL = "http://www.infinality.net/fedora/linux/zips";
url = "${base_URL}/freetype-infinality-${version}-${vers}_${subvers}-x86_64.tar.bz2";
};
in
stdenv.mkDerivation rec {
name = "freetype-2.4.11";
name = "freetype-${version}";
src = fetchurl {
url = "mirror://sourceforge/freetype/${name}.tar.bz2";
sha256 = "0gxyzxqpyf8g85y6g1zc1wqrh71prbbk8xfw4m8rwzb4ck5hp7gg";
};
infinality_patch = if useInfinality
then fetchurl { inherit (infinality) url sha256; }
else null;
configureFlags = "--disable-static";
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString useEncumberedCode
"-DFT_CONFIG_OPTION_SUBPIXEL_RENDERING=1";
NIX_CFLAGS_COMPILE = with stdenv.lib;
" -fno-strict-aliasing" # from Gentoo, see https://bugzilla.redhat.com/show_bug.cgi?id=506840
+ optionalString useEncumberedCode " -DFT_CONFIG_OPTION_SUBPIXEL_RENDERING=1"
+ optionalString useInfinality " -DTT_CONFIG_OPTION_SUBPIXEL_HINTING=1"
;
patches = [ ./enable-validation.patch ] # from Gentoo
++ stdenv.lib.optional useInfinality [ infinality_patch ];
# The asm for armel is written with the 'asm' keyword.
CFLAGS = stdenv.lib.optionalString stdenv.isArm "-std=gnu99";
@ -25,6 +51,7 @@ stdenv.mkDerivation rec {
buildInputs = stdenv.lib.optional (stdenv.system == "i686-freebsd") gnumake;
enableParallelBuilding = true;
doCheck = true;
postInstall =
''
@ -38,9 +65,12 @@ stdenv.mkDerivation rec {
configureFlags = "--disable-static CC_BUILD=gcc";
};
passthru = { inherit infinality; }; # for fontconfig
meta = {
description = "A font rendering engine";
homepage = http://www.freetype.org/;
license = "GPLv2+"; # or the FreeType License (BSD + advertising clause)
license = if useEncumberedCode then "unfree"
else "GPLv2+"; # or the FreeType License (BSD + advertising clause)
};
}

View file

@ -0,0 +1,22 @@
Enables gxvalid and otvalid modules for use with ftvalid.
--- freetype-2.2.1/modules.cfg.orig 2006-07-07 21:01:09.000000000 -0400
+++ freetype-2.2.1/modules.cfg 2006-07-07 21:01:54.000000000 -0400
@@ -110,7 +110,7 @@
AUX_MODULES += cache
# TrueType GX/AAT table validation. Needs ftgxval.c below.
-# AUX_MODULES += gxvalid
+AUX_MODULES += gxvalid
# Support for streams compressed with gzip (files with suffix .gz).
#
@@ -124,7 +124,7 @@
# OpenType table validation. Needs ftotval.c below.
#
-# AUX_MODULES += otvalid
+AUX_MODULES += otvalid
# Auxiliary PostScript driver component to share common code.
#