d0966f2
# CodeSourcery releases are identified by a date, a release number,
d0966f2
# and a package number for downloading from their web site
0a76a3b
%global cs_date        2014.05
0a76a3b
%global cs_rel         28
0a76a3b
%global cs_pkgnum      12773
d0966f2
d0966f2
%global processor_arch arm
d0966f2
%global target         %{processor_arch}-none-eabi
acce1fe
%global gcc_ver        5.1.0
acce1fe
%global gcc_short_ver  5.1
d0966f2
d0966f2
# we need newlib to compile complete gcc, but we need gcc to compile newlib,
d0966f2
# so compile minimal gcc first
acce1fe
%global bootstrap      1
d0966f2
d0966f2
Name:           %{target}-gcc-cs
3f0a47a
Epoch:          1
acce1fe
Version:        5.1.0
acce1fe
Release:        1%{?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
3f0a47a
#Source0:        gcc-%{cs_date}-%{cs_rel}.tar.bz2
3f0a47a
Source0:        gcc-%{gcc_ver}.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
3f0a47a
Patch1:         enable-with-multilib-list-for-arm.patch
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
561d19e
Requires:       %{name} = %{epoch}:%{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
3f0a47a
pushd gcc-%{gcc_ver}
3f0a47a
%patch1 -p2 -b .arm
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)
b2dfd61
  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}
acce1fe
CC="%{__cc} ${RPM_OPT_FLAGS}  -fno-stack-protector" \
3f0a47a
../gcc-%{gcc_ver}/configure --prefix=%{_prefix} --mandir=%{_mandir} \
d0966f2
  --with-pkgversion="Fedora %{version}-%{release}" \
d0966f2
  --with-bugurl="https://bugzilla.redhat.com/" \
d0966f2
  --infodir=%{_infodir} --target=%{target} \
0a76a3b
  --enable-interwork --enable-multilib \
3f0a47a
  --with-python-dir=share/gcc-%{target} \
3f0a47a
  --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r \
3f0a47a
    --enable-plugins \
3f0a47a
    --disable-decimal-float \
3f0a47a
    --disable-libffi \
3f0a47a
    --disable-libgomp \
3f0a47a
    --disable-libmudflap \
3f0a47a
    --disable-libquadmath \
3f0a47a
    --disable-libssp \
3f0a47a
    --disable-libstdcxx-pch \
3f0a47a
   --disable-libstdc++-v3 \
3f0a47a
    --disable-nls \
3f0a47a
    --disable-shared \
3f0a47a
    --disable-threads \
3f0a47a
    --disable-tls \
d0966f2
%if %{bootstrap}
7527f8e
   --enable-languages=c --with-newlib --disable-nls --disable-shared --disable-threads --with-gnu-as --with-gnu-ld --with-gmp --with-mpfr --with-mpc --without-headers --with-system-zlib
d0966f2
%else
3f0a47a
   --enable-languages=c,c++ --with-newlib --disable-nls --disable-shared --disable-threads --with-gnu-as --with-gnu-ld --with-gmp --with-mpfr --with-mpc --with-headers=/usr/%{target}/include --with-system-zlib
d0966f2
%endif
3f0a47a
#  --enable-lto \
d0966f2
d0966f2
%if %{bootstrap}
3f0a47a
make all-gcc  INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
d0966f2
%else
3f0a47a
make  INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'
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
3f0a47a
rm -f $RPM_BUILD_ROOT%{_prefix}/lib/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
3f0a47a
3f0a47a
mkdir -p $RPM_BUILD_ROOT/usr/%{target}/share/gcc-%{gcc_ver}/
3f0a47a
mv $RPM_BUILD_ROOT/%{_datadir}/gcc-%{gcc_ver}/* $RPM_BUILD_ROOT/usr/%{target}/share/gcc-%{gcc_ver}/ ||:
3f0a47a
rm -rf $RPM_BUILD_ROOT/%{_datadir}/gcc-%{gcc_ver} ||:
3f0a47a
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,-)
3f0a47a
%doc gcc-%{gcc_ver}/COPYING*
3f0a47a
%doc gcc-%{gcc_ver}/README README.fedora
d0966f2
%{_bindir}/%{target}-*
3f0a47a
%dir %{_prefix}/lib/gcc
3f0a47a
%dir %{_prefix}/lib/gcc/%{target}
3f0a47a
%{_prefix}/lib/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}
3f0a47a
#/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
3f0a47a
#/usr/%{target}/include/c++/
3f0a47a
#%dir /usr/%{target}/share/gcc-%{gcc_ver}/python/
3f0a47a
#/usr/%{target}/share/gcc-%{gcc_ver}/python/libstdcxx/
d0966f2
%{_mandir}/man1/%{target}-g++.1.gz
d0966f2
%endif
d0966f2
d0966f2
%changelog
acce1fe
* Sun May 31 2015 Michal Hlavinka <mhlavink@redhat.com> - 1:5.1.0-3
acce1fe
- updated to gcc 5.1.0, bootstrap build
acce1fe
a5523fa
* Wed Apr 15 2015 Michal Hlavinka <mhlavink@redhat.com> - 1:4.9.2-3
a5523fa
- regular build
a5523fa
561d19e
* Wed Apr 15 2015 Michal Hlavinka <mhlavink@redhat.com> - 1:4.9.2-2
561d19e
- add epoch number
561d19e
3f0a47a
* Tue Apr 14 2015 Michal Hlavinka <mhlavink@redhat.com> - 1:4.9.2-1
3f0a47a
- update to gcc 4.9.2
3f0a47a
- fix library compatiblity 
3f0a47a
- BOOTSTRAP version, not for regular use
3f0a47a
b2dfd61
* Tue Sep 02 2014 Michal Hlavinka <mhlavink@redhat.com> - 2014.05.28-2
b2dfd61
- update workaround that prevents stripping of arm libraries
b2dfd61
0a76a3b
* Thu Aug 21 2014 Michal Hlavinka <mhlavink@redhat.com> - 2014.05.28-1
0a76a3b
- updated to 2014.05-28
0a76a3b
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