mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00

Remove the numbered source and patches and automatically manage sources and patches. This removes the overhead in maintaining large collections of patches.
195 lines
5.0 KiB
INI
195 lines
5.0 KiB
INI
#
|
|
# GCC Common Support.
|
|
#
|
|
# This configuration file configure's, make's and install's gcc. It uses
|
|
# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
|
|
#
|
|
|
|
%include %{_configdir}/checks.cfg
|
|
|
|
%ifn %{defined gcc_version_message}
|
|
%error No GCC Version message defined.
|
|
%endif
|
|
|
|
#
|
|
# The package description.
|
|
#
|
|
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/
|
|
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
|
|
|
|
#
|
|
# Supports Candian Cross (Cxc).
|
|
#
|
|
%define allow_cxc
|
|
|
|
#
|
|
# 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 and optional the g++ core if separate packages
|
|
source_dir_gcc="gcc-%{gcc_version}"
|
|
%source setup gcc -q -n gcc-%{gcc_version}
|
|
%patch setup gcc -p1
|
|
cd ${build_top}
|
|
|
|
# newlib
|
|
source_dir_newlib="newlib-%{newlib_version}"
|
|
%source setup newlib -q -D -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
|
|
|
|
# MPFR
|
|
source_dir_mpfr="mpfr-%{mpfr_version}"
|
|
%source setup mpfr -q -D -n mpfr-%{mpfr_version}
|
|
%patch setup mpfr -p1
|
|
cd ${build_top}
|
|
# Build MPFR one-tree style
|
|
%{__rmfile} ${source_dir_gcc}/mpfr
|
|
%{__ln_s} $PWD/${source_dir_mpfr} ${source_dir_gcc}/mpfr
|
|
|
|
# MPC
|
|
source_dir_mpc="mpc-%{mpc_version}"
|
|
%source setup mpc -q -D -n mpc-%{mpc_version}
|
|
%patch setup mpc -p1
|
|
cd ${build_top}
|
|
# Build MPC one-tree style
|
|
%{__rmfile} ${source_dir_gcc}/mpc
|
|
%{__ln_s} $PWD/${source_dir_mpc} ${source_dir_gcc}/mpc
|
|
|
|
# GMP
|
|
source_dir_gmp="gmp-%{gmp_version}"
|
|
%source setup gmp -q -D -n gmp-%{gmp_version}
|
|
%patch setup gmp -p1
|
|
cd ${build_top}
|
|
# Build GMP one-tree style
|
|
%{__rmfile} ${source_dir_gcc}/gmp
|
|
%{__ln_s} $PWD/${source_dir_gmp} ${source_dir_gcc}/gmp
|
|
|
|
echo "%{gcc_version_message}" > ${source_dir_gcc}/gcc/DEV-PHASE
|
|
|
|
# Fix timestamps
|
|
cd ${source_dir_gcc}
|
|
contrib/gcc_update --touch
|
|
cd ${build_top}
|
|
|
|
%build
|
|
build_top=$(pwd)
|
|
|
|
%{build_directory}
|
|
|
|
mkdir -p ${build_dir}
|
|
cd ${build_dir}
|
|
|
|
# Languages.
|
|
languages="c"
|
|
%if %{enable_cxx}
|
|
languages="$languages,c++"
|
|
%endif
|
|
%if %{enable_ada}
|
|
languages="$languages,ada"
|
|
%endif
|
|
%if %{enable_go}
|
|
languages="$languages,go"
|
|
%endif
|
|
%if %{enable_fortran}
|
|
languages="$languages,fortran"
|
|
%endif
|
|
%if %{enable_java}
|
|
languages="$languages,java"
|
|
%endif
|
|
%if %{enable_objc}
|
|
languages="$languages,objc"
|
|
%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 \
|
|
--disable-lto \
|
|
--enable-newlib-io-c99-formats \
|
|
%{?with_iconv:--enable-newlib-iconv} \
|
|
%{?with_iconv:--enable-newlib-iconv-encodings=%{_newlib_iconv_encodings}} \
|
|
%{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
|
|
%{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
|
|
%{?enable_obsolete:--enable-obsolete} \
|
|
%{?gcc_configure_extra_options:%{gcc_configure_extra_options}} \
|
|
--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
|
|
|
|
%{__make} %{?_smp_mflags} all
|
|
|
|
cd ${build_top}
|
|
|
|
%install
|
|
build_top=$(pwd)
|
|
|
|
%{__rmdir} $SB_BUILD_ROOT
|
|
|
|
cd ${build_dir}
|
|
%{__make} DESTDIR=$SB_BUILD_ROOT install
|
|
cd ${build_top}
|
|
|
|
# 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
|
|
%{__rmfile} ${source_dir_gcc}/mpfr
|
|
%{__rmfile} ${source_dir_gcc}/mpc
|
|
%{__rmfile} ${source_dir_gcc}/gmp
|
|
|
|
%testing
|
|
# Add testing here.
|
|
export RUNTESTFLAGS=--target_board=%{_target}-run
|