nixpkgs-suyu/pkgs/development/compilers/gcc-arm-embedded/6/default.nix
Pavol Rusnak c3557f2e64
gcc-arm-embedded-{6,7,8}: enable on aarch64-darwin
(using x86_64-darwin binaries, these can be run if rosetta is installed)
2021-12-05 23:35:52 +01:00

55 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchurl
, ncurses5
, python27
}:
stdenv.mkDerivation rec {
pname = "gcc-arm-embedded";
version = "6.3.1";
release = "6-2017-q2-update";
subdir = "6-2017q2";
suffix = {
aarch64-darwin = "mac"; # use intel binaries via rosetta
x86_64-darwin = "mac";
x86_64-linux = "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-${release}-${suffix}.tar.bz2";
sha256 = {
aarch64-darwin = "0019ylpq4inq7p5gydpmc9m8ni72fz2csrjlqmgx1698998q0c3x";
x86_64-darwin = "0019ylpq4inq7p5gydpmc9m8ni72fz2csrjlqmgx1698998q0c3x";
x86_64-linux = "1hvwi02mx34al525sngnl0cm7dkmzxfkb1brq9kvbv28wcplp3p6";
}.${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 ${lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 python27 ]} "$f" || true
done
'';
meta = with 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" "x86_64-darwin" "aarch64-darwin" ];
};
}