base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / vt / vte / package.nix
blob08b67f3b70f3f7e6e3ea796357176de6e39f254f
1 { stdenv
2 , lib
3 , fetchFromGitLab
4 , fetchpatch
5 , gettext
6 , pkg-config
7 , meson
8 , ninja
9 , gnome
10 , glib
11 , gtk3
12 , gtk4
13 , gtkVersion ? "3"
14 , gobject-introspection
15 , vala
16 , python3
17 , gi-docgen
18 , libxml2
19 , gnutls
20 , gperf
21 , pango
22 , pcre2
23 , cairo
24 , fribidi
25 , lz4
26 , icu
27 , systemd
28 , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
29 , fast-float
30 , nixosTests
31 , blackbox-terminal
34 stdenv.mkDerivation (finalAttrs: {
35   pname = "vte";
36   version = "0.78.1";
38   outputs = [ "out" "dev" ]
39     ++ lib.optional (gtkVersion != null) "devdoc";
41   src = fetchFromGitLab {
42     domain = "gitlab.gnome.org";
43     owner = "GNOME";
44     repo = "vte";
45     rev = finalAttrs.version;
46     hash = "sha256-dVCvf4eTIJlrSzG6xLdKU47N9uAtHDwRrGkWtSmqbEU=";
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     cairo
92     fribidi
93     gnutls
94     pango # duplicated with propagatedBuildInputs to support gtkVersion == null
95     pcre2
96     lz4
97     icu
98     fast-float
99   ] ++ lib.optionals systemdSupport [
100     systemd
101   ];
103   # Required by vte-2.91.pc.
104   propagatedBuildInputs = lib.optionals (gtkVersion != null) [
105     (assert (gtkVersion == "3" || gtkVersion == "4");
106     if gtkVersion == "3" then gtk3 else gtk4)
107     glib
108     pango
109   ];
111   mesonFlags = [
112     "-Ddocs=true"
113     (lib.mesonBool "gtk3" (gtkVersion == "3"))
114     (lib.mesonBool "gtk4" (gtkVersion == "4"))
115   ] ++ lib.optionals (!systemdSupport) [
116     "-D_systemd=false"
117   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
118     # -Bsymbolic-functions is not supported on darwin
119     "-D_b_symbolic_functions=false"
120   ];
122   # error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
123   env.NIX_CFLAGS_COMPILE = toString (lib.optional stdenv.hostPlatform.isMusl "-Wno-unused-command-line-argument"
124     ++ lib.optional stdenv.cc.isClang "-Wno-cast-function-type-strict");
126   postPatch = ''
127     patchShebangs perf/*
128     patchShebangs src/parser-seq.py
129     patchShebangs src/minifont-coverage.py
130     patchShebangs src/modes.py
131   '';
133   postFixup = ''
134     # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
135     moveToOutput "share/doc" "$devdoc"
136   '';
138   passthru = {
139     updateScript = gnome.updateScript {
140       packageName = "vte";
141       versionPolicy = "odd-unstable";
142     };
143     tests = {
144       inherit (nixosTests.terminal-emulators) gnome-terminal lxterminal mlterm roxterm sakura stupidterm terminator termite xfce4-terminal;
145       blackbox-terminal = blackbox-terminal.override { sixelSupport = true; };
146     };
147   };
149   meta = with lib; {
150     homepage = "https://www.gnome.org/";
151     description = "Library implementing a terminal emulator widget for GTK";
152     longDescription = ''
153       VTE is a library (libvte) implementing a terminal emulator widget for
154       GTK, and a minimal sample application (vte) using that.  Vte is
155       mainly used in gnome-terminal, but can also be used to embed a
156       console/terminal in games, editors, IDEs, etc. VTE supports Unicode and
157       character set conversion, as well as emulating any terminal known to
158       the system's terminfo database.
159     '';
160     license = licenses.lgpl3Plus;
161     maintainers = with maintainers; [ astsmtl antono ] ++ teams.gnome.members;
162     platforms = platforms.unix;
163   };