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