#
# Conditional build:
-%bcond_with bootstrap # build without nacl newlib package
+%bcond_with bootstrap # build without NaCL newlib package dependency (without c++ package)
-%define gitver cff9ac88
-Summary: Various compilers (C, C++) for nacl
+%define gitver 3937565
+Summary: Various compilers (C, C++) for NaCl
Name: crossnacl-gcc
Version: 4.4.3
-Release: 0.git%{gitver}
-# Generated from git
-# git clone http://git.chromium.org/native_client/nacl-gcc.git
-# (Checkout ID taken from chromium-15.0.874.106/native_client/tools/REVISIONS)
-# cd nacl-gcc
-# git checkout cff9ac884908ba53ae16149e7c7d19c336aa4895
-# cd ..
-# For gcc version, echo gcc/BASE-VER
-# mv nacl-gcc nacl-gcc-4.4.3-gitcff9ac88
-# tar cfj nacl-gcc-4.4.3-gitcff9ac88.tar.bz2 nacl-gcc-4.4.3-gitcff9ac88
-License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
+Release: 6.git%{gitver}
+License: GPL v3+ and GPL v3+ with exceptions and GPL v2+ with exceptions
Group: Development/Languages
Source0: nacl-gcc-%{version}-git%{gitver}.tar.bz2
-# Source0-md5: 5f96c99136882b2b22a5d173890f8026
+# Source0-md5: fcdfdd30b82d8ad8fa6e39e7e32cee64
+Source1: get-source.sh
URL: http://sourceware.org/gcc/
BuildRequires: cloog-ppl-devel
BuildRequires: crossnacl-binutils
BuildRequires: elfutils-devel
+BuildRequires: gmp-c++-devel
BuildRequires: gmp-devel
BuildRequires: mpfr-devel
BuildRequires: ppl-pwl-devel
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
%if %{without bootstrap}
-BuildRequires: nacl-newlib
+BuildRequires: crossnacl-newlib
%endif
ExclusiveArch: %{ix86} %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define gcc_target_platform x86_64-nacl
+%define target x86_64-nacl
+%define arch %{_prefix}/%{target}
+%define gcc_ver %{version}
+%define gcclib %{_libdir}/gcc/%{target}/%{gcc_ver}
+%define gccnlib %{_prefix}/lib/gcc/%{target}/%{gcc_ver}
+
+%define filterout_cpp -D_FORTIFY_SOURCE=[0-9]+
%description
The gcc package contains the GNU Compiler Collection version 4.4.3.
-You'll need this package in order to compile C code. This provides
-support for nacl targets.
+You'll need this package in order to compile C code.
+
+This provides support for NaCl targets.
+
+%package c++
+Summary: C++ support for crossnacl-gcc
+Summary(pl.UTF-8): Obsługa C++ dla crossnacl-gcc
+Group: Development/Languages
+Requires: %{name} = %{version}-%{release}
+
+%description c++
+This package adds C++ support to the GNU Compiler Collection for NaCl
+targets.
+
+%description c++ -l pl.UTF-8
+Ten pakiet dodaje obsługę C++ do kompilatora gcc dla NaCL.
+
+%package objc
+Summary: NaCL binary utility development utilities - objc
+Summary(pl.UTF-8): Zestaw narzędzi NaCL - objc
+Group: Development/Languages
+Requires: %{name} = %{version}-%{release}
+
+%description objc
+This package contains cross targeted objc compiler.
+
+%description objc -l pl.UTF-8
+Ten pakiet zawiera kompilator objc generujący kod pod Win32.
%prep
%setup -q -n nacl-gcc-%{version}-git%{?gitver}
%build
-rm -rf obj-%{gcc_target_platform}
-mkdir obj-%{gcc_target_platform}
-cd obj-%{gcc_target_platform}
-CC=gcc
-OPT_FLAGS=`echo %{rpmcflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
-OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
+rm -rf obj-%{target}
+install -d obj-%{target}
+cd obj-%{target}
+
+OPT_FLAGS="%{rpmcflags}"
+OPT_FLAGS=$(echo "$OPT_FLAGS" | sed -e 's/-m64//g;s/-m32//g;s/-m31//g')
%ifarch %{ix86}
-OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-march=i.86//g'`
+OPT_FLAGS=$(echo "$OPT_FLAGS" | sed -e 's/-march=i.86//g')
%endif
-OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
+OPT_FLAGS=$(echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g')
+
case "$OPT_FLAGS" in
*-fasynchronous-unwind-tables*)
%{__sed} -i -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/' \
--infodir=%{_infodir} \
--libexecdir=%{_libdir} \
--enable-checking=release \
- --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
+ --with-system-zlib \
+ --enable-__cxa_atexit \
+ --disable-libunwind-exceptions \
--enable-gnu-unique-object \
--disable-decimal-float \
--disable-libgomp \
--disable-libstdcxx-pch \
--disable-shared \
--with-ppl --with-cloog \
- CC="$CC" \
+ CC="%{__cc}" \
CFLAGS="$OPT_FLAGS $GCC_DEFINES" \
- CXXFLAGS="`echo $OPT_FLAGS | sed 's/ -Wall / /g'`" \
+ CXXFLAGS="$(echo $OPT_FLAGS | sed 's/ -Wall / /g')" \
XCFLAGS="$OPT_FLAGS" \
%if %{with bootstrap}
--disable-threads \
--enable-tls \
--with-newlib \
%endif
- --target=%{gcc_target_platform} \
+ --target=%{target} \
--with-host-libstdcxx="-lpwl -lstdc++ -lm" \
--disable-ppl-version-check \
--disable-libgcj
%install
rm -rf $RPM_BUILD_ROOT
-cd obj-%{gcc_target_platform}
+cd obj-%{target}
%{__make} \
%if %{with bootstrap}
install-gcc install-target-libgcc \
%endif
DESTDIR=$RPM_BUILD_ROOT
+# move fixed includes to proper place
+mv $RPM_BUILD_ROOT%{gccnlib}/include-fixed/*.h $RPM_BUILD_ROOT%{gccnlib}/include
+
+%{__rm} -r $RPM_BUILD_ROOT%{gccnlib}/include-fixed
+%{__rm} -r $RPM_BUILD_ROOT%{gccnlib}/install-tools
+
# Delete supplemental files that would conflict with the core toolchain
%{__rm} -r $RPM_BUILD_ROOT%{_infodir}
-%{__rm} -r $RPM_BUILD_ROOT%{_mandir}/man7/
+%{__rm} -r $RPM_BUILD_ROOT%{_mandir}/man7
# I suspect that the core toolchain locale files will work with this reasonably well.
-%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/
+%{__rm} -r $RPM_BUILD_ROOT%{_localedir}
# Don't dupe the system libiberty.a
-#%{__rm} $RPM_BUILD_ROOT%{_libdir}/libiberty.a
+%if %{without bootstrap}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libiberty.a
+%{__rm} $RPM_BUILD_ROOT%{_prefix}/%{target}/lib*/libiberty.a
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc gcc/README* gcc/COPYING*
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-cpp
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gcc
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gcc-%{version}
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gccbug
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-gcov
-%{_prefix}/lib/gcc/%{gcc_target_platform}/
-%{_libexecdir}/gcc/%{gcc_target_platform}/
-%{_mandir}/man1/%{gcc_target_platform}-cpp.*
-%{_mandir}/man1/%{gcc_target_platform}-gcc.*
-%{_mandir}/man1/%{gcc_target_platform}-gcov.*
+%doc gcc/README*
+%attr(755,root,root) %{_bindir}/%{target}-cpp
+%attr(755,root,root) %{_bindir}/%{target}-gcc
+%attr(755,root,root) %{_bindir}/%{target}-gcc-%{gcc_ver}
+%attr(755,root,root) %{_bindir}/%{target}-gccbug
+%attr(755,root,root) %{_bindir}/%{target}-gcov
+
+%if "%{_lib}" != "lib"
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{target}
+%dir %{gccnlib}
+%endif
+
+%{gccnlib}/*.[ao]
+%dir %{gccnlib}/include
+%{gccnlib}/include/*.h
+
+%dir %{gccnlib}/32
+%{gccnlib}/32/*.[oa]
+
+%dir %{_libexecdir}
+%dir %{_libexecdir}/gcc
+%dir %{_libexecdir}/gcc/%{target}
+%dir %{gcclib}
+%attr(755,root,root) %{gcclib}/cc1
+%attr(755,root,root) %{gcclib}/collect2
+
+%if "%{_lib}" != "lib"
+# not present on ix86, not needed?
+%dir %{gcclib}/install-tools
+%attr(755,root,root) %{gcclib}/install-tools/*
+%endif
+
+%{_mandir}/man1/%{target}-cpp.*
+%{_mandir}/man1/%{target}-gcc.*
+%{_mandir}/man1/%{target}-gcov.*
%if %{without bootstrap}
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-c++
-%attr(755,root,root) %{_bindir}/%{gcc_target_platform}-g++
-%{_prefix}/%{gcc_target_platform}/include/c++
-%{_prefix}/%{gcc_target_platform}/lib*/
-%{_mandir}/man1/%{gcc_target_platform}-g++.*
+%files c++
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/%{target}-c++
+%attr(755,root,root) %{_bindir}/%{target}-g++
+%attr(755,root,root) %{gcclib}/cc1plus
+%{_prefix}/%{target}/include/c++
+%dir %{_prefix}/%{target}/lib32
+%dir %{_prefix}/%{target}/lib64
+%{_prefix}/%{target}/lib*/libstdc++.*a
+%{_prefix}/%{target}/lib*/libsupc++.*a
+%{_mandir}/man1/%{target}-g++.*
+
+%files objc
+%defattr(644,root,root,755)
+%attr(755,root,root) %{gcclib}/cc1obj
+%{_prefix}/%{target}/lib*/libobjc.*a
+%{gccnlib}/include/objc
%endif