1{ lib
2, stdenv
3, fetchurl
4, pkg-config
5, cairo
6, harfbuzz
7, libintl
8, libthai
9, darwin
10, fribidi
11, gnome
12, gi-docgen
13, makeFontsConf
14, freefont_ttf
15, meson
16, ninja
17, glib
18, python3
19, x11Support? !stdenv.isDarwin, libXft
20, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
21, buildPackages, gobject-introspection
22, testers
23}:
24
25stdenv.mkDerivation (finalAttrs: {
26 pname = "pango";
27 version = "1.52.2";
28
29 outputs = [ "bin" "out" "dev" ] ++ lib.optional withIntrospection "devdoc";
30
31 src = fetchurl {
32 url = with finalAttrs; "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
33 hash = "sha256-0Adq/gEIKBS4U97smfk0ns5fLOg5CLjlj/c2tB94qWs=";
34 };
35
36 depsBuildBuild = [
37 pkg-config
38 ];
39
40 nativeBuildInputs = [
41 meson ninja
42 glib # for glib-mkenum
43 pkg-config
44 python3
45 ] ++ lib.optionals withIntrospection [
46 gi-docgen
47 gobject-introspection
48 ];
49
50 buildInputs = [
51 fribidi
52 libthai
53 ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
54 ApplicationServices
55 Carbon
56 CoreGraphics
57 CoreText
58 ]);
59
60 propagatedBuildInputs = [
61 cairo
62 glib
63 libintl
64 harfbuzz
65 ] ++ lib.optionals x11Support [
66 libXft
67 ];
68
69 mesonFlags = [
70 (lib.mesonBool "gtk_doc" withIntrospection)
71 (lib.mesonEnable "introspection" withIntrospection)
72 (lib.mesonEnable "xft" x11Support)
73 ];
74
75 # Fontconfig error: Cannot load default config file
76 FONTCONFIG_FILE = makeFontsConf {
77 fontDirectories = [ freefont_ttf ];
78 };
79
80 # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
81 # it should be a build-time dep for build
82 # TODO: send upstream
83 postPatch = ''
84 substituteInPlace docs/meson.build \
85 --replace "'gi-docgen', req" "'gi-docgen', native:true, req"
86 '';
87
88 doCheck = false; # test-font: FAIL
89
90 postFixup = ''
91 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
92 moveToOutput "share/doc" "$devdoc"
93 '';
94
95 passthru = {
96 updateScript = gnome.updateScript {
97 packageName = finalAttrs.pname;
98 # 1.90 is alpha for API 2.
99 freeze = "1.90.0";
100 };
101 tests = {
102 pkg-config = testers.hasPkgConfigModules {
103 package = finalAttrs.finalPackage;
104 };
105 };
106 };
107
108 meta = with lib; {
109 description = "Library for laying out and rendering of text, with an emphasis on internationalization";
110
111 longDescription = ''
112 Pango is a library for laying out and rendering of text, with an
113 emphasis on internationalization. Pango can be used anywhere
114 that text layout is needed, though most of the work on Pango so
115 far has been done in the context of the GTK widget toolkit.
116 Pango forms the core of text and font handling for GTK.
117 '';
118
119 homepage = "https://www.pango.org/";
120 license = licenses.lgpl2Plus;
121
122 maintainers = with maintainers; [ raskin ] ++ teams.gnome.members;
123 platforms = platforms.unix;
124
125 pkgConfigModules = [
126 "pango"
127 "pangocairo"
128 "pangofc"
129 "pangoft2"
130 "pangoot"
131 "pangoxft"
132 ];
133 };
134})