fontconfig: update 2.10.2 -> 2.11.1. Close #4410, #2050

This commit is contained in:
Luca Bruno 2014-09-27 20:08:45 +02:00 committed by Vladimír Čunát
parent b772f53acb
commit 0927405a37
8 changed files with 131 additions and 29 deletions

View File

@ -27,9 +27,11 @@ with lib;
config = mkIf config.fonts.enableFontConfig {
# Bring in the default (upstream) fontconfig configuration.
# Fontconfig 2.10 backward compatibility
# Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
environment.etc."fonts/fonts.conf".source =
pkgs.makeFontsConf { fontDirectories = config.fonts.fonts; };
pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
environment.etc."fonts/conf.d/00-nixos.conf".text =
''
@ -47,6 +49,27 @@ with lib;
</fontconfig>
'';
# Versioned fontconfig > 2.10. Only specify font directories.
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Set the default hinting style to "slight". -->
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<!-- Font directories -->
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
</fontconfig>
'';
environment.systemPackages = [ pkgs.fontconfig ];
};

View File

@ -13,14 +13,6 @@ with lib;
type = types.listOf types.path;
example = literalExample "[ pkgs.dejavu_fonts ]";
description = "List of primary font paths.";
apply = list: list ++
[ # - the user's current profile
"~/.nix-profile/lib/X11/fonts"
"~/.nix-profile/share/fonts"
# - the default profile
"/nix/var/nix/profiles/default/lib/X11/fonts"
"/nix/var/nix/profiles/default/share/fonts"
];
};
};

View File

@ -0,0 +1,61 @@
{ stdenv, fetchurl, pkgconfig, freetype, expat }:
stdenv.mkDerivation rec {
name = "fontconfig-2.10.2";
src = fetchurl {
url = "http://fontconfig.org/release/${name}.tar.bz2";
sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
};
infinality_patch =
let subvers = "1";
in fetchurl {
url = http://www.infinality.net/fedora/linux/zips/fontconfig-infinality-1-20130104_1.tar.bz2;
sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
}
;
propagatedBuildInputs = [ freetype ];
buildInputs = [ pkgconfig expat ];
configureFlags = [
"--sysconfdir=/etc"
"--with-cache-dir=/var/cache/fontconfig"
"--disable-docs"
"--with-default-fonts="
];
# We should find a better way to access the arch reliably.
crossArch = stdenv.cross.arch or null;
preConfigure = ''
if test -n "$crossConfig"; then
configureFlags="$configureFlags --with-arch=$crossArch";
fi
'';
enableParallelBuilding = true;
doCheck = true;
# Don't try to write to /var/cache/fontconfig at install time.
installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
postInstall = ''
cd "$out/etc/fonts" && tar xvf ${infinality_patch}
'';
passthru = {
# Empty for backward compatibility, there was no versioning before 2.11
configVersion = "";
};
meta = with stdenv.lib; {
description = "A library for font customization and configuration";
homepage = http://fontconfig.org/;
license = licenses.bsd2; # custom but very bsd-like
platforms = platforms.all;
maintainers = [ maintainers.vcunat ];
};
}

View File

@ -1,5 +0,0 @@
source $stdenv/setup
configureFlags="--with-confdir=$out/etc/fonts --disable-docs"
genericBuild

View File

@ -1,11 +1,14 @@
{ stdenv, fetchurl, pkgconfig, freetype, expat }:
{ stdenv, fetchurl, pkgconfig, freetype, expat, libxslt, fontbhttf }:
let
configVersion = "2.11"; # bump whenever fontconfig breaks compatibility with older configurations
in
stdenv.mkDerivation rec {
name = "fontconfig-2.10.2";
name = "fontconfig-2.11.1";
src = fetchurl {
url = "http://fontconfig.org/release/${name}.tar.bz2";
sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
sha256 = "16baa4g5lswkyjlyf1h5lwc0zjap7c4d8grw79349a5w6dsl8qnw";
};
infinality_patch =
@ -17,13 +20,12 @@ stdenv.mkDerivation rec {
;
propagatedBuildInputs = [ freetype ];
buildInputs = [ pkgconfig expat ];
buildInputs = [ pkgconfig libxslt expat ];
configureFlags = [
"--sysconfdir=/etc"
"--with-cache-dir=/var/cache/fontconfig"
"--disable-docs"
"--with-default-fonts="
"--with-default-fonts=${fontbhttf}"
];
# We should find a better way to access the arch reliably.
@ -40,12 +42,24 @@ stdenv.mkDerivation rec {
doCheck = true;
# Don't try to write to /var/cache/fontconfig at install time.
installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
installFlags = "fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
# Add a default font for non-nixos systems. fontbhttf is only about 1mb.
postInstall = ''
cd "$out/etc/fonts" && tar xvf ${infinality_patch}
xsltproc --stringparam fontDirectories "${fontbhttf}" \
--stringparam fontconfig "$out" \
--stringparam fontconfigConfigVersion "${configVersion}" \
--path $out/share/xml/fontconfig \
${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \
> fonts.conf.tmp
mv fonts.conf.tmp $out/etc/fonts/fonts.conf
'';
passthru = {
inherit configVersion;
};
meta = with stdenv.lib; {
description = "A library for font customization and configuration";
homepage = http://fontconfig.org/;

View File

@ -1,13 +1,15 @@
{ runCommand, libxslt, fontconfig, fontDirectories }:
{ runCommand, libxslt, fontconfig, fontbhttf, fontDirectories }:
runCommand "fonts.conf"
{
buildInputs = [ libxslt fontconfig ];
inherit fontDirectories;
# Add a default font for non-nixos systems. fontbhttf is only about 1mb.
fontDirectories = fontDirectories ++ [ fontbhttf ];
}
''
xsltproc --stringparam fontDirectories "$fontDirectories" \
--stringparam fontconfig "${fontconfig}" \
--stringparam fontconfigConfigVersion "${fontconfig.configVersion}" \
--path ${fontconfig}/share/xml/fontconfig \
${./make-fonts-conf.xsl} ${fontconfig}/etc/fonts/fonts.conf \
> $out

View File

@ -16,25 +16,37 @@
<xsl:param name="fontDirectories" />
<xsl:param name="fontconfig" />
<xsl:param name="fontconfigConfigVersion" />
<xsl:template match="/fontconfig">
<fontconfig>
<xsl:apply-templates select="child::node()[name() != 'dir' and name() != 'cachedir' and name() != 'include']" />
<include ignore_missing="yes">/etc/fonts/conf.d</include>
<!-- fontconfig distribution conf.d -->
<include><xsl:value-of select="$fontconfig" />/etc/fonts/conf.d</include>
<!-- versioned system-wide config -->
<include ignore_missing="yes">/etc/fonts/<xsl:value-of select="$fontconfigConfigVersion" />/conf.d</include>
<!-- look into user config -->
<include prefix="xdg" ignore_missing="yes">fontconfig/conf.d</include>
<!-- the first cachedir will be used to store the cache -->
<cachedir prefix="xdg">fontconfig</cachedir>
<!-- /var/cache/fontconfig is useful for non-nixos systems -->
<cachedir>/var/cache/fontconfig</cachedir>
<cachedir>~/.fontconfig</cachedir>
<dir prefix="xdg">fonts</dir>
<xsl:for-each select="str:tokenize($fontDirectories)">
<dir><xsl:value-of select="." /></dir>
<xsl:text>&#0010;</xsl:text>
</xsl:for-each>
<dir prefix="xdg">fonts</dir>
<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>
<!-- nix user profile -->
<dir>~/.nix-profile/lib/X11/fonts</dir>
<dir>~/.nix-profile/share/fonts</dir>
<!-- nix default profile -->
<dir>/nix/var/nix/profiles/default/lib/X11/fonts</dir>
<dir>/nix/var/nix/profiles/default/share/fonts</dir>
</fontconfig>

View File

@ -4944,11 +4944,14 @@ let
cfitsio = callPackage ../development/libraries/cfitsio { };
fontconfig_210 = callPackage ../development/libraries/fontconfig/2.10.nix { };
fontconfig = callPackage ../development/libraries/fontconfig { };
makeFontsConf = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}:
import ../development/libraries/fontconfig/make-fonts-conf.nix {
inherit runCommand libxslt fontconfig fontDirectories;
inherit (xorg) fontbhttf;
};
freealut = callPackage ../development/libraries/freealut { };