summary refs log tree commit diff
path: root/pkgs/tools/text
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2020-08-05 09:17:35 +0100
committerGitHub <noreply@github.com>2020-08-05 09:17:35 +0100
commit8e2b14aceb1d40c7e8b84c03a7c78955359872bb (patch)
tree37152f0d2ca446b6f1118c63ce15379ccfd93eb7 /pkgs/tools/text
parent7b0fd2105ccff94d8c64c0deb9ec17dcf3563097 (diff)
parentf585a26878ea415e3b2c65b34fe1bdf5e5559795 (diff)
downloadnixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar
nixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar.gz
nixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar.bz2
nixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar.lz
nixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar.xz
nixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.tar.zst
nixpkgs-8e2b14aceb1d40c7e8b84c03a7c78955359872bb.zip
Merge pull request #93634 from sikmir/hyx
Diffstat (limited to 'pkgs/tools/text')
-rw-r--r--pkgs/tools/text/hyx/default.nix23
-rw-r--r--pkgs/tools/text/hyx/memstream.patch31
-rw-r--r--pkgs/tools/text/hyx/no-wall-by-default.patch11
3 files changed, 48 insertions, 17 deletions
diff --git a/pkgs/tools/text/hyx/default.nix b/pkgs/tools/text/hyx/default.nix
index 83fdabb8f46..c2b055be7df 100644
--- a/pkgs/tools/text/hyx/default.nix
+++ b/pkgs/tools/text/hyx/default.nix
@@ -1,14 +1,25 @@
 { lib, stdenv, fetchurl }:
-
+let
+  # memstream — POSIX memory streams for BSD
+  memstream = fetchurl {
+    url = "https://piumarta.com/software/memstream/memstream-0.1.tar.gz";
+    sha256 = "0kvdb897g7nyviaz72arbqijk2g2wa61cmi3l5yh48rzr49r3a3a";
+  };
+in
 stdenv.mkDerivation rec {
-  name = "hyx-0.1.5";
+  pname = "hyx";
+  version = "2020-06-09";
 
   src = fetchurl {
-    url = "https://yx7.cc/code/hyx/${name}.tar.xz";
-    sha256 = "0gd8fbdyw12jwffa5dgcql4ry22xbdhqdds1qwzk1rkcrkgnc1mg";
+    url = "https://yx7.cc/code/hyx/hyx-${lib.replaceStrings [ "-" ] [ "." ] version}.tar.xz";
+    sha256 = "1x8dmll93hrnj24kn5knpwj36y6r1v2ygwynpjwrg2hwd4c1a8hi";
   };
 
-  patches = [ ./no-wall-by-default.patch ];
+  postUnpack = lib.optionalString stdenv.isDarwin ''
+    tar --strip=1 -C $sourceRoot -xf ${memstream} --wildcards "memstream-0.1/memstream.[hc]"
+  '';
+
+  patches = lib.optional stdenv.isDarwin ./memstream.patch;
 
   installPhase = ''
     install -vD hyx $out/bin/hyx
@@ -19,6 +30,6 @@ stdenv.mkDerivation rec {
     homepage = "https://yx7.cc/code/";
     license = licenses.mit;
     maintainers = with maintainers; [ fpletz ];
-    platforms = platforms.linux;
+    platforms = with platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/tools/text/hyx/memstream.patch b/pkgs/tools/text/hyx/memstream.patch
new file mode 100644
index 00000000000..a02509ced76
--- /dev/null
+++ b/pkgs/tools/text/hyx/memstream.patch
@@ -0,0 +1,31 @@
+diff -Naur hyx-2020.06.09.org/Makefile hyx-2020.06.09/Makefile
+--- hyx-2020.06.09.org/Makefile	2020-06-09 15:19:50.000000000 +0300
++++ hyx-2020.06.09/Makefile	2020-07-22 11:46:40.000000000 +0300
+@@ -1,6 +1,6 @@
+ 
+ all: CFLAGS ?= -O2 -Wl,-s \
+-               -Wl,-z,relro,-z,now -fpic -pie -D_FORTIFY_SOURCE=2 -fstack-protector-all
++               -D_FORTIFY_SOURCE=2 -fstack-protector-all
+ all: CFLAGS += -std=c99 -pedantic -Wall -Wextra -DNDEBUG
+ all: hyx
+ 
+@@ -13,7 +13,7 @@
+ hyx: *.h *.c
+ 	$(CC) \
+ 		$(CFLAGS) \
+-		hyx.c common.c blob.c history.c view.c input.c \
++		hyx.c common.c blob.c history.c view.c input.c memstream.c \
+ 		-o hyx
+ 
+ clean:
+diff -Naur hyx-2020.06.09.org/view.c hyx-2020.06.09/view.c
+--- hyx-2020.06.09.org/view.c	2020-06-09 15:19:50.000000000 +0300
++++ hyx-2020.06.09/view.c	2020-07-22 11:49:09.000000000 +0300
+@@ -4,6 +4,7 @@
+ #include "view.h"
+ #include "input.h"
+ #include "ansi.h"
++#include "memstream.h"
+ 
+ #include <stdlib.h>
+ #include <stdio.h>
diff --git a/pkgs/tools/text/hyx/no-wall-by-default.patch b/pkgs/tools/text/hyx/no-wall-by-default.patch
deleted file mode 100644
index 48ee20eff17..00000000000
--- a/pkgs/tools/text/hyx/no-wall-by-default.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- hyx-0.1.5.org/Makefile	2018-06-02 17:14:37.000000000 +0100
-+++ hyx-0.1.5/Makefile	2018-11-10 09:25:49.569961762 +0000
-@@ -1,7 +1,7 @@
- 
- all: CFLAGS ?= -O2 -Wl,-s \
-                -Wl,-z,relro,-z,now -fpic -pie -D_FORTIFY_SOURCE=2 -fstack-protector-all
--all: CFLAGS += -std=c99 -pedantic -Wall -Wextra -DNDEBUG
-+all: CFLAGS += -std=c99 -DNDEBUG
- all: hyx
- 
- debug: CFLAGS ?= -O0 -g \