nixpkgs/pkgs/development/libraries/freetype/default.nix
Vladimír Čunát 89023c38fc
Recover the complicated situation after my bad merge
I made a mistake merge.  Reverting it in c778945806 undid the state
on master, but now I realize it crippled the git merge mechanism.
As the merge contained a mix of commits from `master..staging-next`
and other commits from `staging-next..staging`, it got the
`staging-next` branch into a state that was difficult to recover.

I reconstructed the "desired" state of staging-next tree by:
 - checking out the last commit of the problematic range: 4effe769e2
 - `git rebase -i --preserve-merges a8a018ddc0` - dropping the mistaken
   merge commit and its revert from that range (while keeping
   reapplication from 4effe769e2)
 - merging the last unaffected staging-next commit (803ca85c20)
 - fortunately no other commits have been pushed to staging-next yet
 - applying a diff on staging-next to get it into that state
2020-10-26 09:01:04 +01:00

74 lines
2.4 KiB
Nix

{ stdenv, fetchurl
, buildPackages
, pkgconfig, which, makeWrapper
, zlib, bzip2, libpng, gnumake, glib
, # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
# LCD filtering is also known as ClearType and covered by several Microsoft patents.
# This option allows it to be disabled. See http://www.freetype.org/patents.html.
useEncumberedCode ? true
}:
let
inherit (stdenv.lib) optional optionalString;
in stdenv.mkDerivation rec {
pname = "freetype";
version = "2.10.4";
meta = with stdenv.lib; {
description = "A font rendering engine";
longDescription = ''
FreeType is a portable and efficient library for rendering fonts. It
supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
fonts. It has a bytecode interpreter and has an automatic hinter called
autofit which can be used instead of hinting instructions included in
fonts.
'';
homepage = "https://www.freetype.org/";
license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
platforms = platforms.all;
maintainers = with maintainers; [ ttuegel ];
};
src = fetchurl {
url = "mirror://savannah/${pname}/${pname}-${version}.tar.xz";
sha256 = "112pyy215chg7f7fmp2l9374chhhpihbh8wgpj5nj6avj3c59a46";
};
propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
# dependence on harfbuzz is looser than the reverse dependence
nativeBuildInputs = [ pkgconfig which makeWrapper ]
# FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
++ optional (!stdenv.isLinux) gnumake;
patches =
[ ./enable-table-validation.patch
] ++
optional useEncumberedCode ./enable-subpixel-rendering.patch;
outputs = [ "out" "dev" ];
configureFlags = [ "--bindir=$(dev)/bin" "--enable-freetype-config" ];
# native compiler to generate building tool
CC_BUILD = "${buildPackages.stdenv.cc}/bin/cc";
# The asm for armel is written with the 'asm' keyword.
CFLAGS = optionalString stdenv.isAarch32 "-std=gnu99";
enableParallelBuilding = true;
doCheck = true;
postInstall = glib.flattenInclude + ''
substituteInPlace $dev/bin/freetype-config \
--replace ${buildPackages.pkgconfig} ${pkgconfig}
wrapProgram "$dev/bin/freetype-config" \
--set PKG_CONFIG_PATH "$PKG_CONFIG_PATH:$dev/lib/pkgconfig"
'';
}