git.iko.soy/typeable/nixpkgs
on master help sign in
termite: Add support for macOS (#43415)

Replace fetchgit with fetchFromGitHub now that it supports fetching submodules. Remove unnecessary postPatch to add <math.h> as termite already includes <cmath>. Add a patch to include <errno.h> on all platforms and remove the --as-needed flag from ld on macOS.

commitd73fac6b102ae6a77d0e07647f87f00e09d100b9 authorMichael Hoang <Enzime@users.noreply.github.com> dateSat 14 Jul 2018, 09:00 (8 years ago) parent1e4cd7a
3 files changed+57−7
pkgs/applications/misc/termite/add_errno_header.patch+24 pkgs/applications/misc/termite/default.nix+8−7 pkgs/applications/misc/termite/remove_ldflags_macos.patch+25
pkgs/applications/misc/termite/add_errno_header.patchnew file+24
@@ -0,0 +1,24 @@
1+From 95c90f302c384f410dc92e64468ac7061b57fe2d Mon Sep 17 00:00:00 2001
2+From: Michael Hoang <enzime@users.noreply.github.com>
3+Date: Fri, 13 Jul 2018 19:03:09 +1000
4+Subject: [PATCH] Add errno.h header which isn't always included automatically.
5+
6+---
7+ termite.cc | 1 +
8+ 1 file changed, 1 insertion(+)
9+
10+diff --git a/termite.cc b/termite.cc
11+index 160fe82..13e2572 100644
12+--- a/termite.cc
13++++ b/termite.cc
14+@@ -21,6 +21,7 @@
15+ #include <cstdlib>
16+ #include <cstring>
17+ #include <cmath>
18++#include <errno.h>
19+ #include <functional>
20+ #include <limits>
21+ #include <map>
22+--
23+2.17.1
24+
pkgs/applications/misc/termite/default.nix+8−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchgit, pkgconfig, vte, gtk3, ncurses, makeWrapper, wrapGAppsHook, symlinkJoin
1+{ stdenv, fetchFromGitHub, lib, pkgconfig, vte, gtk3, ncurses, makeWrapper, wrapGAppsHook, symlinkJoin
22, configFile ? null
33}:
44
@@ -7,16 +7,17 @@ let
77 termite = stdenv.mkDerivation {
88 name = "termite-${version}";
99
10− src = fetchgit {
11− url = "https://github.com/thestinger/termite";
12− rev = "refs/tags/v${version}";
10+ src = fetchFromGitHub {
11+ owner = "thestinger";
12+ repo = "termite";
13+ rev = "v${version}";
1314 sha256 = "02cn70ygl93ghhkhs3xdxn5b1yadc255v3yp8cmhhyzsv5027hvj";
15+ fetchSubmodules = true;
1416 };
1517
1618 # https://github.com/thestinger/termite/pull/516
17− patches = [ ./url_regexp_trailing.patch ];
18−
19− postPatch = "sed '1i#include <math.h>' -i termite.cc";
19+ patches = [ ./url_regexp_trailing.patch ./add_errno_header.patch
20+ ] ++ lib.optional stdenv.isDarwin ./remove_ldflags_macos.patch;
2021
2122 makeFlags = [ "VERSION=v${version}" "PREFIX=" "DESTDIR=$(out)" ];
2223
pkgs/applications/misc/termite/remove_ldflags_macos.patchnew file+25
@@ -0,0 +1,25 @@
1+From 1b5a6934635c55472eb7949bd87ab3f45fa1b2f3 Mon Sep 17 00:00:00 2001
2+From: Michael Hoang <enzime@users.noreply.github.com>
3+Date: Fri, 13 Jul 2018 19:01:51 +1000
4+Subject: [PATCH] Remove --as-needed flag from ld to fix compilation on macOS.
5+
6+---
7+ Makefile | 2 +-
8+ 1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+diff --git a/Makefile b/Makefile
11+index b115f42..ab301ba 100644
12+--- a/Makefile
13++++ b/Makefile
14+@@ -29,7 +29,7 @@ ifeq (${CXX}, clang++)
15+ CXXFLAGS += -Wimplicit-fallthrough
16+ endif
17+
18+-LDFLAGS := -s -Wl,--as-needed ${LDFLAGS}
19++LDFLAGS := -s -Wl ${LDFLAGS}
20+ LDLIBS := ${shell pkg-config --libs ${GTK} ${VTE}}
21+
22+ termite: termite.cc url_regex.hh util/clamp.hh util/maybe.hh util/memory.hh
23+--
24+2.17.1
25+