diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite')
8 files changed, 314 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/add_errno_header.patch b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/add_errno_header.patch new file mode 100644 index 000000000000..81283f86a21d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/add_errno_header.patch @@ -0,0 +1,24 @@ +From 95c90f302c384f410dc92e64468ac7061b57fe2d Mon Sep 17 00:00:00 2001 +From: Michael Hoang <enzime@users.noreply.github.com> +Date: Fri, 13 Jul 2018 19:03:09 +1000 +Subject: [PATCH] Add errno.h header which isn't always included automatically. + +--- + termite.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/termite.cc b/termite.cc +index 160fe82..13e2572 100644 +--- a/termite.cc ++++ b/termite.cc +@@ -21,6 +21,7 @@ + #include <cstdlib> + #include <cstring> + #include <cmath> ++#include <errno.h> + #include <functional> + #include <limits> + #include <map> +-- +2.17.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/default.nix new file mode 100644 index 000000000000..2f991ca1c7e6 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/default.nix @@ -0,0 +1,77 @@ +{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, vte, gtk3, ncurses, pcre2, wrapGAppsHook }: + +let + + # termite requires VTE with some internals exposed + # https://github.com/thestinger/vte-ng + # + # three of the patches have been locally modified to cleanly apply on 0.62 + vte-ng = vte.overrideAttrs (attrs: { + patches = attrs.patches or [] ++ [ + (fetchpatch { + name = "0001-expose-functions-for-pausing-unpausing-output.patch"; + url = "https://github.com/thestinger/vte-ng/commit/342e26574f50dcd40bbeaad9e839c2a6144d0c1c.patch"; + sha256 = "1b0k9ys545q85vfki417p21kis9f36yd0hyp12phayynss6fn715"; + }) + # Derived from https://github.com/thestinger/vte-ng/commit/5ae3acb69474fe5bc43767a4a3625e9ed23607a1.patch + ./vte-ng-modified-patches/vte-0002-expose-function-for-setting-cursor-position.patch + # Derived from https://github.com/thestinger/vte-ng/commit/742d57ecf15e24f6a5f2133a81b6c70acc8ff03c.patch + ./vte-ng-modified-patches/vte-0003-add-function-for-setting-the-text-selections.patch + (fetchpatch { + name = "0004-add-functions-to-get-set-block-selection-mode.patch"; + url = "https://github.com/thestinger/vte-ng/commit/08748fd9cb82bd191e5c476b1682ca71f7732572.patch"; + sha256 = "1cnhd8f7ywdgcyd6xmcd2nn39jjxzkxp4d0zsj2k7m5v74nhcs1g"; + }) + # Derived from "https://github.com/thestinger/vte-ng/commit/dd74ae7c06e8888af2fc090ac6f8920a9d8227fb.patch"; + ./vte-ng-modified-patches/vte-0005-expose-function-for-getting-the-selected-text.patch + ]; + }); + +in stdenv.mkDerivation rec { + pname = "termite"; + version = "15"; + + src = fetchFromGitHub { + owner = "thestinger"; + repo = "termite"; + rev = "v${version}"; + sha256 = "0hp1x6lj098m3jgna274wv5dv60lnzg22297di68g4hw9djjyd2k"; + fetchSubmodules = true; + }; + + # https://github.com/thestinger/termite/pull/516 + patches = [ ./url_regexp_trailing.patch ./add_errno_header.patch + # Fix off-by-one in select_text() on libvte >= 0.55.0 + # Expected to be included in next release (16). + (fetchpatch { + url = "https://github.com/thestinger/termite/commit/7e9a93b421b9596f8980645a46ac2ad5468dac06.patch"; + sha256 = "0vph2m5919f7w1xnc8i6z0j44clsm1chxkfg7l71nahxyfw5yh4j"; + }) + ] ++ stdenv.lib.optional stdenv.isDarwin ./remove_ldflags_macos.patch; + + makeFlags = [ "VERSION=v${version}" "PREFIX=" "DESTDIR=$(out)" ]; + + buildInputs = [ vte-ng gtk3 ncurses pcre2 ]; + + nativeBuildInputs = [ wrapGAppsHook pkgconfig ]; + + outputs = [ "out" "terminfo" ]; + + passthru = { inherit vte-ng; }; + + postInstall = '' + mkdir -p $terminfo/share + mv $out/share/terminfo $terminfo/share/terminfo + + mkdir -p $out/nix-support + echo "$terminfo" >> $out/nix-support/propagated-user-env-packages + ''; + + meta = with stdenv.lib; { + description = "A simple VTE-based terminal"; + license = licenses.lgpl2Plus; + homepage = "https://github.com/thestinger/termite/"; + maintainers = with maintainers; [ koral ]; + platforms = platforms.all; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/remove_ldflags_macos.patch b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/remove_ldflags_macos.patch new file mode 100644 index 000000000000..f8c68518bb4d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/remove_ldflags_macos.patch @@ -0,0 +1,25 @@ +From 1b5a6934635c55472eb7949bd87ab3f45fa1b2f3 Mon Sep 17 00:00:00 2001 +From: Michael Hoang <enzime@users.noreply.github.com> +Date: Fri, 13 Jul 2018 19:01:51 +1000 +Subject: [PATCH] Remove --as-needed flag from ld to fix compilation on macOS. + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index b115f42..ab301ba 100644 +--- a/Makefile ++++ b/Makefile +@@ -29,7 +29,7 @@ ifeq (${CXX}, clang++) + CXXFLAGS += -Wimplicit-fallthrough + endif + +-LDFLAGS := -s -Wl,--as-needed ${LDFLAGS} ++LDFLAGS := -s -Wl ${LDFLAGS} + LDLIBS := ${shell pkg-config --libs ${GTK} ${VTE}} + + termite: termite.cc url_regex.hh util/clamp.hh util/maybe.hh util/memory.hh +-- +2.17.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/url_regexp_trailing.patch b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/url_regexp_trailing.patch new file mode 100644 index 000000000000..96deaa073d71 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/url_regexp_trailing.patch @@ -0,0 +1,27 @@ +Based on https://github.com/thestinger/termite/pull/516 +Modified to apply to v13 + +From 65a454ffa8e681f3f14729cba7c42e1570a85e8a Mon Sep 17 00:00:00 2001 +From: Paul Baecher <pbaecher@gmail.com> +Date: Thu, 7 Sep 2017 22:58:51 +0200 +Subject: [PATCH] Do not match punctuation at the end of URLs + +Punctuation at the end of URLs is most likely part of natural language +or markup (for example in Markdown). Do not match it as part of the URL. +--- + url_regex.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/url_regex.hh b/url_regex.hh +index 2ec6be8..3039b53 100644 +--- a/url_regex.hh ++++ b/url_regex.hh +@@ -9,7 +9,7 @@ + #define PORT "(?:\\:[[:digit:]]{1,5})?" + #define SCHEME "(?:[[:alpha:]][+-.[:alnum:]]*:)" + #define USERPASS USERCHARS_CLASS "+(?:\\:" PASSCHARS_CLASS "+)?" +-#define URLPATH "(?:/[[:alnum:]\\Q-_.!~*'();/?:@&=+$,#%\\E]*)?" ++#define URLPATH "(?:/[[:alnum:]\\Q-_.!~*'();/?:@&=+$,#%\\E]*(?<![\\Q.,:;()!?\\E]))?" + + const char * const url_regex = SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH; + diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0002-expose-function-for-setting-cursor-position.patch b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0002-expose-function-for-setting-cursor-position.patch new file mode 100644 index 000000000000..8f5c0dab39ad --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0002-expose-function-for-setting-cursor-position.patch @@ -0,0 +1,61 @@ +From 5ae3acb69474fe5bc43767a4a3625e9ed23607a1 Mon Sep 17 00:00:00 2001 +From: Jelle van der Waa <jelle@vdwaa.nl> +Date: Sat, 13 Feb 2016 22:18:01 +0100 +Subject: [PATCH] expose function for setting cursor position + +--- + src/vte/vteterminal.h | 5 +++++ + src/vtegtk.cc | 24 ++++++++++++++++++++++++ + 2 files changed, 29 insertions(+) + +diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h +index a607e5da..9701320d 100644 +--- a/src/vte/vteterminal.h ++++ b/src/vte/vteterminal.h +@@ -378,6 +378,11 @@ _VTE_PUBLIC + void vte_terminal_get_cursor_position(VteTerminal *terminal, + glong *column, + glong *row) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); ++_VTE_PUBLIC ++void vte_terminal_set_cursor_position(VteTerminal *terminal, ++ glong column, ++ glong row) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); ++ + + _VTE_PUBLIC + char *vte_terminal_hyperlink_check_event(VteTerminal *terminal, +diff --git a/src/vtegtk.cc b/src/vtegtk.cc +index b11b780b..bdf36eac 100644 +--- a/src/vtegtk.cc ++++ b/src/vtegtk.cc +@@ -2415,6 +2415,30 @@ vte_terminal_get_cursor_position(VteTerminal *terminal, + } + } + ++/** ++ * vte_terminal_set_cursor_position ++ * @terminal: a #VteTerminal ++ * @column: the new cursor column ++ * @row: the new cursor row ++ * ++ * Set the location of the cursor. ++ */ ++void ++vte_terminal_set_cursor_position(VteTerminal *terminal, ++ long column, long row) noexcept ++{ ++ g_return_if_fail(VTE_IS_TERMINAL(terminal)); ++ ++ auto impl = IMPL(terminal); ++ impl->invalidate_cursor_once(FALSE); ++ impl->m_screen->cursor.col = column; ++ impl->m_screen->cursor.row = row; ++ impl->invalidate_cursor_once(FALSE); ++ impl->check_cursor_blink(); ++ impl->queue_cursor_moved(); ++ ++} ++ + /** + * vte_terminal_pty_new_sync: + * @terminal: a #VteTerminal diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0003-add-function-for-setting-the-text-selections.patch b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0003-add-function-for-setting-the-text-selections.patch new file mode 100644 index 000000000000..203228dae34d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0003-add-function-for-setting-the-text-selections.patch @@ -0,0 +1,56 @@ +From 742d57ecf15e24f6a5f2133a81b6c70acc8ff03c Mon Sep 17 00:00:00 2001 +From: Jelle van der Waa <jelle@vdwaa.nl> +Date: Sat, 13 Feb 2016 22:25:19 +0100 +Subject: [PATCH] add function for setting the text selections + +--- + src/vte/vteterminal.h | 4 ++++ + src/vtegtk.cc | 20 ++++++++++++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h +index 9701320d..a11b4cb7 100644 +--- a/src/vte/vteterminal.h ++++ b/src/vte/vteterminal.h +@@ -196,6 +196,10 @@ _VTE_PUBLIC + void vte_terminal_select_all(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); + _VTE_PUBLIC + void vte_terminal_unselect_all(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); ++_VTE_PUBLIC ++void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row, ++ long end_col, long end_row) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); ++ + + /* By-word selection */ + _VTE_PUBLIC +diff --git a/src/vtegtk.cc b/src/vtegtk.cc +index bdf36eac..d9e9f2ed 100644 +--- a/src/vtegtk.cc ++++ b/src/vtegtk.cc +@@ -2390,6 +2390,26 @@ vte_terminal_unselect_all(VteTerminal *terminal) + IMPL(terminal)->deselect_all(); + } + ++/** ++ * vte_terminal_select_text: ++ * @terminal: a #VteTerminal ++ * @start_col: the starting column for the selection ++ * @start_row: the starting row for the selection ++ * @end_col: the end column for the selection ++ * @end_row: the end row for the selection ++ * ++ * Sets the current selection region. ++ */ ++void ++vte_terminal_select_text(VteTerminal *terminal, ++ long start_col, long start_row, ++ long end_col, long end_row) noexcept ++{ ++ g_return_if_fail (VTE_IS_TERMINAL (terminal)); ++ ++ IMPL(terminal)->select_text(start_col, start_row, end_col, end_row); ++} ++ + /** + * vte_terminal_get_cursor_position: + * @terminal: a #VteTerminal diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0005-expose-function-for-getting-the-selected-text.patch b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0005-expose-function-for-getting-the-selected-text.patch new file mode 100644 index 000000000000..0a2c52722268 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/vte-ng-modified-patches/vte-0005-expose-function-for-getting-the-selected-text.patch @@ -0,0 +1,29 @@ +--- a/src/vte/vteterminal.h ++++ b/src/vte/vteterminal.h +@@ -204,7 +204,9 @@ + _VTE_PUBLIC + void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row, + long end_col, long end_row) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); +- ++_VTE_PUBLIC ++char * ++vte_terminal_get_selection(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); + + /* By-word selection */ + _VTE_PUBLIC +--- a/src/vtegtk.cc ++++ b/src/vtegtk.cc +@@ -2435,6 +2435,13 @@ + IMPL(terminal)->select_text(start_col, start_row, end_col, end_row); + } + ++char * ++vte_terminal_get_selection(VteTerminal *terminal) noexcept ++{ ++ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); ++ return g_strdup (IMPL(terminal)->m_selection[VTE_SELECTION_PRIMARY]->str); ++} ++ + /** + * vte_terminal_get_cursor_position: + * @terminal: a #VteTerminal diff --git a/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/wrapper.nix b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/wrapper.nix new file mode 100644 index 000000000000..379223d9076d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/terminal-emulators/termite/wrapper.nix @@ -0,0 +1,15 @@ +{ makeWrapper, symlinkJoin, configFile ? null, termite }: + +if configFile == null then termite else symlinkJoin { + name = "termite-with-config-${termite.version}"; + + paths = [ termite ]; + nativeBuildInputs = [ makeWrapper ]; + + postBuild = '' + wrapProgram $out/bin/termite \ + --add-flags "--config ${configFile}" + ''; + + passthru.terminfo = termite.terminfo; +} |