Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 108 lines 2.6 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 pkg-config, 6 python3, 7 freetype, 8 expat, 9 libxslt, 10 gperf, 11 dejavu_fonts, 12 autoreconfHook, 13 testers, 14}: 15 16stdenv.mkDerivation (finalAttrs: { 17 pname = "fontconfig"; 18 version = "2.16.0"; 19 20 outputs = [ 21 "bin" 22 "dev" 23 "lib" 24 "out" 25 ]; # $out contains all the config 26 27 src = fetchurl { 28 url = 29 with finalAttrs; 30 "https://www.freedesktop.org/software/fontconfig/release/${pname}-${version}.tar.xz"; 31 hash = "sha256-ajPcVVzJuosQyvdpWHjvE07rNtCvNmBB9jmx2ptu0iA="; 32 }; 33 34 nativeBuildInputs = [ 35 autoreconfHook 36 gperf 37 libxslt 38 pkg-config 39 python3 40 ]; 41 42 buildInputs = [ 43 expat 44 ]; 45 46 propagatedBuildInputs = [ 47 freetype 48 ]; 49 50 postPatch = '' 51 # Requires networking. 52 sed -i '/check_PROGRAMS += test-crbug1004254/d' test/Makefile.am 53 54 # Test causes error without patch shebangs. 55 patchShebangs doc/check-whitespace-in-args.py 56 ''; 57 58 configureFlags = 59 [ 60 "--sysconfdir=/etc" 61 "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}" 62 "--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/ 63 # just <1MB; this is what you get when loading config fails for some reason 64 "--with-default-fonts=${dejavu_fonts.minimal}" 65 ] 66 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 67 "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}" 68 ]; 69 70 enableParallelBuilding = true; 71 72 doCheck = true; 73 74 installFlags = [ 75 # Don't try to write to /var/cache/fontconfig at install time. 76 "fc_cachedir=$(TMPDIR)/dummy" 77 "RUN_FC_CACHE_TEST=false" 78 "sysconfdir=${placeholder "out"}/etc" 79 ]; 80 81 postInstall = '' 82 cd "$out/etc/fonts" 83 xsltproc --stringparam fontDirectories "${dejavu_fonts.minimal}" \ 84 --stringparam includes /etc/fonts/conf.d \ 85 --path $out/share/xml/fontconfig \ 86 ${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \ 87 > fonts.conf.tmp 88 mv fonts.conf.tmp $out/etc/fonts/fonts.conf 89 # We don't keep section 3 of the manpages, as they are quite large and 90 # probably not so useful. 91 rm -r $bin/share/man/man3 92 ''; 93 94 passthru.tests = { 95 pkg-config = testers.hasPkgConfigModules { 96 package = finalAttrs.finalPackage; 97 }; 98 }; 99 100 meta = with lib; { 101 description = "Library for font customization and configuration"; 102 homepage = "http://fontconfig.org/"; 103 license = licenses.bsd2; # custom but very bsd-like 104 platforms = platforms.all; 105 teams = [ teams.freedesktop ]; 106 pkgConfigModules = [ "fontconfig" ]; 107 }; 108})