2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2022-01-13 20:06:32 +00:00
|
|
|
, fetchpatch
|
2020-08-20 17:08:02 +00:00
|
|
|
, substituteAll
|
|
|
|
, fetchurl
|
|
|
|
, pkg-config
|
2021-07-14 22:03:04 +00:00
|
|
|
, python3
|
2020-08-20 17:08:02 +00:00
|
|
|
, freetype
|
|
|
|
, expat
|
|
|
|
, libxslt
|
|
|
|
, gperf
|
|
|
|
, dejavu_fonts
|
|
|
|
, autoreconfHook
|
2021-04-12 18:23:04 +00:00
|
|
|
, CoreFoundation
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fontconfig";
|
2021-07-21 07:28:18 +00:00
|
|
|
version = "2.13.94";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-21 07:28:18 +00:00
|
|
|
url = "https://www.freedesktop.org/software/fontconfig/release/${pname}-${version}.tar.xz";
|
|
|
|
sha256 = "0g004r0bkkqz00mpm3svnnxn7d83158q0yb9ggxryizxfg5m5w55";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
patches = [
|
|
|
|
# Fix font style detection
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/92fbf14b0d7c4737ffe1e8326b7ab8ffae5548c3.patch";
|
|
|
|
sha256 = "1wmyax2151hg3m11q61mv25k45zk2w3xapb4p1r6wzk91zjlsgyr";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
nativeBuildInputs = [
|
2021-07-14 22:03:04 +00:00
|
|
|
autoreconfHook
|
2020-08-20 17:08:02 +00:00
|
|
|
gperf
|
|
|
|
libxslt
|
|
|
|
pkg-config
|
2021-07-14 22:03:04 +00:00
|
|
|
python3
|
2020-08-20 17:08:02 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
expat
|
2021-04-12 18:23:04 +00:00
|
|
|
] ++ lib.optional stdenv.isDarwin CoreFoundation;
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
freetype
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Requires networking.
|
|
|
|
sed -i '/check_PROGRAMS += test-crbug1004254/d' test/Makefile.am
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
configureFlags = [
|
2020-09-25 04:45:31 +00:00
|
|
|
"--sysconfdir=/etc"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
|
|
|
|
"--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/
|
|
|
|
# just <1MB; this is what you get when loading config fails for some reason
|
|
|
|
"--with-default-fonts=${dejavu_fonts.minimal}"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
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"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
cd "$out/etc/fonts"
|
|
|
|
xsltproc --stringparam fontDirectories "${dejavu_fonts.minimal}" \
|
|
|
|
--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
|
2020-11-21 19:51:51 +00:00
|
|
|
# We don't keep section 3 of the manpages, as they are quite large and
|
|
|
|
# probably not so useful.
|
|
|
|
rm -r $bin/share/man/man3
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A library for font customization and configuration";
|
|
|
|
homepage = "http://fontconfig.org/";
|
|
|
|
license = licenses.bsd2; # custom but very bsd-like
|
|
|
|
platforms = platforms.all;
|
2021-05-20 23:08:51 +00:00
|
|
|
maintainers = with maintainers; teams.freedesktop.members ++ [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|