about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/neatroff/default.nix106
-rw-r--r--pkgs/neatroff/eqn-format-security.patch11
-rw-r--r--pkgs/neatroff/format-security.patch13
3 files changed, 130 insertions, 0 deletions
diff --git a/pkgs/neatroff/default.nix b/pkgs/neatroff/default.nix
new file mode 100644
index 0000000..b1b05e8
--- /dev/null
+++ b/pkgs/neatroff/default.nix
@@ -0,0 +1,106 @@
+{ stdenv, fetchurl, fetchgit, fetchFromGitHub, git }:
+let
+  neatroffSrc = fetchFromGitHub {
+    owner = "aligrudi";
+    repo = "neatroff";
+
+    rev="9c58dba3438cbf2497178b45a7f4c7cdc001a7f0";
+    sha256="0hh7kcxkzjvqapzy2x8c042zafv1dwirc4rjpny2z0940gw2c8mh";
+  };
+  neatpostSrc = fetchFromGitHub {
+    owner = "aligrudi";
+    repo = "neatpost";
+    rev = "14fafdadb05a2ea128a8aa3ce43ac2010f77c5e0";
+    sha256 = "17vzr0zbh2d4i53zdnidd14lvblgp8drv3pzzxrwnkln4ri448nh";
+  };
+  neatmkfnSrc = fetchFromGitHub {
+    owner = "aligrudi";
+    repo = "neatmkfn";
+    rev = "75c3ea970de97a857fc27c70696e5009ccf73e71";
+    sha256 = "0yhsvwb3yyc852q3174ldx37mjj7171kbaxnq9p5nmjz265dw88a";
+  };
+  neateqnSrc = fetchFromGitHub {
+    owner = "aligrudi";
+    repo = "neateqn";
+    rev = "227fa723d1e703f6424968c8c99809769e10165f";
+    sha256 = "0ihp7rkfyz3pnlyi53w3rpa0k42791q71d618jz1l88pmfa00p9w";
+  };
+  neatreferSrc = fetchFromGitHub {
+    owner = "aligrudi";
+    repo = "neatrefer";
+    rev = "b11d03d051f79791d03d6d3c1c9f492c1fa1f512";
+    sha256 = "12g47nd3qbkfzr4cpchcsx4bh0g8wiqs6vzya2j4w18rqrzi3166";
+  };
+  troffSrc = fetchgit {
+    url = "git://repo.or.cz/troff.git";
+    rev = "8a83ad3156f499f2483b46c03d6c4770592fb335";
+    sha256 = "16hcybn1y9byvw2cv2z7m3yhdwak5m69gnq0x6kq62vlify31jl3";
+  };
+  fonts = stdenv.mkDerivation {
+    name = "neatroff-fonts";
+    srcs = fetchFromGitHub {
+        name = "urw";
+        owner = "ArtifexSoftware";
+        repo = "urw-base35-fonts";
+        rev = "20170801.1";
+        sha256 = "sha256:1k578r3qb0sjfd715jw0bc00pjvbrgnw0b7zrrhk33xghrdvp4r6";
+    };
+
+    installPhase = ''
+      mkdir -p $out
+      cp fonts/*.t1 $out
+      cp fonts/*.afm $out
+    '';
+  };
+in
+  stdenv.mkDerivation {
+    name = "neatroff";
+
+    src = fetchFromGitHub {
+      repo = "neatroff_make";
+      owner = "aligrudi";
+      rev = "beeb7df77be057ffb5a0c537cf6e26fd3387e1af";
+      sha256 = "174pi6j3zgnk7yv37pi4jlnyc9pc2syc2fj0nzgimnkgcznyxp30";
+    };
+
+    nativeBuildInputs = [ git ];
+
+    buildPhase = ''
+      cp -r ${neatroffSrc} neatroff
+      cp -r ${neatpostSrc} neatpost
+      cp -r ${neatmkfnSrc} neatmkfn
+      cp -r ${neateqnSrc} neateqn
+      cp -r ${neatreferSrc} neatrefer
+      cp -r ${troffSrc} troff
+      cp ${fonts}/* fonts
+      chmod u+w -R neat*
+      chmod u+w -R troff
+      cd neatroff
+      patch -p1 < ${./format-security.patch}
+      cd ..
+      cd neateqn
+      patch -p1 < ${./eqn-format-security.patch}
+      cd ..
+      echo
+      echo
+      echo
+      ls -l fonts
+      echo
+      echo
+      echo
+      make neat BASE=$out
+    '';
+
+    installPhase = ''
+      mkdir -p $out/bin
+      make install BASE=$out
+      ln -s $out/neatroff/roff $out/bin/roff
+      ln -s $out/neatpost/post $out/bin/post
+      ln -s $out/neatpost/pdf $out/bin/pdf
+      ln -s $out/neateqn/eqn $out/bin/eqn
+      ln -s $out/neatrefer/refer $out/bin/refer
+      ln -s $out/troff/pic/pic $out/bin/pic
+      ln -s $out/troff/tbl/tbl $out/bin/tbl
+      ln -s $out/soin/soin $out/bin/soin
+    '';
+  }
diff --git a/pkgs/neatroff/eqn-format-security.patch b/pkgs/neatroff/eqn-format-security.patch
new file mode 100644
index 0000000..bada2ed
--- /dev/null
+++ b/pkgs/neatroff/eqn-format-security.patch
@@ -0,0 +1,11 @@
+diff --git a/Makefile b/Makefile
+index 9c8d51a..0ed61bd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+ CC = cc
+-CFLAGS = -Wall -O2
++CFLAGS = -Wall -O2 -Wno-format-security
+ LDFLAGS =
+ OBJS = eqn.o tok.o src.o def.o box.o reg.o sbuf.o
+ 
diff --git a/pkgs/neatroff/format-security.patch b/pkgs/neatroff/format-security.patch
new file mode 100644
index 0000000..acd6585
--- /dev/null
+++ b/pkgs/neatroff/format-security.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 801c6ed..d1efdaa 100644
+--- a/Makefile
++++ b/Makefile
+@@ -3,7 +3,7 @@ FDIR = /neatroff/font
+ MDIR = /neatroff/tmac
+ 
+ CC = cc
+-CFLAGS = -Wall -O2 "-DTROFFFDIR=\"$(FDIR)\"" "-DTROFFMDIR=\"$(MDIR)\""
++CFLAGS = -Wall -O2 "-DTROFFFDIR=\"$(FDIR)\"" "-DTROFFMDIR=\"$(MDIR)\"" -Wno-format-security
+ LDFLAGS =
+ OBJS = roff.o dev.o font.o in.o cp.o tr.o ren.o out.o reg.o sbuf.o fmt.o \
+ 	eval.o draw.o wb.o hyph.o map.o clr.o char.o dict.o iset.o dir.o