source: rtems-source-builder/source-builder/config/gcc-common-1.cfg @ db65c6a

4.104.114.9
Last change on this file since db65c6a was db65c6a, checked in by Chris Johns <chrisj@…>, on May 15, 2013 at 2:15:14 AM

Support Canadian cross builds on FreeBSD (and other hosts).

Set up the rules to manage the separate host and build setting to
allow a Canadian cross to complete.

Update the scripts to move the build directory and host/build
flags into the defaults so they are common for all build
configurations.

  • Property mode set to 100644
File size: 6.0 KB
Line 
1#
2# GCC Common Support.
3#
4# This configuration file configure's, make's and install's gcc. It uses
5# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
6#
7
8%include %{_configdir}/checks.cfg
9
10%ifn %{defined gcc_version_message}
11%error No GCC Version message defined.
12%endif
13
14#
15# The package description.
16#
17Name:      %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
18Summary:   GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
19Version:   %{gcc_version}
20Release:   %{release}
21URL:       http://gcc.gnu.org/
22BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
23
24#
25# Supports Candian Cross (Cxc).
26#
27%define allow_cxc
28
29#
30# The GCC library directory
31#
32%global _gcclibdir %{_prefix}/lib
33
34#
35# Prepare the source code.
36#
37%prep
38  # gcc and optional the g++ core if separate packages
39  source_dir_0="gcc-%{gcc_version}"
40  %setup -q -c -n %{name}-%{version}
41  %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
42  cd ${source_dir_0}
43  %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
44  %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
45  %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
46  %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
47  %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
48  %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
49  %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
50  %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
51  %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
52  %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
53  cd ..
54
55  # newlib
56  source_dir_10="newlib-%{newlib_version}"
57  %setup -q -D -T -n %{name}-%{version} -a10
58  cd ${source_dir_10}
59  %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
60  %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
61  %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
62  %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
63  %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
64  %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
65  %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
66  %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
67  %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
68  %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
69  cd ..
70
71  # Link newlib into the gcc source tree
72  %{__rmfile} ${source_dir_0}/newlib
73  %{__ln_s} $PWD/${source_dir_10}/newlib ${source_dir_0}/newlib
74
75  # MPFR
76  source_dir_20="mpfr-%{mpfr_version}"
77  %setup -q -D -T -n %{name}-%{version} -a20
78  cd ${source_dir_20}
79  %{?patch20:%patch20 -p1}
80  cd ..
81  # Build MPFR one-tree style
82  %{__rmfile} ${source_dir_0}/mpfr
83  %{__ln_s} $PWD/${source_dir_20} ${source_dir_0}/mpfr
84
85  # MPC
86  source_dir_21="mpc-%{mpc_version}"
87  %setup -q -D -T -n %{name}-%{version} -a21
88  cd ${source_dir_21}
89  %{?patch21:%patch21 -p1}
90  cd ..
91  # Build MPC one-tree style
92  %{__rmfile} ${source_dir_0}/mpc
93  %{__ln_s} $PWD/${source_dir_21} ${source_dir_0}/mpc
94
95  # GMP
96  source_dir_22="gmp-%{gmp_version}"
97  %setup -q -D -T -n %{name}-%{version} -a22
98  cd ${source_dir_22}
99  %{?patch22:%patch22 -p1}
100  cd ..
101  # Build GMP one-tree style
102  %{__rmfile} ${source_dir_0}/gmp
103  %{__ln_s} $PWD/${source_dir_22} ${source_dir_0}/gmp
104
105  echo "%{gcc_version_message}" > ${source_dir_0}/gcc/DEV-PHASE
106
107  # Fix timestamps
108  cd ${source_dir_0}
109  contrib/gcc_update --touch
110  cd ..
111
112%build
113  %{build_directory}
114
115  mkdir -p ${build_dir}
116  cd ${build_dir}
117
118  # Languages.
119  languages="c"
120%if %{enable_cxx}
121  languages="$languages,c++"
122%endif
123%if %{enable_ada}
124  languages="$languages,ada"
125%endif
126%if %{enable_go}
127  languages="$languages,go"
128%endif
129%if %{enable_fortran}
130  languages="$languages,fortran"
131%endif
132%if %{enable_java}
133  languages="$languages,java"
134%endif
135%if %{enable_objc}
136  languages="$languages,objc"
137%endif
138
139  %{host_build_flags}
140
141  ../${source_dir_0}/configure \
142    --prefix=%{_prefix} \
143    --bindir=%{_bindir} \
144    --exec_prefix=%{_exec_prefix} \
145    --includedir=%{_includedir} \
146    --libdir=%{_gcclibdir} \
147    --libexecdir=%{_libexecdir} \
148    --mandir=%{_mandir} \
149    --infodir=%{_infodir} \
150    --datadir=%{_datadir} \
151    --build=%{_build} --host=%{_host} \
152    --target=%{_target} \
153    --disable-libstdcxx-pch \
154    --with-gnu-as --with-gnu-ld --verbose \
155    --with-newlib \
156    --with-system-zlib \
157    --disable-nls --without-included-gettext \
158    --disable-win32-registry \
159    --enable-version-specific-runtime-libs \
160    --disable-lto \
161    --enable-newlib-io-c99-formats \
162    %{?with_iconv:--enable-newlib-iconv} \
163    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
164    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
165    %{?enable_obsolete:--enable-obsolete} \
166    --enable-languages="$languages"
167
168  if test "%_host" != "%_build" ; then
169    # Bug in gcc-3.2.1:
170    # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
171    mkdir -p gcc/include
172    cp ../${source_dir_0}/gcc/gsyslimits.h gcc/include/syslimits.h
173  fi
174
175  %{__make} %{?_smp_mflags} all
176  cd ..
177
178%install
179  %{__rmdir} $SB_BUILD_ROOT
180
181  cd ${build_dir}
182  %{__make} DESTDIR=$SB_BUILD_ROOT install
183  cd ..
184
185  # libiberty doesn't honor --libdir, but always installs to a
186  # magically guessed _libdir
187  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
188
189  # We use the version from binutils
190  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
191
192  # We don't ship info/dir
193  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
194
195  # Don't want libffi's man-pages
196  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
197
198  # Clean the symlinks away incase the source is a repo
199  %{__rmfile} ${source_dir_0}/newlib
200  %{__rmfile} ${source_dir_0}/mpfr
201  %{__rmfile} ${source_dir_0}/mpc
202  %{__rmfile} ${source_dir_0}/gmp
203
204%testing
205  # Add testing here.
206  export RUNTESTFLAGS=--target_board=%{_target}-run
Note: See TracBrowser for help on using the repository browser.