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

4.104.114.95
Last change on this file since 4ce931b was 4ce931b, checked in by Chris Johns <chrisj@…>, on 04/20/13 at 11:47:28

Add CVS download support.

These changes complete the CVS download support.

  • Property mode set to 100644
File size: 6.6 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 support.
114  if test "%{_build}" != "%{_host}" ; then
115    build_dir="build-cxc"
116  else
117    build_dir="build"
118  fi
119  mkdir -p ${build_dir}
120  cd ${build_dir}
121
122  # Languages.
123  languages="c"
124%if %{enable_cxx}
125  languages="$languages,c++"
126%endif
127%if %{enable_ada}
128  languages="$languages,ada"
129%endif
130%if %{enable_go}
131  languages="$languages,go"
132%endif
133%if %{enable_fortran}
134  languages="$languages,fortran"
135%endif
136%if %{enable_java}
137  languages="$languages,java"
138%endif
139%if %{enable_objc}
140  languages="$languages,objc"
141%endif
142
143  # Host flags
144  if test "%{_build}" != "%{_host}" ; then
145    CFLAGS_FOR_BUILD="-g -O2 -Wall"
146    CC="%{_host}-gcc ${SB_OPT_FLAGS}"
147    CXXFLAGS_FOR_BUILD="-g -O2 -Wall"
148    CXX="%{_host}-g++ ${SB_OPT_FLAGS}"
149  else
150    # gcc is not ready to be compiled with -std=gnu99
151    CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,')
152    CXX=$(echo "%{__cxx} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,')
153  fi
154  export CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
155
156  ../${source_dir_0}/configure \
157    --prefix=%{_prefix} \
158    --bindir=%{_bindir} \
159    --exec_prefix=%{_exec_prefix} \
160    --includedir=%{_includedir} \
161    --libdir=%{_gcclibdir} \
162    --libexecdir=%{_libexecdir} \
163    --mandir=%{_mandir} \
164    --infodir=%{_infodir} \
165    --datadir=%{_datadir} \
166    --build=%{_build} --host=%{_host} \
167    --target=%{_target} \
168    --disable-libstdcxx-pch \
169    --with-gnu-as --with-gnu-ld --verbose \
170    --with-newlib \
171    --with-system-zlib \
172    --disable-nls --without-included-gettext \
173    --disable-win32-registry \
174    --enable-version-specific-runtime-libs \
175    --disable-lto \
176    --enable-newlib-io-c99-formats \
177    %{?with_iconv:--enable-newlib-iconv} \
178    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
179    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
180    %{?enable_obsolete:--enable-obsolete} \
181    --enable-languages="$languages"
182
183  if test "%_host" != "%_build" ; then
184    # Bug in gcc-3.2.1:
185    # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
186    mkdir -p gcc/include
187    cp ../${source_dir_0}/gcc/gsyslimits.h gcc/include/syslimits.h
188  fi
189
190  %{__make} %{?_smp_mflags} all
191  cd ..
192
193  unset CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
194
195%install
196  %{__rmdir} $SB_BUILD_ROOT
197
198  cd ${build_dir}
199  %{__make} DESTDIR=$SB_BUILD_ROOT install
200  cd ..
201
202  # libiberty doesn't honor --libdir, but always installs to a
203  # magically guessed _libdir
204  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
205
206  # We use the version from binutils
207  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
208
209  # We don't ship info/dir
210  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
211
212  # Don't want libffi's man-pages
213  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
214
215  # Clean the symlinks away incase the source is a repo
216  %{__rmfile} ${source_dir_0}/newlib
217  %{__rmfile} ${source_dir_0}/mpfr
218  %{__rmfile} ${source_dir_0}/mpc
219  %{__rmfile} ${source_dir_0}/gmp
220
221%testing
222  # Add testing here.
223  export RUNTESTFLAGS=--target_board=%{_target}-run
Note: See TracBrowser for help on using the repository browser.