nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchurl
4, ncurses5
5}:
6
7stdenv.mkDerivation rec {
8 pname = "gcc-arm-embedded";
9 version = "6.3.1";
10 release = "6-2017-q2-update";
11 subdir = "6-2017q2";
12
13 suffix = {
14 x86_64-darwin = "mac";
15 x86_64-linux = "linux";
16 }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
17
18 src = fetchurl {
19 url = "https://developer.arm.com/-/media/Files/downloads/gnu-rm/${subdir}/gcc-arm-none-eabi-${release}-${suffix}.tar.bz2";
20 sha256 = {
21 x86_64-darwin = "0019ylpq4inq7p5gydpmc9m8ni72fz2csrjlqmgx1698998q0c3x";
22 x86_64-linux = "1hvwi02mx34al525sngnl0cm7dkmzxfkb1brq9kvbv28wcplp3p6";
23 }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
24 };
25
26 dontConfigure = true;
27 dontBuild = true;
28 dontPatchELF = true;
29 dontStrip = true;
30
31 installPhase = ''
32 mkdir -p $out
33 cp -r * $out
34 ln -s $out/share/doc/gcc-arm-none-eabi/man $out/man
35 '';
36
37 preFixup = ''
38 find $out -type f | while read f; do
39 patchelf "$f" > /dev/null 2>&1 || continue
40 patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
41 patchelf --set-rpath ${lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 ]} "$f" || true
42 done
43 '';
44
45 meta = with lib; {
46 description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";
47 homepage = "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm";
48 license = with licenses; [ bsd2 gpl2 gpl3 lgpl21 lgpl3 mit ];
49 maintainers = with maintainers; [ prusnak ];
50 platforms = [ "x86_64-linux" "x86_64-darwin" ];
51 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
52 };
53}