From 67aaa70a5b1ac4f97a6d55c04d266de1a90ac701 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 9 Jan 2019 23:52:22 -0600 Subject: [PATCH] noweb: 2.11b -> 2.12 - fetchurl -> fetchFromGitHub - Support building with icon (useIcon, default: false) - Support darwin - Configure for texlive - Flesh out meta - Build man pages - Pass through tex package --- .../literate-programming/noweb/default.nix | 94 ++++++++++++++----- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 73 insertions(+), 25 deletions(-) diff --git a/pkgs/development/tools/literate-programming/noweb/default.nix b/pkgs/development/tools/literate-programming/noweb/default.nix index 44df2b1e1534..333491d9a3d2 100644 --- a/pkgs/development/tools/literate-programming/noweb/default.nix +++ b/pkgs/development/tools/literate-programming/noweb/default.nix @@ -1,29 +1,75 @@ -{stdenv, fetchurl, gawk}: +{ stdenv, fetchFromGitHub, gawk, groff, icon-lang ? null }: -stdenv.mkDerivation { - name = "noweb-2.11b"; - src = fetchurl { - urls = [ "http://ftp.de.debian.org/debian/pool/main/n/noweb/noweb_2.11b.orig.tar.gz" - "ftp://www.eecs.harvard.edu/pub/nr/noweb.tgz" - ]; - sha256 = "10hdd6mrk26kyh4bnng4ah5h1pnanhsrhqa7qwqy6dyv3rng44y9"; +let noweb = stdenv.mkDerivation rec { + pname = "noweb"; + version = "2.12"; + + src = fetchFromGitHub { + owner = "nrnrnr"; + repo = "noweb"; + rev = "v${builtins.replaceStrings ["."] ["_"] version}"; + sha256 = "1160i2ghgzqvnb44kgwd6s3p4jnk9668rmc15jlcwl7pdf3xqm95"; }; - preBuild = '' - mkdir -p $out/lib/noweb - cd src - makeFlags="BIN=$out/bin LIB=$out/lib/noweb MAN=$out/share/man TEXINPUTS=$out/share/texmf/tex/latex" - ''; - preInstall=''mkdir -p $out/share/texmf/tex/latex''; - postInstall= '' - substituteInPlace $out/bin/cpif --replace "PATH=/bin:/usr/bin" "" - for f in $out/bin/{noweb,nountangle,noroots,noroff,noindex} \ - $out/lib/noweb/{toroff,btdefn,totex,noidx,unmarkup,toascii,tohtml,emptydefn}; do - substituteInPlace $f --replace "nawk" "${gawk}/bin/awk" - done - ''; + patches = [ ./no-FAQ.patch ]; - meta = { - platforms = stdenv.lib.platforms.linux; + nativeBuildInputs = [ groff ] ++ stdenv.lib.optionals (!isNull icon-lang) [ icon-lang ]; + + preBuild = '' + mkdir -p "$out/lib/noweb" + cd src + ''; + + makeFlags = stdenv.lib.optionals (!isNull icon-lang) [ + "LIBSRC=icon" + "ICONC=icont" + ]; + + installFlags = [ + "BIN=$(out)/bin" + "ELISP=$(out)/share/emacs/site-lisp" + "LIB=$(out)/lib/noweb" + "MAN=$(out)/share/man" + "TEXINPUTS=$(tex)/tex/latex/noweb" + ]; + + preInstall = '' + mkdir -p "$tex/tex/latex/noweb" + ''; + + installTargets = "install-code install-tex install-elisp"; + + postInstall = '' + substituteInPlace "$out/bin/cpif" --replace "PATH=/bin:/usr/bin" "" + + for f in $out/bin/no{index,roff,roots,untangle,web} \ + $out/lib/noweb/to{ascii,html,roff,tex} \ + $out/lib/noweb/{bt,empty}defn \ + $out/lib/noweb/{noidx,unmarkup}; do + # NOTE: substituteInPlace breaks Icon binaries, so make sure the script + # uses (n)awk before calling. + if grep -q nawk "$f"; then + substituteInPlace "$f" --replace "nawk" "${gawk}/bin/awk" + fi + done + + # HACK: This is ugly, but functional. + PATH=$out/bin:$PATH make -BC xdoc + make $installFlags install-man + + ln -s "$tex" "$out/share/texmf" + ''; + + outputs = [ "out" "tex" ]; + + tlType = "run"; + passthru.pkgs = [ noweb.tex ]; + + meta = with stdenv.lib; { + description = "A simple, extensible literate-programming tool"; + homepage = https://www.cs.tufts.edu/~nr/noweb; + license = licenses.bsd2; + maintainers = with maintainers; [ yurrriq ]; + platforms = with platforms; linux ++ darwin; }; -} +}; in noweb diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 96737537c9ba..ee3fc2477eed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9684,7 +9684,9 @@ in gconf = pkgs.gnome2.GConf; }; - noweb = callPackage ../development/tools/literate-programming/noweb { }; + noweb = noweb_icon; + noweb_awk = noweb_icon.override { icon-lang = null; }; + noweb_icon = callPackage ../development/tools/literate-programming/noweb { }; nuweb = callPackage ../development/tools/literate-programming/nuweb { tex = texlive.combined.scheme-small; }; nrfutil = callPackage ../development/tools/misc/nrfutil { };