audiobookshelf: 2.18.1 -> 2.19.0 (#378967)
[NixPkgs.git] / pkgs / by-name / vt / vte / package.nix
blob08aeea7a832a47c5f56487e8c14a6ed38d6b7dca
2   stdenv,
3   lib,
4   fetchurl,
5   fetchpatch,
6   gettext,
7   pkg-config,
8   meson,
9   ninja,
10   gnome,
11   glib,
12   gtk3,
13   gtk4,
14   gtkVersion ? "3",
15   gobject-introspection,
16   vala,
17   python3,
18   gi-docgen,
19   libxml2,
20   gnutls,
21   gperf,
22   pango,
23   pcre2,
24   cairo,
25   fribidi,
26   lz4,
27   icu,
28   systemd,
29   systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd,
30   fast-float,
31   nixosTests,
32   blackbox-terminal,
35 stdenv.mkDerivation (finalAttrs: {
36   pname = "vte";
37   version = "0.78.3";
39   outputs = [
40     "out"
41     "dev"
42   ] ++ lib.optional (gtkVersion != null) "devdoc";
44   src = fetchurl {
45     url = "mirror://gnome/sources/vte/${lib.versions.majorMinor finalAttrs.version}/vte-${finalAttrs.version}.tar.xz";
46     hash = "sha256-l+KsOie8V1U1iiI/VfWiUYZUqgNhv8YaGWwcLgh5jv8=";
47   };
49   patches = [
50     # VTE needs a small patch to work with musl:
51     # https://gitlab.gnome.org/GNOME/vte/issues/72
52     # Taken from https://git.alpinelinux.org/aports/tree/community/vte3
53     (fetchpatch {
54       name = "0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch";
55       url = "https://git.alpinelinux.org/aports/plain/community/vte3/fix-W_EXITCODE.patch?id=4d35c076ce77bfac7655f60c4c3e4c86933ab7dd";
56       hash = "sha256-FkVyhsM0mRUzZmS2Gh172oqwcfXv6PyD6IEgjBhy2uU=";
57     })
58     # build: Add fast_float dependency
59     # https://gitlab.gnome.org/GNOME/vte/-/issues/2823
60     (fetchpatch {
61       name = "0003-build-Add-fast_float-dependency.patch";
62       url = "https://gitlab.gnome.org/GNOME/vte/-/commit/f6095fca4d1baf950817e7010e6f1e7c313b9e2e.patch";
63       hash = "sha256-EL9PPiI5pDJOXf4Ck4nkRte/jHx/QWbxkjDFRSsp+so=";
64     })
65     (fetchpatch {
66       name = "0003-widget-termprops-Use-fast_float.patch";
67       url = "https://gitlab.gnome.org/GNOME/vte/-/commit/6c2761f51a0400772f443f12ea23a75576e195d3.patch";
68       hash = "sha256-jjM9bhl8EhtylUIQ2nMSNX3ugnkZQP/2POvSUDW0LM0=";
69     })
70     (fetchpatch {
71       name = "0003-build-Use-correct-path-to-include-fast_float.h.patch";
72       url = "https://gitlab.gnome.org/GNOME/vte/-/commit/d09330585e648b5c9991dffab4a06d1f127bf916.patch";
73       hash = "sha256-YGVXt2VojljYgTcmahQ2YEZGEysyUSwk+snQfoipJ+E=";
74     })
75   ];
77   nativeBuildInputs = [
78     gettext
79     gobject-introspection
80     gperf
81     libxml2
82     meson
83     ninja
84     pkg-config
85     vala
86     python3
87     gi-docgen
88   ];
90   buildInputs =
91     [
92       cairo
93       fribidi
94       gnutls
95       pango # duplicated with propagatedBuildInputs to support gtkVersion == null
96       pcre2
97       lz4
98       icu
99       fast-float
100     ]
101     ++ lib.optionals systemdSupport [
102       systemd
103     ];
105   # Required by vte-2.91.pc.
106   propagatedBuildInputs = lib.optionals (gtkVersion != null) [
107     (
108       assert (gtkVersion == "3" || gtkVersion == "4");
109       if gtkVersion == "3" then gtk3 else gtk4
110     )
111     glib
112     pango
113   ];
115   mesonFlags =
116     [
117       "-Ddocs=true"
118       (lib.mesonBool "gtk3" (gtkVersion == "3"))
119       (lib.mesonBool "gtk4" (gtkVersion == "4"))
120     ]
121     ++ lib.optionals (!systemdSupport) [
122       "-D_systemd=false"
123     ]
124     ++ lib.optionals stdenv.hostPlatform.isDarwin [
125       # -Bsymbolic-functions is not supported on darwin
126       "-D_b_symbolic_functions=false"
127     ];
129   # error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
130   env.NIX_CFLAGS_COMPILE = toString (
131     lib.optional stdenv.hostPlatform.isMusl "-Wno-unused-command-line-argument"
132     ++ lib.optional stdenv.cc.isClang "-Wno-cast-function-type-strict"
133   );
135   postPatch = ''
136     patchShebangs perf/*
137     patchShebangs src/parser-seq.py
138     patchShebangs src/minifont-coverage.py
139     patchShebangs src/modes.py
140   '';
142   postFixup = ''
143     # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
144     moveToOutput "share/doc" "$devdoc"
145   '';
147   passthru = {
148     updateScript = gnome.updateScript {
149       packageName = "vte";
150       versionPolicy = "odd-unstable";
151     };
152     tests = {
153       inherit (nixosTests.terminal-emulators)
154         gnome-terminal
155         lxterminal
156         mlterm
157         roxterm
158         sakura
159         stupidterm
160         terminator
161         termite
162         xfce4-terminal
163         ;
164       blackbox-terminal = blackbox-terminal.override { sixelSupport = true; };
165     };
166   };
168   meta = with lib; {
169     homepage = "https://www.gnome.org/";
170     description = "Library implementing a terminal emulator widget for GTK";
171     longDescription = ''
172       VTE is a library (libvte) implementing a terminal emulator widget for
173       GTK, and a minimal sample application (vte) using that.  Vte is
174       mainly used in gnome-terminal, but can also be used to embed a
175       console/terminal in games, editors, IDEs, etc. VTE supports Unicode and
176       character set conversion, as well as emulating any terminal known to
177       the system's terminfo database.
178     '';
179     license = licenses.lgpl3Plus;
180     maintainers =
181       with maintainers;
182       [
183         astsmtl
184         antono
185       ]
186       ++ teams.gnome.members;
187     platforms = platforms.unix;
188   };