summary refs log tree commit diff
path: root/pkgs/development/compilers/arm-frc-linux-gnueabi-gcc/default.nix
blob: 6fa25df5e0333c8d6bd757eb8fe4ce2b67642f6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{stdenv, fetchurl
, arm-frc-linux-gnueabi-binutils, arm-frc-linux-gnueabi-eglibc, arm-frc-linux-gnueabi-linux-api-headers
, elfutils
, libmpc, gmp, mpfr, zlib, isl_0_15, cloog}:

stdenv.mkDerivation rec {
  _target = "arm-frc-linux-gnueabi";

  version = "4.9.4";
  name = "${_target}-gcc-${version}";

  src = fetchurl {
    url = "ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/gcc-${version}.tar.bz2";
    sha256 = "6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092";
  };

  patches = [
    ./minorSOname.patch
    ./no-nested-deprecated-warnings.patch
  ];

  hardeningDisable = [ "format" ];

  buildInputs = [
    arm-frc-linux-gnueabi-binutils
    arm-frc-linux-gnueabi-eglibc
    arm-frc-linux-gnueabi-linux-api-headers
    elfutils
    libmpc
    gmp
    mpfr
    zlib
    isl_0_15
    cloog
  ];


  configurePhase = ''
    mkdir gcc-build
    cd gcc-build
    ../configure \
      --prefix=$out \
      --host=$CHOST \
      --build=$CHOST \
      --program-prefix=${_target}- \
      --target=${_target} \
      --enable-shared \
      --disable-nls \
      --enable-threads=posix \
      --enable-languages=c,c++ \
      --disable-multilib \
      --disable-multiarch \
      --with-sysroot=${arm-frc-linux-gnueabi-eglibc}/${_target} \
      --with-build-sysroot=${arm-frc-linux-gnueabi-eglibc}/${_target} \
      --with-as=${arm-frc-linux-gnueabi-binutils}/${_target}/bin/as \
      --with-ld=${arm-frc-linux-gnueabi-binutils}/${_target}/bin/ld \
      --with-cpu=cortex-a9 \
      --with-float=softfp \
      --with-fpu=vfp \
      --with-specs='%{save-temps:-fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' \
      --enable-lto \
      --with-pkgversion='GCC-for-FRC' \
      --with-cloog \
      --enable-poison-system-directories \
      --enable-plugin \
      --with-system-zlib \
      --disable-libmudflap \
      --disable-libsanitizer
  '';

  makeFlags = [
    "all-gcc"
    "all-target-libgcc"
    "all-target-libstdc++-v3"
  ];

  installPhase = ''
    make install-gcc install-target-libgcc install-target-libstdc++-v3
  '';

  postInstall = ''
    rm -rf $out/share/{man/man7,info}/ "$out/share/gcc-${version}/python"
  '';

  meta = with stdenv.lib; {
    description = "FRC cross compiler";
    longDescription = ''
      arm-frc-linux-gnueabi-gcc is a cross compiler for building
      code for FIRST Robotics Competition. Used as a cross compiler
      for the NI RoboRio.
    '';
    license = licenses.gpl2;
    maintainers = [ maintainers.colescott ];
    platforms = platforms.linux;

    priority = 4;
  };
}