98 lines
2.3 KiB
Nix
98 lines
2.3 KiB
Nix
{ stdenv, fetchurl, lib, makeWrapper,
|
|
withCurl ? false,
|
|
withWget ? true,
|
|
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,
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "crosstool-ng";
|
|
version = "1.24.0";
|
|
|
|
src = fetchurl {
|
|
url = "http://crosstool-ng.org/download/crosstool-ng/${pname}-${version}.tar.bz2";
|
|
sha512 = "379e668365628f0ab359ae119213bed44960870093f64f0fbb12e92bbe2a3b82bfed77f5ab33f2e2f17c1977e7a63f2151c46ad8d0e6208220fb7fa8726fae33";
|
|
};
|
|
|
|
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;
|
|
|
|
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;
|
|
};
|
|
}
|