54 lines
1.7 KiB
Nix
54 lines
1.7 KiB
Nix
|
{ stdenv
|
||
|
, fetchurl
|
||
|
, ncurses5
|
||
|
, python27
|
||
|
}:
|
||
|
|
||
|
stdenv.mkDerivation rec {
|
||
|
pname = "gcc-arm-embedded";
|
||
|
version = "10-2020-q4-major";
|
||
|
subdir = "10-2020q4";
|
||
|
|
||
|
suffix = {
|
||
|
aarch64-linux = "aarch64-linux";
|
||
|
x86_64-darwin = "mac";
|
||
|
x86_64-linux = "x86_64-linux";
|
||
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||
|
|
||
|
src = fetchurl {
|
||
|
url = "https://developer.arm.com/-/media/Files/downloads/gnu-rm/${subdir}/gcc-arm-none-eabi-${version}-${suffix}.tar.bz2";
|
||
|
sha256 = {
|
||
|
aarch64-linux = "0spkbh7vnda1w0nvavk342nb24nqxn8kln3k9j85mzil560qqg9l";
|
||
|
x86_64-darwin = "1h5xn0npwkilqxg7ifrymsl7kjpafr9r9gjqgcpb0kjxavijvldy";
|
||
|
x86_64-linux = "066nvhg5zdf3jvy9w23y439ghf1hvbicdyrrw9957gwb8ym4q4r1";
|
||
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||
|
};
|
||
|
|
||
|
dontConfigure = true;
|
||
|
dontBuild = true;
|
||
|
dontPatchELF = true;
|
||
|
dontStrip = true;
|
||
|
|
||
|
installPhase = ''
|
||
|
mkdir -p $out
|
||
|
cp -r * $out
|
||
|
ln -s $out/share/doc/gcc-arm-none-eabi/man $out/man
|
||
|
'';
|
||
|
|
||
|
preFixup = ''
|
||
|
find $out -type f | while read f; do
|
||
|
patchelf "$f" > /dev/null 2>&1 || continue
|
||
|
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
|
||
|
patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 python27 ]} "$f" || true
|
||
|
done
|
||
|
'';
|
||
|
|
||
|
meta = with stdenv.lib; {
|
||
|
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 ];
|
||
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
||
|
};
|
||
|
}
|