Merge pull request #114657 from siraben/noweb-xcompile

This commit is contained in:
Sandro 2021-03-20 17:02:18 +01:00 committed by GitHub
commit afd0feb887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 27 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"; pname = "noweb";
version = "2.12"; version = "2.12";
@ -11,25 +11,28 @@ let noweb = stdenv.mkDerivation rec {
sha256 = "1160i2ghgzqvnb44kgwd6s3p4jnk9668rmc15jlcwl7pdf3xqm95"; 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 ]; nativeBuildInputs = [ groff ] ++ lib.optionals (!isNull icon-lang) [ icon-lang ];
buildInputs = [ nawk ];
preBuild = '' preBuild = ''
mkdir -p "$out/lib/noweb" mkdir -p "$out/lib/noweb"
cd src
''; '';
makeFlags = lib.optionals (!isNull icon-lang) [ makeFlags = lib.optionals (!isNull icon-lang) [
"LIBSRC=icon" "LIBSRC=icon"
"ICONC=icont" "ICONC=icont"
] ++ lib.optionals stdenv.isDarwin [ ] ++ [ "CC=${stdenv.cc.targetPrefix}cc" ];
"CC=clang"
];
installFlags = [
];
preInstall = '' preInstall = ''
mkdir -p "$tex/tex/latex/noweb" 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} \ for f in $out/bin/no{index,roff,roots,untangle,web} \
$out/lib/noweb/to{ascii,html,roff,tex} \ $out/lib/noweb/to{ascii,html,roff,tex} \
$out/lib/noweb/{bt,empty}defn \ $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 # NOTE: substituteInPlace breaks Icon binaries, so make sure the script
# uses (n)awk before calling. # uses (n)awk before calling.
if grep -q nawk "$f"; then if grep -q nawk "$f"; then
substituteInPlace "$f" --replace "nawk" "${gawk}/bin/awk" substituteInPlace "$f" --replace "nawk" "${nawk}/bin/awk"
fi fi
done done
@ -77,4 +80,4 @@ let noweb = stdenv.mkDerivation rec {
maintainers = with maintainers; [ yurrriq ]; maintainers = with maintainers; [ yurrriq ];
platforms = with platforms; linux ++ darwin; platforms = with platforms; linux ++ darwin;
}; };
}; in noweb })

View File

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

View File

@ -1,26 +1,28 @@
{ lib, stdenv, fetchFromGitHub, yacc }: { lib, stdenv, fetchFromGitHub, bison, buildPackages }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "nawk"; pname = "nawk";
version = "20180827"; version = "unstable-2021-02-15";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "onetrueawk"; owner = "onetrueawk";
repo = "awk"; repo = "awk";
rev = version; rev = "c0f4e97e4561ff42544e92512bbaf3d7d1f6a671";
sha256 = "0qcsxhcwg6g3c0zxmbipqa8d8d5n8zxrq0hymb8yavsaz103fcl6"; sha256 = "kQCvItpSJnDJMDvlB8ruY+i0KdjmAphRDqCKw8f0m/8=";
}; };
nativeBuildInputs = [ yacc ]; depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bison ];
patchPhase = '' makeFlags = [
substituteInPlace ./makefile \ "CC=${stdenv.cc.targetPrefix}cc"
--replace "YACC = yacc -d -S" "" "HOSTCC=${if stdenv.buildPlatform.isDarwin then "clang" else "cc"}"
''; ];
installPhase = '' installPhase = ''
runHook preInstall
install -Dm755 a.out "$out/bin/nawk" install -Dm755 a.out "$out/bin/nawk"
install -Dm644 awk.1 "$out/share/man/man1/nawk.1" install -Dm644 awk.1 "$out/share/man/man1/nawk.1"
runHook postInstall
''; '';
meta = { meta = {
@ -33,6 +35,6 @@ stdenv.mkDerivation rec {
homepage = "https://www.cs.princeton.edu/~bwk/btl.mirror/"; homepage = "https://www.cs.princeton.edu/~bwk/btl.mirror/";
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = [ lib.maintainers.konimex ]; maintainers = [ lib.maintainers.konimex ];
platforms = lib.platforms.linux; platforms = lib.platforms.all;
}; };
} }