3 %bcond_with bootstrap # build without nacl newlib package
5 %define gitver cff9ac88
6 Summary: Various compilers (C, C++) for nacl
9 Release: 0.git%{gitver}
11 # git clone http://git.chromium.org/native_client/nacl-gcc.git
12 # (Checkout ID taken from chromium-15.0.874.106/native_client/tools/REVISIONS)
14 # git checkout cff9ac884908ba53ae16149e7c7d19c336aa4895
16 # For gcc version, echo gcc/BASE-VER
17 # mv nacl-gcc nacl-gcc-4.4.3-gitcff9ac88
18 # tar cfj nacl-gcc-4.4.3-gitcff9ac88.tar.bz2 nacl-gcc-4.4.3-gitcff9ac88
19 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
20 Group: Development/Languages
21 Source0: nacl-gcc-%{version}-git%{gitver}.tar.bz2
22 # Source0-md5: 5f96c99136882b2b22a5d173890f8026
23 URL: http://sourceware.org/gcc/
24 BuildRequires: cloog-ppl-devel
25 BuildRequires: crossnacl-binutils
26 BuildRequires: elfutils-devel
27 BuildRequires: gmp-devel
28 BuildRequires: mpfr-devel
29 BuildRequires: ppl-pwl-devel
30 %if %{without bootstrap}
31 BuildRequires: nacl-newlib
33 ExclusiveArch: %{ix86} %{x8664}
34 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36 %define gcc_target_platform x86_64-nacl
39 The gcc package contains the GNU Compiler Collection version 4.4.3.
40 You'll need this package in order to compile C code. This provides
41 support for nacl targets.
44 %setup -q -n nacl-gcc-%{version}-git%{?gitver}
47 rm -rf obj-%{gcc_target_platform}
48 mkdir obj-%{gcc_target_platform}
49 cd obj-%{gcc_target_platform}
51 OPT_FLAGS=`echo %{rpmcflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
52 OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
54 OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-march=i.86//g'`
56 OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
58 *-fasynchronous-unwind-tables*)
59 %{__sed} -i -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/' \
64 GCC_DEFINES="-Dinhibit_libc -D__gthr_posix_h"
68 --infodir=%{_infodir} \
69 --libexecdir=%{_libdir} \
70 --enable-checking=release \
71 --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
72 --enable-gnu-unique-object \
73 --disable-decimal-float \
75 --disable-libmudflap \
77 --disable-libstdcxx-pch \
79 --with-ppl --with-cloog \
81 CFLAGS="$OPT_FLAGS $GCC_DEFINES" \
82 CXXFLAGS="`echo $OPT_FLAGS | sed 's/ -Wall / /g'`" \
83 XCFLAGS="$OPT_FLAGS" \
86 --enable-languages="c" \
88 CFLAGS_FOR_TARGET="-O2 -g" \
89 CXXFLAGS_FOR_TARGET="-O2 -g" \
91 CFLAGS_FOR_TARGET="-O2 -g -mtls-use-call -I/usr/x86_64-nacl/include/" \
92 CXXFLAGS_FOR_TARGET="-O2 -g -mtls-use-call -I/usr/x86_64-nacl/include/" \
93 --enable-threads=nacl \
94 --enable-languages="c,c++,objc" \
98 --target=%{gcc_target_platform} \
99 --with-host-libstdcxx="-lpwl -lstdc++ -lm" \
100 --disable-ppl-version-check \
104 BOOT_CFLAGS="$OPT_FLAGS" \
105 %if %{with bootstrap}
106 all-gcc all-target-libgcc
112 rm -rf $RPM_BUILD_ROOT
113 cd obj-%{gcc_target_platform}
115 %if %{with bootstrap}
116 install-gcc install-target-libgcc \
120 DESTDIR=$RPM_BUILD_ROOT
122 # Delete supplemental files that would conflict with the core toolchain
123 %{__rm} -r $RPM_BUILD_ROOT%{_infodir}
124 %{__rm} -r $RPM_BUILD_ROOT%{_mandir}/man7/
125 # I suspect that the core toolchain locale files will work with this reasonably well.
126 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/
128 # Don't dupe the system libiberty.a
129 #%{__rm} $RPM_BUILD_ROOT%{_libdir}/libiberty.a
132 rm -rf $RPM_BUILD_ROOT
135 %defattr(644,root,root,755)
136 %doc gcc/README* gcc/COPYING*
137 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-cpp
138 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gcc
139 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gcc-%{version}
140 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gccbug
141 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gcov
142 %{_prefix}/lib/gcc/%{gcc_target_platform}/
143 %{_libexecdir}/gcc/%{gcc_target_platform}/
144 %{_mandir}/man1/%{gcc_target_platform}-cpp.*
145 %{_mandir}/man1/%{gcc_target_platform}-gcc.*
146 %{_mandir}/man1/%{gcc_target_platform}-gcov.*
148 %if %{without bootstrap}
149 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-c++
150 %attr(755,root,root) %{_bindir}/%{gcc_target_platform}-g++
151 %{_prefix}/%{gcc_target_platform}/include/c++
152 %{_prefix}/%{gcc_target_platform}/lib*/
153 %{_mandir}/man1/%{gcc_target_platform}-g++.*