about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/fontconfig
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-10 07:13:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-12 14:07:16 +0000
commite2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch)
tree79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/development/libraries/fontconfig
parent1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff)
parent84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff)
downloadnixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/fontconfig')
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch28
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/default.nix104
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/fix-joypixels.patch23
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix2
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix2
-rw-r--r--nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl13
7 files changed, 80 insertions, 139 deletions
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix b/nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix
deleted file mode 100644
index f4cc29892451..000000000000
--- a/nixpkgs/pkgs/development/libraries/fontconfig/2.10.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{ 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";
-  };
-
-  outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
-
-  propagatedBuildInputs = [ freetype ];
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ expat ];
-
-  configureFlags = [
-    "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
-    "--sysconfdir=/etc"
-    "--with-cache-dir=/var/cache/fontconfig"
-    "--disable-docs"
-    "--with-default-fonts="
-  ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
-    "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
-  ];
-
-  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" ];
-
-  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 ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch b/nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch
deleted file mode 100644
index e86f08fb553c..000000000000
--- a/nixpkgs/pkgs/development/libraries/fontconfig/config-compat.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-commit 05c6adf8104b4321d3a3716a7b9feb6bf223ed0c (HEAD, nixpkgs)
-Author: Vladimír Čunát <vcunat@gmail.com>
-Date:   Tue Nov 4 12:24:25 2014 +0100
-
-    add check for /etc/fonts/@configVersion@/fonts.conf
-    
-    It's checked between FONTCONFIG_FILE and the usual /etc/fonts/fonts.conf.
-    Also, hardcode /etc/fonts/fonts.conf to prevent accidental override.
-
-diff --git a/src/fccfg.c b/src/fccfg.c
-index 6377fd7..e9eb10a 100644
---- a/src/fccfg.c
-+++ b/src/fccfg.c
-@@ -2070,8 +2070,13 @@ FcConfigFilename (const FcChar8 *url)
-     if (!url || !*url)
-     {
- 	url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
-+	if (!url) {
-+	    static const FcChar8 *cfPath = "/etc/fonts/@configVersion@/fonts.conf";
-+	    if (access (cfPath, R_OK) == 0)
-+		url = cfPath;
-+	}
- 	if (!url)
--	    url = (FcChar8 *) FONTCONFIG_FILE;
-+	    url = (FcChar8 *) "/etc/fonts/fonts.conf";
-     }
-     file = 0;
- 
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/default.nix b/nixpkgs/pkgs/development/libraries/fontconfig/default.nix
index 0518cb257ab2..72df121200e0 100644
--- a/nixpkgs/pkgs/development/libraries/fontconfig/default.nix
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/default.nix
@@ -1,47 +1,86 @@
-{ stdenv, substituteAll, fetchurl
-, pkgconfig, freetype, expat, libxslt, gperf, dejavu_fonts
+{ stdenv
+, fetchpatch
+, substituteAll
+, fetchurl
+, pkg-config
+, freetype
+, expat
+, libxslt
+, gperf
+, dejavu_fonts
+, autoreconfHook
 }:
 
-/** Font configuration scheme
- - ./config-compat.patch makes fontconfig try the following root configs, in order:
-    $FONTCONFIG_FILE, /etc/fonts/${configVersion}/fonts.conf, /etc/fonts/fonts.conf
-    This is done not to override config of pre-2.11 versions (which just blow up)
-    and still use *global* font configuration at both NixOS or non-NixOS.
- - NixOS creates /etc/fonts/${configVersion}/fonts.conf link to $out/etc/fonts/fonts.conf,
-    and other modifications should go to /etc/fonts/${configVersion}/conf.d
- - See ./make-fonts-conf.xsl for config details.
-
-*/
-
-let
-  configVersion = "2.11"; # bump whenever fontconfig breaks compatibility with older configurations
-in
 stdenv.mkDerivation rec {
   pname = "fontconfig";
-  version = "2.12.6";
+  version = "2.13.92";
 
   src = fetchurl {
-    url = "http://fontconfig.org/release/${pname}-${version}.tar.bz2";
-    sha256 = "05zh65zni11kgnhg726gjbrd55swspdvhqbcnj5a5xh8gn03036g";
+    url = "http://fontconfig.org/release/${pname}-${version}.tar.xz";
+    sha256 = "0kkfsvxcvcphm9zcgsh646gix3qn4spz555wa1jp5hbq70l62vjh";
   };
 
   patches = [
-    (substituteAll {
-      src = ./config-compat.patch;
-      inherit configVersion;
+    # Fix fonts not being loaded when missing included configs that have ignore_missing="yes".
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1744377
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/fcada522913e5e07efa6367eff87ace9f06d24c8.patch";
+      sha256 = "1jbm3vw45b3qjnqrh2545v1k8vmb29c09v2wj07jnrq3lnchbvmn";
     })
 
+    # Register JoyPixels as an emoji font.
     # https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/67
-    ./fix-joypixels.patch
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/65087ac7ce4cc5f2109967c1380b474955dcb590.patch";
+      sha256 = "1dkrbqx1c1d8yfnx0igvv516wanw2ksrpm3fbpm2h9nw0hccwqvm";
+    })
+
+    # Fix invalid DTD in reset-dirs.
+    # https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/78
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/a4aa66a858f1ecd375c5efe5916398281f73f794.patch";
+      sha256 = "1j4ky8jhpllfm1lh2if34xglh2hl79nsa0xxgzxpj9sx6h4v99j5";
+    })
+
+    # Do not include its tags, they are external now and only cause warnings with old fontconfig clients.
+    # https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/97
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/528b17b2837c3b102acd90cc7548d07bacaccb1f.patch";
+      sha256 = "1zf4wcd2xlprh805jalfy8ja5c2qzgkh4fwd1m9d638nl9gx932m";
+    })
+    # https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/100
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/37c7c748740bf6f2468d59e67951902710240b34.patch";
+      sha256 = "1rz5zrfwhpn9g49wrzzrmdglj78pbvpnw8ksgsw6bxq8l5d84jfr";
+    })
+
+    # Show warning instead of error when encountering unknown attribute in config.
+    # https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/111
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/409b37c62780728755c908991c912a6b16f2389c.patch";
+      sha256 = "zJFh37QErSAINPGFkFVJyhYRP27BuIN7PIgoDl/PIwI=";
+    })
   ];
 
   outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
 
-  propagatedBuildInputs = [ freetype ];
-  nativeBuildInputs = [ pkgconfig gperf libxslt ];
-  buildInputs = [ expat ];
+  nativeBuildInputs = [
+    gperf
+    libxslt
+    pkg-config
+    autoreconfHook
+  ];
+
+  buildInputs = [
+    expat
+  ];
+
+  propagatedBuildInputs = [
+    freetype
+  ];
 
   configureFlags = [
+    "--sysconfdir=/etc"
     "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
     "--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/
     "--disable-docs"
@@ -55,23 +94,22 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  # Don't try to write to /var/cache/fontconfig at install time.
-  installFlags = [ "fc_cachedir=$(TMPDIR)/dummy" "RUN_FC_CACHE_TEST=false" ];
+  installFlags = [
+    # Don't try to write to /var/cache/fontconfig at install time.
+    "fc_cachedir=$(TMPDIR)/dummy"
+    "RUN_FC_CACHE_TEST=false"
+    "sysconfdir=${placeholder "out"}/etc"
+  ];
 
   postInstall = ''
     cd "$out/etc/fonts"
     xsltproc --stringparam fontDirectories "${dejavu_fonts.minimal}" \
-      --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/";
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/fix-joypixels.patch b/nixpkgs/pkgs/development/libraries/fontconfig/fix-joypixels.patch
deleted file mode 100644
index d5654063fe89..000000000000
--- a/nixpkgs/pkgs/development/libraries/fontconfig/fix-joypixels.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/conf.d/45-generic.conf
-+++ b/conf.d/45-generic.conf
-@@ -5,6 +5,10 @@
- 
- <!-- Emoji -->
- 
-+	<alias binding="same">
-+		<family>JoyPixels</family>
-+		<default><family>emoji</family></default>
-+	</alias>
- 	<alias binding="same">
- 		<family>Emoji Two</family>
- 		<default><family>emoji</family></default>
---- a/conf.d/60-generic.conf
-+++ b/conf.d/60-generic.conf
-@@ -29,6 +29,7 @@
- 	<alias binding="same">
- 		<family>emoji</family>
- 		<prefer>
-+			<family>JoyPixels</family>
- 			<family>Emoji Two</family>
- 			<family>Emoji One</family>
- 			<!-- System fonts -->
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix
index f1a2e865bb73..47884b9c3b92 100644
--- a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-cache.nix
@@ -16,7 +16,7 @@ runCommand "fc-cache"
 
     cat > fonts.conf << EOF
     <?xml version='1.0'?>
-    <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
+    <!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
     <fontconfig>
       <include>${fontconfig.out}/etc/fonts/fonts.conf</include>
       <cachedir>$out</cachedir>
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
index b18d72e0a228..493f662d0ce3 100644
--- a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
@@ -9,8 +9,6 @@ runCommand "fonts.conf"
   }
   ''
     xsltproc --stringparam fontDirectories "$fontDirectories" \
-      --stringparam fontconfig "${fontconfig.out}" \
-      --stringparam fontconfigConfigVersion "${fontconfig.configVersion}" \
       --path ${fontconfig.out}/share/xml/fontconfig \
       ${./make-fonts-conf.xsl} ${fontconfig.out}/etc/fonts/fonts.conf \
       > $out
diff --git a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
index dddbbe9e516b..ed51b62a1d08 100644
--- a/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
+++ b/nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
@@ -12,11 +12,9 @@
                 extension-element-prefixes="str"
                 >
 
-  <xsl:output method='xml' encoding="UTF-8" doctype-system="fonts.dtd" />
+  <xsl:output method='xml' encoding="UTF-8" doctype-system="urn:fontconfig:fonts.dtd" />
 
   <xsl:param name="fontDirectories" />
-  <xsl:param name="fontconfig" />
-  <xsl:param name="fontconfigConfigVersion" />
 
   <xsl:template match="/fontconfig">
 
@@ -28,8 +26,8 @@
       <!-- /var/cache/fontconfig is useful for non-nixos systems -->
       <cachedir>/var/cache/fontconfig</cachedir>
 
-      <!-- versioned system-wide config -->
-      <include ignore_missing="yes">/etc/fonts/<xsl:value-of select="$fontconfigConfigVersion" />/conf.d</include>
+      <!-- system-wide config -->
+      <include ignore_missing="yes">/etc/fonts/conf.d</include>
 
       <dir prefix="xdg">fonts</dir>
       <xsl:for-each select="str:tokenize($fontDirectories)">
@@ -40,6 +38,11 @@
       <!-- nix user profile -->
       <dir>~/.nix-profile/lib/X11/fonts</dir>
       <dir>~/.nix-profile/share/fonts</dir>
+
+      <!-- FHS paths for non-NixOS platforms -->
+      <dir>/usr/share/fonts</dir>
+      <dir>/usr/local/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>