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 = "8.3.1";
10 release = "8-2019-q3-update";
11 subdir = "8-2019q3/RC1.1";
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 = "fc235ce853bf3bceba46eff4b95764c5935ca07fc4998762ef5e5b7d05f37085";
22 x86_64-linux = "b50b02b0a16e5aad8620e9d7c31110ef285c1dde28980b1a9448b764d77d8f92";
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}