about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2019-08-13 13:37:08 +0100
committerGitHub <noreply@github.com>2019-08-13 13:37:08 +0100
commit108c57b141e81546f32a78ae16a2e685a11b8b8d (patch)
tree017167eb8398e39d30615432ea0a23b368688c85
parent14368b71d03e8605eb3672d3df0ac3a57f530c0b (diff)
parent6db22bca4b39fe9a95e7afc3a0c1078c01eb1257 (diff)
downloadnixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.tar
nixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.tar.gz
nixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.tar.bz2
nixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.tar.lz
nixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.tar.xz
nixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.tar.zst
nixlib-108c57b141e81546f32a78ae16a2e685a11b8b8d.zip
Merge pull request #53734 from yurrriq/update/noweb
Update noweb (and icon-lang)
-rw-r--r--pkgs/development/interpreters/icon-lang/default.nix21
-rw-r--r--pkgs/development/tools/literate-programming/noweb/default.nix90
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 84 insertions, 29 deletions
diff --git a/pkgs/development/interpreters/icon-lang/default.nix b/pkgs/development/interpreters/icon-lang/default.nix
index 3bec73ea0369..56becd3d6c94 100644
--- a/pkgs/development/interpreters/icon-lang/default.nix
+++ b/pkgs/development/interpreters/icon-lang/default.nix
@@ -1,19 +1,24 @@
-{ stdenv, fetchFromGitHub, libX11, libXt }:
+{ stdenv, fetchFromGitHub, libX11, libXt , withGraphics ? true }:
 
 stdenv.mkDerivation rec {
   name = "icon-lang-${version}";
   version = "9.5.1";
   src = fetchFromGitHub {
-    rev = "39d7438e8d23ccfe20c0af8bbbf61e34d9c715e9";
     owner = "gtownsend";
     repo = "icon";
+    rev = "rel${builtins.replaceStrings ["."] [""] version}";
     sha256 = "1gkvj678ldlr1m5kjhx6zpmq11nls8kxa7pyy64whgakfzrypynw";
   };
-  buildInputs = [ libX11 libXt ];
 
-  configurePhase = ''
-    make X-Configure name=linux
-  '';
+  buildInputs = stdenv.lib.optionals withGraphics [ libX11 libXt ];
+
+  configurePhase =
+    let
+      _name = if stdenv.isDarwin then "macintosh" else "linux";
+    in
+    ''
+      make ${stdenv.lib.optionalString withGraphics "X-"}Configure name=${_name}
+    '';
 
   installPhase = ''
     make Install dest=$out
@@ -21,8 +26,8 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = ''A very high level general-purpose programming language'';
-    maintainers = with maintainers; [ vrthra ];
-    platforms = platforms.linux;
+    maintainers = with maintainers; [ vrthra yurrriq ];
+    platforms = with platforms; linux ++ darwin;
     license = licenses.publicDomain;
     homepage = https://www.cs.arizona.edu/icon/;
   };
diff --git a/pkgs/development/tools/literate-programming/noweb/default.nix b/pkgs/development/tools/literate-programming/noweb/default.nix
index 44df2b1e1534..43cb6e6c2c75 100644
--- a/pkgs/development/tools/literate-programming/noweb/default.nix
+++ b/pkgs/development/tools/literate-programming/noweb/default.nix
@@ -1,29 +1,77 @@
-{stdenv, fetchurl, gawk}:
-
-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";
+{ stdenv, fetchFromGitHub, gawk, groff, icon-lang ? null }:
+
+let noweb = stdenv.mkDerivation rec {
+  pname = "noweb";
+  version = "2.12";
+
+  src = fetchFromGitHub {
+    owner = "nrnrnr";
+    repo = "noweb";
+    rev = "v${builtins.replaceStrings ["."] ["_"] version}";
+    sha256 = "1160i2ghgzqvnb44kgwd6s3p4jnk9668rmc15jlcwl7pdf3xqm95";
   };
+
+  patches = [ ./no-FAQ.patch ];
+
+  nativeBuildInputs = [ groff ] ++ stdenv.lib.optionals (!isNull icon-lang) [ icon-lang ];
+
   preBuild = ''
-    mkdir -p $out/lib/noweb
+    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"
+
+  makeFlags = stdenv.lib.optionals (!isNull icon-lang) [
+    "LIBSRC=icon"
+    "ICONC=icont"
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    "CC=clang"
+  ];
+
+  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"
   '';
-  patches = [ ./no-FAQ.patch ];
 
-  meta = {
-    platforms = stdenv.lib.platforms.linux;
+  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 2091d2b6f86e..a46af176a654 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9707,7 +9707,9 @@ in
     gconf = pkgs.gnome2.GConf;
   };
 
+  # NOTE: Override and set icon-lang = null to use Awk instead of Icon.
   noweb = callPackage ../development/tools/literate-programming/noweb { };
+
   nuweb = callPackage ../development/tools/literate-programming/nuweb { tex = texlive.combined.scheme-small; };
 
   nrfutil = callPackage ../development/tools/misc/nrfutil { };