2022-07-14 12:49:19 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-08-20 17:08:02 +00:00
|
|
|
, 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";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "2.14.0";
|
|
|
|
|
|
|
|
outputs = [ "bin" "dev" "lib" "out" ]; # $out contains all the config
|
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";
|
2022-07-14 12:49:19 +00:00
|
|
|
sha256 = "3L64TJx0u/2xM9U1/hx77cnyIhqNrzkUuYTETFIOm6w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|