greenmask: 0.2.6 -> 0.2.7 (#378403)
[NixPkgs.git] / pkgs / by-name / fr / freetype / package.nix
bloba1644a35a3fb64c30c04f13841e3a83f95be259a
2   lib,
3   stdenv,
4   fetchurl,
5   buildPackages,
6   pkgsHostHost,
7   pkg-config,
8   which,
9   makeWrapper,
10   zlib,
11   bzip2,
12   brotli,
13   libpng,
14   gnumake,
15   glib,
17   # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
18   # LCD filtering is also known as ClearType and covered by several Microsoft patents.
19   # This option allows it to be disabled. See http://www.freetype.org/patents.html.
20   useEncumberedCode ? true,
22   # for passthru.tests
23   cairo,
24   fontforge,
25   ghostscript,
26   graphicsmagick,
27   gtk3,
28   harfbuzz,
29   imagemagick,
30   pango,
31   poppler,
32   python3,
33   qt5,
34   texmacs,
35   ttfautohint,
36   testers,
37   __flattenIncludeHackHook,
40 stdenv.mkDerivation (finalAttrs: {
41   pname = "freetype";
42   version = "2.13.3";
44   src =
45     let
46       inherit (finalAttrs) pname version;
47     in
48     fetchurl {
49       url = "mirror://savannah/${pname}/${pname}-${version}.tar.xz";
50       sha256 = "sha256-BVA1BmbUJ8dNrrhdWse7NTrLpfdpVjlZlTEanG8GMok=";
51     };
53   propagatedBuildInputs = [
54     zlib
55     bzip2
56     brotli
57     libpng
58   ]; # needed when linking against freetype
60   # dependence on harfbuzz is looser than the reverse dependence
61   nativeBuildInputs =
62     [
63       pkg-config
64       which
65       __flattenIncludeHackHook
66     ]
67     ++ lib.optional (!stdenv.hostPlatform.isWindows) makeWrapper
68     # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
69     ++ lib.optional (!stdenv.hostPlatform.isLinux) gnumake;
71   patches = [
72     ./enable-table-validation.patch
73   ] ++ lib.optional useEncumberedCode ./enable-subpixel-rendering.patch;
75   outputs = [
76     "out"
77     "dev"
78   ];
80   configureFlags = [
81     "--bindir=$(dev)/bin"
82     "--enable-freetype-config"
83   ];
85   # native compiler to generate building tool
86   CC_BUILD = "${buildPackages.stdenv.cc}/bin/cc";
88   # The asm for armel is written with the 'asm' keyword.
89   CFLAGS =
90     lib.optionalString stdenv.hostPlatform.isAarch32 "-std=gnu99"
91     + lib.optionalString stdenv.hostPlatform.is32bit " -D_FILE_OFFSET_BITS=64";
93   enableParallelBuilding = true;
95   doCheck = true;
97   # pkgsCross.mingwW64.pkg-config doesn't build
98   # makeWrapper doesn't cross-compile to windows #120726
99   postInstall =
100     ''
101       substituteInPlace $dev/bin/freetype-config \
102         --replace ${buildPackages.pkg-config} ${pkgsHostHost.pkg-config}
103     ''
104     + lib.optionalString (!stdenv.hostPlatform.isMinGW) ''
106       wrapProgram "$dev/bin/freetype-config" \
107         --set PKG_CONFIG_PATH "$PKG_CONFIG_PATH:$dev/lib/pkgconfig"
108     '';
110   passthru.tests = {
111     inherit
112       cairo
113       fontforge
114       ghostscript
115       graphicsmagick
116       gtk3
117       harfbuzz
118       imagemagick
119       pango
120       poppler
121       texmacs
122       ttfautohint
123       ;
124     inherit (python3.pkgs) freetype-py;
125     inherit (qt5) qtbase;
126     pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
127   };
129   meta = with lib; {
130     description = "Font rendering engine";
131     mainProgram = "freetype-config";
132     longDescription = ''
133       FreeType is a portable and efficient library for rendering fonts. It
134       supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
135       fonts. It has a bytecode interpreter and has an automatic hinter called
136       autofit which can be used instead of hinting instructions included in
137       fonts.
138     '';
139     homepage = "https://www.freetype.org/";
140     changelog = "https://gitlab.freedesktop.org/freetype/freetype/-/raw/VER-${
141       builtins.replaceStrings [ "." ] [ "-" ] finalAttrs.version
142     }/docs/CHANGES";
143     license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
144     platforms = platforms.all;
145     pkgConfigModules = [ "freetype2" ];
146     maintainers = with maintainers; [ ttuegel ];
147   };