noweb: fix cross-compilation

This commit is contained in:
Ben Siraphob 2021-02-28 20:00:10 +07:00
parent 4968a57831
commit d3c32a980b
2 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ lib, stdenv, fetchFromGitHub, gawk, groff, icon-lang ? null }:
{ lib, stdenv, fetchFromGitHub, nawk, groff, icon-lang }:
let noweb = stdenv.mkDerivation rec {
lib.fix (noweb: stdenv.mkDerivation rec {
pname = "noweb";
version = "2.12";
@ -11,25 +11,28 @@ let noweb = stdenv.mkDerivation rec {
sha256 = "1160i2ghgzqvnb44kgwd6s3p4jnk9668rmc15jlcwl7pdf3xqm95";
};
patches = [ ./no-FAQ.patch ];
sourceRoot = "source/src";
patches = [
# Remove FAQ
./no-FAQ.patch
];
postPatch = ''
substituteInPlace Makefile --replace 'strip' '${stdenv.cc.targetPrefix}strip'
'';
nativeBuildInputs = [ groff ] ++ lib.optionals (!isNull icon-lang) [ icon-lang ];
buildInputs = [ nawk ];
preBuild = ''
mkdir -p "$out/lib/noweb"
cd src
'';
makeFlags = lib.optionals (!isNull icon-lang) [
"LIBSRC=icon"
"ICONC=icont"
] ++ lib.optionals stdenv.isDarwin [
"CC=clang"
];
installFlags = [
];
] ++ [ "CC=${stdenv.cc.targetPrefix}cc" ];
preInstall = ''
mkdir -p "$tex/tex/latex/noweb"
@ -50,11 +53,11 @@ let noweb = stdenv.mkDerivation rec {
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
$out/lib/noweb/{noidx,pipedocs,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"
substituteInPlace "$f" --replace "nawk" "${nawk}/bin/awk"
fi
done
@ -77,4 +80,4 @@ let noweb = stdenv.mkDerivation rec {
maintainers = with maintainers; [ yurrriq ];
platforms = with platforms; linux ++ darwin;
};
}; in noweb
})

View File

@ -1,5 +1,5 @@
--- a/src/Makefile 2006-06-12 22:14:20.000000000 +0200
+++ b/src/Makefile 2010-06-17 11:30:11.804018145 +0200
--- a/Makefile 2006-06-12 22:14:20.000000000 +0200
+++ b/Makefile 2010-06-17 11:30:11.804018145 +0200
@@ -198,7 +198,7 @@
(cd elisp; ci -l $(CINAME) $(CIMSG) *.el)
ci -l $(CINAME) $(CIMSG) Makefile.nw INSTALL INSTALL.DOS README FAQ COPYRIGHT nwmake *.nw