nix-overlay/pkgs/crosstool-ng.nix

104 lines
2.3 KiB
Nix

{ stdenv, fetchurl, lib, makeWrapper,
flex,
gnumake,
texinfo,
unzip,
help2man,
file,
gnused,
which,
libtool,
ncurses,
m4,
gnugrep,
coreutils,
bison,
binutils-unwrapped,
bash,
patch,
gawk,
autoconf,
automake,
python,
gcc,
wget,
curl,
withCurl ? false,
withWget ? true,
}:
stdenv.mkDerivation rec {
pname = "crosstool-ng";
version = "1.24.0";
src = fetchurl {
url = "http://crosstool-ng.org/download/crosstool-ng/${pname}-${version}.tar.bz2";
sha256 = "08zmw9j4h1yazbzm000ygs0kxr9h3mrg5cqi5c6wcmi0bvmd206j";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
flex
gnumake
texinfo
unzip
help2man
file
which
libtool
m4
ncurses
gnugrep
bison
binutils-unwrapped
bash
patch
gawk
gnused
gcc
] ++ lib.optional withWget wget
++ lib.optional withCurl curl;
configureFlags = [
# "speeds up one-time build"
"--disable-dependency-tracking"
];
preConfigure = ''
export INSTALL="${coreutils}/bin/install"
export GREP="${gnugrep}/bin/grep"
export EGREP="${gnugrep}/bin/egrep"
export SED="${gnused}/bin/sed"
export YACC="${bison}/bin/bison -y"
export OBJCOPY="${binutils-unwrapped}/bin/objcopy"
export OBJDUMP="${binutils-unwrapped}/bin/objdump"
export READELF="${binutils-unwrapped}/bin/readelf"
export PATCH="${patch}/bin/patch"
export BASH_SHELL="${bash}/bin/bash"
export AWK="${gawk}/bin/gawk"
export LIBTOOL="${libtool}/bin/libtool"
export LIBTOOLIZE="${libtool}/bin/libtoolize"
export AUTOCONF="${autoconf}/bin/autoconf"
export AUTORECONF="${autoconf}/bin/autoreconf"
export AUTOMAKE="${automake}/bin/automake"
export M4="${m4}/bin/m4"
export PYTHON="${python}/bin/python"
export BISON="${bison}/bin/bison"
export AR="${binutils-unwrapped}/bin/ar"
'';
postFixup = ''
wrapProgram "$out/bin/ct-ng" \
--prefix PATH : "${lib.strings.makeBinPath [ binutils-unwrapped m4 gcc ]}" \
${lib.optionalString withWget "--set-default CT_WGET '${wget}/bin/wget'"} \
${lib.optionalString withCurl "--set-default CT_CURL '${curl}/bin/curl'"}
'';
meta = with stdenv.lib; {
description = "A versatile (cross-)toolchain generator";
homepage = "https://crosstool-ng.github.io/";
license = licenses.gpl2;
};
}