2016-03-27 16:12:09 +00:00
|
|
|
{ stdenv, bzip2, patchelf, glibc, gcc, fetchurl, version, releaseType, sha256, ncurses
|
|
|
|
, dirName ? null, subdirName ? null }:
|
2014-03-29 10:00:26 +00:00
|
|
|
with stdenv.lib;
|
|
|
|
let
|
|
|
|
versionParts = splitString "-" version; # 4.7 2013q3 20130916
|
|
|
|
majorVersion = elemAt versionParts 0; # 4.7
|
|
|
|
yearQuarter = elemAt versionParts 1; # 2013q3
|
|
|
|
underscoreVersion = replaceChars ["."] ["_"] version; # 4_7-2013q3-20130916
|
|
|
|
yearQuarterParts = splitString "q" yearQuarter; # 2013 3
|
|
|
|
year = elemAt yearQuarterParts 0; # 2013
|
|
|
|
quarter = elemAt yearQuarterParts 1; # 3
|
2016-03-27 16:12:09 +00:00
|
|
|
dirName_ = if dirName != null then dirName else majorVersion;
|
|
|
|
subdirName_ = if subdirName != null then subdirName
|
|
|
|
else "${majorVersion}-${year}-q${quarter}-${releaseType}"; # 4.7-2013-q3-update
|
2014-03-29 10:00:26 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "gcc-arm-embedded-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2016-03-27 16:12:09 +00:00
|
|
|
url = "https://launchpad.net/gcc-arm-embedded/${dirName_}/${subdirName_}/+download/gcc-arm-none-eabi-${underscoreVersion}-linux.tar.bz2";
|
2014-03-29 10:00:26 +00:00
|
|
|
sha256 = sha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ bzip2 patchelf ];
|
2016-07-19 10:00:03 +00:00
|
|
|
|
2014-03-29 10:00:26 +00:00
|
|
|
dontPatchELF = true;
|
2016-07-19 10:00:03 +00:00
|
|
|
|
2014-03-29 10:00:26 +00:00
|
|
|
phases = "unpackPhase patchPhase installPhase";
|
2016-07-19 10:00:03 +00:00
|
|
|
|
2014-03-29 10:00:26 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -pv $out
|
|
|
|
cp -r ./* $out
|
|
|
|
|
|
|
|
for f in $(find $out); do
|
|
|
|
if [ -f "$f" ] && patchelf "$f" 2> /dev/null; then
|
2016-04-14 16:00:39 +00:00
|
|
|
patchelf --set-interpreter ${getLib glibc}/lib/ld-linux.so.2 \
|
2016-08-22 21:04:39 +00:00
|
|
|
--set-rpath ${stdenv.lib.makeLibraryPath [ "$out" gcc ncurses ]} \
|
2014-03-29 10:00:26 +00:00
|
|
|
"$f" || true
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2014-03-29 17:27:35 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors (Cortex-M0/M0+/M3/M4, Cortex-R4/R5/R7)";
|
2016-07-19 10:00:03 +00:00
|
|
|
homepage = https://launchpad.net/gcc-arm-embedded;
|
|
|
|
license = with licenses; [ bsd2 gpl2 gpl3 lgpl21 lgpl3 mit ];
|
|
|
|
maintainers = [ maintainers.rasendubi ];
|
2014-03-29 17:27:35 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|