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

4.104.114.95
Last change on this file since 649a64c was 649a64c, checked in by Chris Johns <chrisj@…>, on 04/16/13 at 04:25:34

Add download git support.

Add support to use a git cloned repo as the source. Move the download
code out of the build module and into a separate module. Add to this
module support for git.

Update the GCC common configuration to support using a symlinked
git repo.

Add checks for all languages.

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