%define target mips Name: %{target}-gcc Version: 4.4.2 Release: 1%{?dist} Summary: Cross Compiling GNU GCC targeted at %{target} Group: Development/Languages License: GPLv2+ URL: http://gcc.gnu.org/ Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{version}/gcc-core-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n) BuildRequires: %{target}-binutils zlib-devel gawk Requires: %{target}-binutils %description This is a Cross Compiling version of GNU GCC, which can be used to compile programs for the %{target} platform, instead of for the native %{_arch} platform. %prep %setup -q -c -a 0 pushd gcc-%{version} contrib/gcc_update --touch popd # Extract %%__os_install_post into os_install_post~ cat << \EOF > os_install_post~ %__os_install_post EOF # Generate customized brp-*scripts cat os_install_post~ | while read a x y; do case $a in # Prevent brp-strip* from trying to handle foreign binaries */brp-strip*) b=$(basename $a) sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b chmod a+x $b ;; esac done sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \ < os_install_post~ > os_install_post # fix-includes doesn't like symlinks so copy the kernel headers over mkdir -p %{_builddir}/%{name}-%{version}/sysroot/%{_includedir} %build %define languages 'c' mkdir -p build-%{target}-gcc pushd build-%{target}-gcc CC="%{__cc} ${RPM_OPT_FLAGS}" \ ../gcc-%{version}/configure --prefix=%{_prefix} \ --mandir=%{_mandir} --infodir=%{_infodir} \ --target=%{target} --enable-languages=%{languages} --disable-threads \ --disable-libmudflap --disable-libssp --disable-multilib --disable-shared \ --disable-nls --enable-long-long --enable-symvers=gnu --enable-c99 \ --enable-cxx-flags=-mcpu=mips \ --disable-libstdcxx-pch --enable-__cxa_atexit \ --enable-version-specific-runtime-libs # In general, building GCC is not smp-safe make popd %install rm -rf $RPM_BUILD_ROOT pushd build-%{target}-gcc make install DESTDIR=$RPM_BUILD_ROOT popd # we don't want these as we are a cross version rm -r $RPM_BUILD_ROOT%{_infodir} rm -r $RPM_BUILD_ROOT%{_mandir}/man7 # and these aren't usefull for embedded targets rm -r $RPM_BUILD_ROOT/usr/lib/gcc/%{target}/%{version}/install-tools rm -r $RPM_BUILD_ROOT%{_libexecdir}/gcc/%{target}/%{version}/install-tools rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a %define __os_install_post . ./os_install_post %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc gcc-%{version}/COPYING gcc-%{version}/COPYING.LIB %doc gcc-%{version}/README %{_bindir}/%{target}-* %{_prefix}/lib/gcc/%{target}/ %{_libexecdir}/gcc/%{target}/ %{_mandir}/man1/%{target}-*.1.gz %changelog * Tue Oct 20 2009 Conrad Meyer konrad@tylerc.org 4.4.2-1 - Initial package.