about summary refs log tree commit diff
path: root/pkgs/development/tools/misc/cwebbin/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/misc/cwebbin/default.nix')
-rw-r--r--pkgs/development/tools/misc/cwebbin/default.nix32
1 files changed, 20 insertions, 12 deletions
diff --git a/pkgs/development/tools/misc/cwebbin/default.nix b/pkgs/development/tools/misc/cwebbin/default.nix
index 055a24f3fe0a0..a5ed3e222aaae 100644
--- a/pkgs/development/tools/misc/cwebbin/default.nix
+++ b/pkgs/development/tools/misc/cwebbin/default.nix
@@ -1,9 +1,17 @@
 { lib, stdenv, fetchFromGitHub, fetchurl, tie }:
 
+let
+  cweb = fetchurl {
+    url = "https://www.ctan.org/tex-archive/web/c_cpp/cweb/cweb-3.64ah.tgz";
+    sha256 = "1hdzxfzaibnjxjzgp6d2zay8nsarnfy9hfq55hz1bxzzl23n35aj";
+  };
+in
 stdenv.mkDerivation rec {
   pname = "cwebbin";
   version = "22p";
 
+  __structuredAttrs = true;
+
   src = fetchFromGitHub {
     owner = "ascherer";
     repo = "cwebbin";
@@ -11,10 +19,9 @@ stdenv.mkDerivation rec {
     sha256 = "0zf93016hm9i74i2v384rwzcw16y3hg5vc2mibzkx1rzvqa50yfr";
   };
 
-  cweb = fetchurl {
-    url = "https://www.ctan.org/tex-archive/web/c_cpp/cweb/cweb-3.64ah.tgz";
-    sha256 = "1hdzxfzaibnjxjzgp6d2zay8nsarnfy9hfq55hz1bxzzl23n35aj";
-  };
+  prePatch = ''
+    tar xf ${cweb}
+  '';
 
   # Remove references to __DATE__ and __TIME__
   postPatch = ''
@@ -26,6 +33,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ tie ];
 
+  makefile = "Makefile.unix";
+
   makeFlags = [
     "MACROSDIR=$(out)/share/texmf/tex/generic/cweb"
     "CWEBINPUTS=$(out)/lib/cweb"
@@ -35,18 +44,17 @@ stdenv.mkDerivation rec {
     "CP=cp"
     "RM=rm"
     "PDFTEX=echo"
-    "CC=${stdenv.cc.targetPrefix}c++"
+    # requires __structuredAttrs = true
+    "CC=$(CXX) -std=c++14"
   ];
 
-  buildPhase = ''
-    zcat ${cweb} | tar -xvpf -
-    make -f Makefile.unix boot $makeFlags
-    make -f Makefile.unix cautiously $makeFlags
-  '';
+  buildFlags = [
+    "boot"
+    "cautiously"
+  ];
 
-  installPhase = ''
+  preInstall = ''
     mkdir -p $out/share/man/man1 $out/share/texmf/tex/generic $out/share/emacs $out/lib
-    make -f Makefile.unix install $makeFlags
   '';
 
   meta = with lib; {