1{ stdenv, fetchFromGitHub, fetchurl, tie }:
2
3stdenv.mkDerivation rec {
4 pname = "cwebbin";
5 version = "22p";
6
7 src = fetchFromGitHub {
8 owner = "ascherer";
9 repo = "cwebbin";
10 rev = "2016-05-20-22p";
11 sha256 = "0zf93016hm9i74i2v384rwzcw16y3hg5vc2mibzkx1rzvqa50yfr";
12 };
13
14 cweb = fetchurl {
15 url = "https://www.ctan.org/tex-archive/web/c_cpp/cweb/cweb-3.64ah.tgz";
16 sha256 = "1hdzxfzaibnjxjzgp6d2zay8nsarnfy9hfq55hz1bxzzl23n35aj";
17 };
18
19 buildInputs = [ tie ];
20
21 makeFlags = [
22 "MACROSDIR=$(out)/share/texmf/tex/generic/cweb"
23 "CWEBINPUTS=$(out)/lib/cweb"
24 "DESTDIR=$(out)/bin/"
25 "MANDIR=$(out)/share/man/man1"
26 "EMACSDIR=$(out)/share/emacs/site-lisp"
27 "CP=cp"
28 "RM=rm"
29 "PDFTEX=echo"
30 "CC=c++"
31 ];
32
33 buildPhase = ''
34 zcat ${cweb} | tar -xvpf -
35 make -f Makefile.unix boot $makeFlags
36 make -f Makefile.unix cautiously $makeFlags
37 '';
38
39 installPhase = ''
40 mkdir -p $out/share/man/man1 $out/share/texmf/tex/generic $out/share/emacs $out/lib
41 make -f Makefile.unix install $makeFlags
42 '';
43
44 meta = with stdenv.lib; {
45 inherit (src.meta) homepage;
46 description = "Literate Programming in C/C++";
47 platforms = with platforms; unix;
48 maintainers = with maintainers; [ vrthra ];
49 license = licenses.abstyles;
50 };
51}