summaryrefslogblamecommitdiffstats
path: root/rtems/config/tools/rtems-nios2-gcc-4.1-newlib-1.19.0-1.cfg
blob: 69ae8402615c6d2bd5482bee078bfe35ab39c05b (plain) (tree)
1
2
3
4
5
6
7
8


                                     

                                                       
 

               













                                 

                                                                                       





                                                                                                   

 




                               




                  
                                                                                       
                                                                  



        
                                                                                    
                                                                            









                                 




                                                                
       
                                     
                                               

                      

          
                                              
                                                        

                         
 
                                        

                                                                     



                                                                  
                      
                            
                 

      




                       



                            


                     
                                  























                                                                          



                                                           
                                                                    
    
 

                                                     


        
                           
 
                 























                                                                                
                                                    

                                    
                                                                   

                          
                                           

                                 


                                                       
                                      
#
# RTEMS NIOS2 GCC 4.1., Newlib 1.19.0
#
# This configuration has special support for the NIOS2.
#

%disable select

%include %{_configdir}/checks.cfg
%include %{_configdir}/base.cfg

%define gcc_version    4.1
%define newlib_version 1.19.0
%define newlib_cfg     normalc

%define with_threads 1
%define with_plugin  0
%define enable_cxx   1

#
# The RTEMS 4.11 patches
#
%patch add gcc %{rtems_gcc_patches}/nios2/nios2-gcc-4.1-rtems-20110818.diff
%patch add newlib %{rtems_newlib_patches}/nios2/nios2-newlib-1.19.0-rtems-20110720.diff

Name:      %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
Summary:   GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
Version:   %{gcc_version}
Release:   %{release}
URL: 	   http://gcc.gnu.org/

#
# Supports Candian Cross (Cxc).
#
%define allow_cxc

#
# Source
#
#
# GCC core and G++
#
%source set gcc http://ftp.rtems.org/pub/rtems/people/chrisj/nios/nios2-gcc-4.1.tar.bz2
%hash   md5 nios2-gcc-4.1.tar.bz2 717e5a25fda68d96d09353bcfa149cff

#
# Newlib
#
%source set newlib https://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
%hash   md5 newlib-%{newlib_version}.tar.gz 0966e19f03217db9e9076894b47e6601

#
# The GCC library directory
#
%global _gcclibdir %{_prefix}/lib

#
# Prepare the source code.
#
%prep
  # save the build top directory and cd back to it rather than
  # using 'cd ..' because some shells change $PWD to a symlink's
  # target location and 'cd ..' fails.
  build_top=$(pwd)

  # gcc
  source_dir_gcc="gcc-%{gcc_version}"
  %source setup gcc -q -b -n gcc-%{gcc_version}
  %patch setup gcc -p1
  cd ${build_top}

  # newlib
  source_dir_newlib="newlib-%{newlib_version}"
  %source setup newlib -q -b -n newlib-%{newlib_version}
  %patch setup newlib -p1
  cd ${build_top}

  # Link newlib into the gcc source tree
  %{__rmfile} ${source_dir_gcc}/newlib
  %{__ln_s} $PWD/${source_dir_newlib}/newlib ${source_dir_gcc}/newlib

  echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE

  # Fix timestamps
  cd ${source_dir_gcc}
  contrib/gcc_update --touch
  cd ${build_top}

%build
  %{build_directory}

  mkdir -p ${build_dir}
  cd ${build_dir}

  languages="c"
%if %{enable_cxx}
  languages="$languages,c++"
%endif

  %{host_build_flags}

  ../${source_dir_gcc}/configure \
    --prefix=%{_prefix} \
    --bindir=%{_bindir} \
    --exec_prefix=%{_exec_prefix} \
    --includedir=%{_includedir} \
    --libdir=%{_gcclibdir} \
    --libexecdir=%{_libexecdir} \
    --mandir=%{_mandir} \
    --infodir=%{_infodir} \
    --datadir=%{_datadir} \
    --build=%_build --host=%_host \
    --target=%{_target} \
    --disable-libstdcxx-pch \
    --with-gnu-as --with-gnu-ld --verbose \
    --with-newlib \
    --with-system-zlib \
    --disable-nls --without-included-gettext \
    --disable-win32-registry \
    --enable-version-specific-runtime-libs \
    %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
    %{?enable_obsolete:--enable-obsolete} \
    --enable-languages="$languages"

  if test "%_host" != "%_build" ; then
    # Bug in gcc-3.2.1:
    # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
    mkdir -p gcc/include
    cp ../${source_dir_gcc}/gcc/gsyslimits.h gcc/include/syslimits.h
  fi

  # jobs > 1 is broken with this version of gcc
  %{__make} -w N2GNU_BUILD_NEWLIB="%{newlib_cfg}" all
  cd ..

%install
  %{__rmdir} $SB_BUILD_ROOT

  cd ${build_dir}

  #
  # Filter the doc stuff we do not want so it builds without error on
  # hosts that do not have tex to pdf converters installed.
  #
  for m in $(find . -name Makefile)
  do
    mv $m $m.orig
    echo "Doc filteirng $m.orig -> $m"
    cat $m.orig | sed -e 's/ pdf / /g' \
                      -e 's/ pdf$/ /g' \
                      -e 's/ install-pdf / /g' \
                      -e 's/ install-pdf$/ /g' \
                      -e 's/ install-html / /g' \
                      -e 's/ install-html$/ /g' \
                      -e 's/ html / /g' \
                      -e 's/ html$/ /g' > $m
  done

  %{__make} -w DESTDIR=$SB_BUILD_ROOT N2GNU_BUILD_NEWLIB="%{newlib_cfg}" install
  cd ..

  # libiberty doesn't honor --libdir, but always installs to a
  # magically guessed _libdir
  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a

  # We use the version from binutils
  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}

  # We don't ship info/dir
  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir

  # Don't want libffi's man-pages
  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*

  # Clean the symlinks away incase the source is a repo
  %{__rmfile} ${source_dir_gcc}/newlib