nixpkgs/pkgs/development/libraries/freetype/default.nix
John Ericson ba52ae5048 treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.

The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:

```
ISA:             ARMv8   {-A, -R, -M}
                 /    \
Mode:     Aarch32     Aarch64
             |         /   \
Encoding:   A64      A32   T32
```

At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.

The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.

[1]: https://developer.arm.com/products/architecture/a-profile
2018-04-25 15:28:55 -04:00

73 lines
2.5 KiB
Nix

{ stdenv, lib, fetchurl, copyPathsToStore
, hostPlatform
, 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 optionals optionalString;
in stdenv.mkDerivation rec {
name = "freetype-${version}";
version = "2.9";
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/freetype/${name}.tar.bz2";
sha256 = "12jcdz1in20yaa55izxalg3hm1pf7nydfrzps5bzb4zgihybmzz6";
};
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 = [ "--disable-static" "--bindir=$(dev)/bin" ];
# The asm for armel is written with the 'asm' keyword.
CFLAGS = optionalString stdenv.isAarch32 "-std=gnu99";
enableParallelBuilding = true;
doCheck = true;
postInstall = glib.flattenInclude + ''
wrapProgram "$dev/bin/freetype-config" \
--set PKG_CONFIG_PATH "$PKG_CONFIG_PATH:$dev/lib/pkgconfig"
'';
crossAttrs = stdenv.lib.optionalAttrs (hostPlatform.libc or null != "msvcrt") {
# Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
# of gcc. I think it's due to the unwrapped gcc being in the PATH. I don't
# know why it's on the PATH.
configureFlags = "--disable-static CC_BUILD=gcc";
};
}