d0966f2
# CodeSourcery releases are identified by a date, a release number,
d0966f2
# and a package number for downloading from their web site
4434c6f
%global cs_date        2013.11
4434c6f
%global cs_rel         24
4434c6f
%global cs_pkgnum      12189
d0966f2
d0966f2
%global processor_arch arm
d0966f2
%global target         %{processor_arch}-none-eabi
4434c6f
%global gcc_ver        4.8.1
4434c6f
%global gcc_short_ver  4.8
d0966f2
d0966f2
# we need newlib to compile complete gcc, but we need gcc to compile newlib,
d0966f2
# so compile minimal gcc first
2157acd
%global bootstrap      0
d0966f2
d0966f2
Name:           %{target}-gcc-cs
d0966f2
Version:        %{cs_date}.%{cs_rel}
3d642ba
Release:        4%{?dist}
d0966f2
Summary:        GNU GCC for cross-compilation for %{target} target
d0966f2
Group:          Development/Tools
d0966f2
d0966f2
# Most of the sources are licensed under GPLv3+ with these exceptions:
d0966f2
# LGPLv2+ libquadmath/ libjava/libltdl/ gcc/testsuite/objc.dg/gnu-encoding/generate-random 
d0966f2
#         libgcc/soft-fp/ libffi/msvcc.sh
d0966f2
# LGPLv3+ gcc/prefix.c
d0966f2
# BSD libgo/go/regexp/testdata/testregex.cz zlib/example.c libffi/ 
d0966f2
#     libjava/classpath/external/relaxngDatatype/org/relaxng/datatype/helpers/DatatypeLibraryLoader.java
d0966f2
# GPLv2+ libitm/testsuite/libitm.c/memset-1.c libjava/
d0966f2
# Public Domain libjava/classpath/external/sax/org/xml/sax/ext/EntityResolver2.java
d0966f2
#               libjava/classpath/external/sax/org/xml/sax/ext/DeclHandler.java
d0966f2
# BSL zlib/contrib/dotzlib/DotZLib/GZipStream.cs
d0966f2
License:        GPLv2+ and GPLv3+ and LGPLv2+ and BSD
d0966f2
URL:            http://www.codesourcery.com/sgpp/lite/%{processor_arch}
d0966f2
d0966f2
#we don't use orignal tarball, because it's HUGE
d0966f2
Source0:        gcc-%{cs_date}-%{cs_rel}.tar.bz2
d0966f2
#Source0 origin:
d0966f2
#wget https://sourcery.mentor.com/GNUToolchain/package%{cs_pkgnum}/public/%{target}/%{processor_arch}-%{cs_date}-%{cs_rel}-%{target}.src.tar.bz2
d0966f2
#tar jxvf %{processor_arg}-%{cs_date}-%{cs_rel}-%{target}.src.tar.bz2
d0966f2
d0966f2
Source1:        README.fedora
5b96676
Source2:        bootstrapexplain
d0966f2
2157acd
BuildRequires:  %{target}-binutils >= 2.21, zlib-devel gmp-devel mpfr-devel libmpc-devel flex autogen
2157acd
%if ! %{bootstrap}
2157acd
BuildRequires:  %{target}-newlib
2157acd
%endif
d0966f2
Requires:       %{target}-binutils >= 2.21
d0966f2
Provides:       %{target}-gcc = %{gcc_ver}
d0966f2
d0966f2
%description
d0966f2
This is a Cross Compiling version of GNU GCC, which can be used to
d0966f2
compile for the %{target} platform, instead of for the
d0966f2
native %{_arch} platform.
d0966f2
d0966f2
This package is based on the CodeSourcery %{cs_date}-%{cs_rel} release,
d0966f2
which includes improved ARM target support compared to the corresponding 
d0966f2
GNU GCC release.
d0966f2
d0966f2
%package c++
d0966f2
Summary:        Cross Compiling GNU GCC targeted at %{target}
d0966f2
Group:          Development/Languages
d0966f2
Requires:       %{name} = %{version}-%{release}
d0966f2
Provides:       %{target}-gcc-c++ = %{gcc_ver}
d0966f2
d0966f2
%description c++
d0966f2
This package contains the Cross Compiling version of g++, which can be used to
d0966f2
compile c++ code for the %{target} platform, instead of for the native 
d0966f2
%{_arch} platform.
d0966f2
d0966f2
This package is based on the CodeSourcery %{cs_date}-%{cs_rel} release,
d0966f2
which includes improved ARM target support compared to the corresponding 
d0966f2
GNU GCC release.
d0966f2
d0966f2
%prep
d0966f2
%setup -q -c
4434c6f
pushd gcc-%{gcc_short_ver}-%{cs_date}
d0966f2
d0966f2
contrib/gcc_update --touch
d0966f2
popd
d0966f2
cp -a %{SOURCE1} .
d0966f2
d0966f2
# Extract %%__os_install_post into os_install_post~
d0966f2
cat << \EOF > os_install_post~
d0966f2
%__os_install_post
d0966f2
EOF
d0966f2
d0966f2
# Generate customized brp-*scripts
d0966f2
cat os_install_post~ | while read a x y; do
d0966f2
case $a in
d0966f2
# Prevent brp-strip* from trying to handle foreign binaries
d0966f2
*/brp-strip*)
d0966f2
  b=$(basename $a)
d0966f2
  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
d0966f2
  chmod a+x $b
d0966f2
  ;;
d0966f2
esac
d0966f2
done
d0966f2
d0966f2
sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
d0966f2
< os_install_post~ > os_install_post 
d0966f2
d0966f2
d0966f2
%build
d0966f2
mkdir -p gcc-%{target}
d0966f2
pushd gcc-%{target}
d0966f2
CC="%{__cc} ${RPM_OPT_FLAGS}" \
4434c6f
../gcc-%{gcc_short_ver}-%{cs_date}/configure --prefix=%{_prefix} --mandir=%{_mandir} --libdir=%{_libdir} \
d0966f2
  --with-pkgversion="Fedora %{version}-%{release}" \
d0966f2
  --with-bugurl="https://bugzilla.redhat.com/" \
d0966f2
  --enable-lto \
d0966f2
  --infodir=%{_infodir} --target=%{target} \
d0966f2
  --enable-interwork --enable-multilib --with-newlib \
d0966f2
%if %{bootstrap}
d0966f2
  --enable-languages=c --disable-nls --disable-shared --disable-threads --with-gnu-as --with-gnu-ld --with-gmp --with-mpfr --with-mpc --without-headers --with-system-zlib --disable-libssp
d0966f2
%else
2157acd
  --enable-languages=c,c++ --disable-nls --disable-shared --disable-threads --with-gnu-as --with-gnu-ld --with-gmp --with-mpfr --with-mpc --with-newlib --with-headers=/usr/%{target}/include --with-system-zlib
d0966f2
%endif
d0966f2
d0966f2
# In general, building GCC is not smp-safe, but give it initial push anyway
d0966f2
%if %{bootstrap}
d0966f2
make all-gcc %{?_smp_mflags} || make all-gcc
d0966f2
%else
d0966f2
make %{?_smp_mflags} || make
d0966f2
%endif
d0966f2
popd
d0966f2
d0966f2
d0966f2
%install
d0966f2
pushd gcc-%{target}
d0966f2
%if %{bootstrap}
d0966f2
make install-gcc DESTDIR=$RPM_BUILD_ROOT
5b96676
install -p -m 0755 -D %{SOURCE2} $RPM_BUILD_ROOT/%{_bindir}/%{target}-g++
5b96676
install -p -m 0755 -D %{SOURCE2} $RPM_BUILD_ROOT/%{_bindir}/%{target}-c++
d0966f2
%else
d0966f2
make install DESTDIR=$RPM_BUILD_ROOT
d0966f2
%endif
d0966f2
popd
d0966f2
# we don't want these as we are a cross version
d0966f2
rm -r $RPM_BUILD_ROOT%{_infodir}
d0966f2
rm -r $RPM_BUILD_ROOT%{_mandir}/man7
d0966f2
rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
d0966f2
# and these aren't usefull for embedded targets
d0966f2
rm -r $RPM_BUILD_ROOT%{_prefix}/lib*/gcc/%{target}/%{gcc_ver}/install-tools ||:
d0966f2
rm -r $RPM_BUILD_ROOT%{_libexecdir}/gcc/%{target}/%{gcc_ver}/install-tools ||:
d0966f2
rm -f $RPM_BUILD_ROOT%{_libexecdir}/gcc/%{target}/%{gcc_ver}/*.la
d0966f2
d0966f2
%global __os_install_post . ./os_install_post
d0966f2
d0966f2
d0966f2
%check
d0966f2
%if %{bootstrap}
d0966f2
exit 0
d0966f2
%endif
5b96676
pushd gcc-%{target}
5b96676
#BuildRequires: autoge may be needed
d0966f2
make check
5b96676
popd
d0966f2
d0966f2
%files
d0966f2
%defattr(-,root,root,-)
d0966f2
%doc gcc-%{gcc_short_ver}-%{cs_date}/COPYING*
d0966f2
%doc gcc-%{gcc_short_ver}-%{cs_date}/README README.fedora
d0966f2
%{_bindir}/%{target}-*
d0966f2
%dir %{_libdir}/gcc
d0966f2
%dir %{_libdir}/gcc/%{target}
d0966f2
%{_libdir}/gcc/%{target}/%{gcc_ver}
d0966f2
%dir %{_libexecdir}/gcc
d0966f2
%dir %{_libexecdir}/gcc/%{target}
d0966f2
%{_libexecdir}/gcc/%{target}/%{gcc_ver}
d0966f2
%{_mandir}/man1/%{target}-*.1.gz
d0966f2
%if ! %{bootstrap}
d0966f2
/usr/%{target}/lib/
d0966f2
%exclude %{_bindir}/%{target}-?++
d0966f2
%exclude %{_libexecdir}/gcc/%{target}/%{gcc_ver}/cc1plus
d0966f2
%exclude %{_mandir}/man1/%{target}-g++.1.gz
d0966f2
%endif
d0966f2
d0966f2
%files c++
d0966f2
%defattr(-,root,root,-)
d0966f2
%{_bindir}/%{target}-?++
5b96676
%if ! %{bootstrap}
d0966f2
%{_libexecdir}/gcc/%{target}/%{gcc_ver}/cc1plus
d0966f2
/usr/%{target}/include/c++/
d0966f2
%dir /usr/%{target}/share/gcc-%{gcc_ver}/python/
d0966f2
/usr/%{target}/share/gcc-%{gcc_ver}/python/libstdcxx/
d0966f2
%{_mandir}/man1/%{target}-g++.1.gz
d0966f2
%endif
d0966f2
d0966f2
%changelog
3d642ba
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2013.11.24-4
3d642ba
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
3d642ba
a213e30
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2013.11.24-3
a213e30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
a213e30
2157acd
* Thu Jan 16 2014 Michal Hlavinka <mhlavink@redhat.com> - 2013.11.24-2
2157acd
- complete build with newlib
2157acd
4434c6f
* Tue Jan 14 2014 Michal Hlavinka <mhlavink@redhat.com> - 2013.11.24-1
4434c6f
- updated to 2013.11-24
4434c6f
5b96676
* Fri Oct 11 2013 Michal Hlavinka <mhlavink@redhat.com> - 2013.05.23-2
5b96676
- replace arm*-g++ with explanation script that this is just unsupported 
5b96676
  package used for bootstrapping
5b96676
4d616c1
* Sun Aug 25 2013 Michal Hlavinka <mhlavink@redhat.com> - 2013.05.23-1
4d616c1
- updated to 2013.05-23 release (gcc 4.7.3)
4d616c1
181b5ca
* Wed Aug 14 2013 Michal Hlavinka <mhlavink@redhat.com> - 2012.09.63-3
181b5ca
- fix aarch64 support (#925023)
181b5ca
50ef53d
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2012.09.63-2
50ef53d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
50ef53d
d0966f2
* Tue Feb 19 2013 Michal Hlavinka <mhlavink@redhat.com> - 2012.09.63-1
d0966f2
- initial package
d0966f2