2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, gawk, groff, icon-lang ? null }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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 ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ groff ] ++ lib.optionals (!isNull icon-lang) [ icon-lang ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
mkdir -p "$out/lib/noweb"
|
|
|
|
cd src
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
makeFlags = lib.optionals (!isNull icon-lang) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"LIBSRC=icon"
|
|
|
|
"ICONC=icont"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2020-04-24 23:36:52 +00:00
|
|
|
"CC=clang"
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
];
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p "$tex/tex/latex/noweb"
|
|
|
|
installFlagsArray+=( \
|
|
|
|
"BIN=${placeholder "out"}/bin" \
|
|
|
|
"ELISP=${placeholder "out"}/share/emacs/site-lisp" \
|
|
|
|
"LIB=${placeholder "out"}/lib/noweb" \
|
|
|
|
"MAN=${placeholder "out"}/share/man" \
|
|
|
|
"TEXINPUTS=${placeholder "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 "''${installFlagsArray[@]}" install-man
|
|
|
|
|
|
|
|
ln -s "$tex" "$out/share/texmf"
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" "tex" ];
|
|
|
|
|
|
|
|
tlType = "run";
|
|
|
|
passthru.pkgs = [ noweb.tex ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|