@@ -0,0 +1,98 @@
1+{stdenv, fetchurl
2+, arm-frc-linux-gnueabi-binutils, arm-frc-linux-gnueabi-eglibc, arm-frc-linux-gnueabi-linux-api-headers
3+, elfutils
4+, libmpc, gmp, mpfr, zlib, isl_0_15, cloog}:
5+
6+stdenv.mkDerivation rec {
7+ _target = "arm-frc-linux-gnueabi";
8+
9+ version = "4.9.4";
10+ name = "${_target}-gcc-${version}";
11+
12+ src = fetchurl {
13+ url = "ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/gcc-${version}.tar.bz2";
14+ sha256 = "6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092";
15+ };
16+
17+ patches = [
18+ ./minorSOname.patch
19+ ./no-nested-deprecated-warnings.patch
20+ ];
21+
22+ hardeningDisable = [ "format" ];
23+
24+ buildInputs = [
25+ arm-frc-linux-gnueabi-binutils
26+ arm-frc-linux-gnueabi-eglibc
27+ arm-frc-linux-gnueabi-linux-api-headers
28+ elfutils
29+ libmpc
30+ gmp
31+ mpfr
32+ zlib
33+ isl_0_15
34+ cloog
35+ ];
36+
37+
38+ configurePhase = ''
39+ mkdir gcc-build
40+ cd gcc-build
41+ ../configure \
42+ --prefix=$out \
43+ --host=$CHOST \
44+ --build=$CHOST \
45+ --program-prefix=${_target}- \
46+ --target=${_target} \
47+ --enable-shared \
48+ --disable-nls \
49+ --enable-threads=posix \
50+ --enable-languages=c,c++ \
51+ --disable-multilib \
52+ --disable-multiarch \
53+ --with-sysroot=${arm-frc-linux-gnueabi-eglibc}/${_target} \
54+ --with-build-sysroot=${arm-frc-linux-gnueabi-eglibc}/${_target} \
55+ --with-as=${arm-frc-linux-gnueabi-binutils}/${_target}/bin/as \
56+ --with-ld=${arm-frc-linux-gnueabi-binutils}/${_target}/bin/ld \
57+ --with-cpu=cortex-a9 \
58+ --with-float=softfp \
59+ --with-fpu=vfp \
60+ --with-specs='%{save-temps:-fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' \
61+ --enable-lto \
62+ --with-pkgversion='GCC-for-FRC' \
63+ --with-cloog \
64+ --enable-poison-system-directories \
65+ --enable-plugin \
66+ --with-system-zlib \
67+ --disable-libmudflap \
68+ --disable-libsanitizer
69+ '';
70+
71+ makeFlags = [
72+ "all-gcc"
73+ "all-target-libgcc"
74+ "all-target-libstdc++-v3"
75+ ];
76+
77+ installPhase = ''
78+ make install-gcc install-target-libgcc install-target-libstdc++-v3
79+ '';
80+
81+ postInstall = ''
82+ rm -rf $out/share/{man/man7,info}/ "$out/share/gcc-${version}/python"
83+ '';
84+
85+ meta = with stdenv.lib; {
86+ description = "FRC cross compiler";
87+ longDescription = ''
88+ arm-frc-linux-gnueabi-gcc is a cross compiler for building
89+ code for FIRST Robotics Competition. Used as a cross compiler
90+ for the NI RoboRio.
91+ '';
92+ license = licenses.gpl2;
93+ maintainers = [ maintainers.colescott ];
94+ platforms = platforms.linux;
95+
96+ priority = 4;
97+ };
98+}