2021-08-10 15:14:58 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2019-12-01 18:42:16 +01:00
|
|
|
, fetchurl
|
|
|
|
, ncurses5
|
|
|
|
, python27
|
|
|
|
}:
|
2018-12-15 19:32:12 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "gcc-arm-embedded";
|
2021-07-12 13:11:14 +02:00
|
|
|
version = "6.3.1";
|
|
|
|
release = "6-2017-q2-update";
|
2018-12-15 19:32:12 +01:00
|
|
|
subdir = "6-2017q2";
|
|
|
|
|
2019-12-01 18:42:16 +01:00
|
|
|
suffix = {
|
2021-12-05 23:35:52 +01:00
|
|
|
aarch64-darwin = "mac"; # use intel binaries via rosetta
|
2019-12-01 18:42:16 +01:00
|
|
|
x86_64-darwin = "mac";
|
|
|
|
x86_64-linux = "linux";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-12 13:11:14 +02:00
|
|
|
url = "https://developer.arm.com/-/media/Files/downloads/gnu-rm/${subdir}/gcc-arm-none-eabi-${release}-${suffix}.tar.bz2";
|
2019-12-01 18:42:16 +01:00
|
|
|
sha256 = {
|
2021-12-05 23:35:52 +01:00
|
|
|
aarch64-darwin = "0019ylpq4inq7p5gydpmc9m8ni72fz2csrjlqmgx1698998q0c3x";
|
2019-12-01 18:42:16 +01:00
|
|
|
x86_64-darwin = "0019ylpq4inq7p5gydpmc9m8ni72fz2csrjlqmgx1698998q0c3x";
|
|
|
|
x86_64-linux = "1hvwi02mx34al525sngnl0cm7dkmzxfkb1brq9kvbv28wcplp3p6";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
};
|
2018-12-15 19:32:12 +01:00
|
|
|
|
2020-12-29 11:31:47 +01:00
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontStrip = true;
|
2018-12-15 19:32:12 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r * $out
|
2019-01-19 00:46:16 +01:00
|
|
|
ln -s $out/share/doc/gcc-arm-none-eabi/man $out/man
|
2018-12-15 19:32:12 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
find $out -type f | while read f; do
|
2020-12-29 11:31:47 +01:00
|
|
|
patchelf "$f" > /dev/null 2>&1 || continue
|
2018-12-15 19:32:12 +01:00
|
|
|
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
|
2021-01-22 12:25:31 +01:00
|
|
|
patchelf --set-rpath ${lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 python27 ]} "$f" || true
|
2018-12-15 19:32:12 +01:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-01-22 12:25:31 +01:00
|
|
|
meta = with lib; {
|
2019-12-01 18:42:16 +01:00
|
|
|
description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";
|
|
|
|
homepage = "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm";
|
|
|
|
license = with licenses; [ bsd2 gpl2 gpl3 lgpl21 lgpl3 mit ];
|
|
|
|
maintainers = with maintainers; [ prusnak ];
|
2021-12-05 23:35:52 +01:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2018-12-15 19:32:12 +01:00
|
|
|
};
|
|
|
|
}
|