nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.03 77 lines 2.1 kB view raw
1{ stdenv, fetchFromGitHub, gawk, groff, icon-lang ? null }: 2 3let noweb = stdenv.mkDerivation rec { 4 pname = "noweb"; 5 version = "2.12"; 6 7 src = fetchFromGitHub { 8 owner = "nrnrnr"; 9 repo = "noweb"; 10 rev = "v${builtins.replaceStrings ["."] ["_"] version}"; 11 sha256 = "1160i2ghgzqvnb44kgwd6s3p4jnk9668rmc15jlcwl7pdf3xqm95"; 12 }; 13 14 patches = [ ./no-FAQ.patch ]; 15 16 nativeBuildInputs = [ groff ] ++ stdenv.lib.optionals (!isNull icon-lang) [ icon-lang ]; 17 18 preBuild = '' 19 mkdir -p "$out/lib/noweb" 20 cd src 21 ''; 22 23 makeFlags = stdenv.lib.optionals (!isNull icon-lang) [ 24 "LIBSRC=icon" 25 "ICONC=icont" 26 ] ++ stdenv.lib.optionals stdenv.isDarwin [ 27 "CC=clang" 28 ]; 29 30 installFlags = [ 31 "BIN=$(out)/bin" 32 "ELISP=$(out)/share/emacs/site-lisp" 33 "LIB=$(out)/lib/noweb" 34 "MAN=$(out)/share/man" 35 "TEXINPUTS=$(tex)/tex/latex/noweb" 36 ]; 37 38 preInstall = '' 39 mkdir -p "$tex/tex/latex/noweb" 40 ''; 41 42 installTargets = [ "install-code" "install-tex" "install-elisp" ]; 43 44 postInstall = '' 45 substituteInPlace "$out/bin/cpif" --replace "PATH=/bin:/usr/bin" "" 46 47 for f in $out/bin/no{index,roff,roots,untangle,web} \ 48 $out/lib/noweb/to{ascii,html,roff,tex} \ 49 $out/lib/noweb/{bt,empty}defn \ 50 $out/lib/noweb/{noidx,unmarkup}; do 51 # NOTE: substituteInPlace breaks Icon binaries, so make sure the script 52 # uses (n)awk before calling. 53 if grep -q nawk "$f"; then 54 substituteInPlace "$f" --replace "nawk" "${gawk}/bin/awk" 55 fi 56 done 57 58 # HACK: This is ugly, but functional. 59 PATH=$out/bin:$PATH make -BC xdoc 60 make "''${installFlags[@]} install-man" 61 62 ln -s "$tex" "$out/share/texmf" 63 ''; 64 65 outputs = [ "out" "tex" ]; 66 67 tlType = "run"; 68 passthru.pkgs = [ noweb.tex ]; 69 70 meta = with stdenv.lib; { 71 description = "A simple, extensible literate-programming tool"; 72 homepage = https://www.cs.tufts.edu/~nr/noweb; 73 license = licenses.bsd2; 74 maintainers = with maintainers; [ yurrriq ]; 75 platforms = with platforms; linux ++ darwin; 76 }; 77}; in noweb