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

Changed files
+131 -29
nixos
modules
config
pkgs
+25 -2
nixos/modules/config/fonts/fontconfig.nix
···
config = mkIf config.fonts.enableFontConfig {
-
# Bring in the default (upstream) fontconfig configuration.
environment.etc."fonts/fonts.conf".source =
-
pkgs.makeFontsConf { fontDirectories = config.fonts.fonts; };
environment.etc."fonts/conf.d/00-nixos.conf".text =
''
···
<const>hintslight</const>
</edit>
</match>
</fontconfig>
'';
···
config = mkIf config.fonts.enableFontConfig {
+
# 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 { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
environment.etc."fonts/conf.d/00-nixos.conf".text =
''
···
<const>hintslight</const>
</edit>
</match>
+
+
</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>
'';
-8
nixos/modules/config/fonts/fonts.nix
···
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"
-
];
};
};
···
type = types.listOf types.path;
example = literalExample "[ pkgs.dejavu_fonts ]";
description = "List of primary font paths.";
};
};
+61
pkgs/development/libraries/fontconfig/2.10.nix
···
···
+
{ 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 ];
+
};
+
}
-5
pkgs/development/libraries/fontconfig/builder.sh
···
-
source $stdenv/setup
-
-
configureFlags="--with-confdir=$out/etc/fonts --disable-docs"
-
-
genericBuild
···
+21 -7
pkgs/development/libraries/fontconfig/default.nix
···
-
{ 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 =
···
;
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.
···
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}
'';
meta = with stdenv.lib; {
description = "A library for font customization and configuration";
homepage = http://fontconfig.org/;
···
+
{ 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.11.1";
src = fetchurl {
url = "http://fontconfig.org/release/${name}.tar.bz2";
+
sha256 = "16baa4g5lswkyjlyf1h5lwc0zjap7c4d8grw79349a5w6dsl8qnw";
};
infinality_patch =
···
;
propagatedBuildInputs = [ freetype ];
+
buildInputs = [ pkgconfig libxslt expat ];
configureFlags = [
"--with-cache-dir=/var/cache/fontconfig"
"--disable-docs"
+
"--with-default-fonts=${fontbhttf}"
];
# We should find a better way to access the arch reliably.
···
doCheck = true;
# Don't try to write to /var/cache/fontconfig at install time.
+
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/;
+4 -2
pkgs/development/libraries/fontconfig/make-fonts-conf.nix
···
-
{ runCommand, libxslt, fontconfig, fontDirectories }:
runCommand "fonts.conf"
{
buildInputs = [ libxslt fontconfig ];
-
inherit fontDirectories;
}
''
xsltproc --stringparam fontDirectories "$fontDirectories" \
--stringparam fontconfig "${fontconfig}" \
--path ${fontconfig}/share/xml/fontconfig \
${./make-fonts-conf.xsl} ${fontconfig}/etc/fonts/fonts.conf \
> $out
···
+
{ runCommand, libxslt, fontconfig, fontbhttf, fontDirectories }:
runCommand "fonts.conf"
{
buildInputs = [ libxslt fontconfig ];
+
# 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
+17 -5
pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
···
<xsl:param name="fontDirectories" />
<xsl:param name="fontconfig" />
<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>
<include><xsl:value-of select="$fontconfig" />/etc/fonts/conf.d</include>
<cachedir>/var/cache/fontconfig</cachedir>
-
<cachedir>~/.fontconfig</cachedir>
<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>
</fontconfig>
···
<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']" />
+
<!-- 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>
+
<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>
+
+
<!-- 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>
+3
pkgs/top-level/all-packages.nix
···
cfitsio = callPackage ../development/libraries/cfitsio { };
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;
};
freealut = callPackage ../development/libraries/freealut { };
···
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 { };