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

5
Last change on this file since 96c414c was 96c414c, checked in by Chris Johns <chrisj@…>, on 10/22/18 at 00:59:10

windows: Remove BuildRoot? from all configs, add a short tmp path.

Closes #3562.

  • Property mode set to 100644
File size: 5.5 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}-%{_host}-%{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/
22
23#
24# Supports Candian Cross (Cxc).
25#
26%define allow_cxc
27
28#
29# The GCC library directory
30#
31%global _gcclibdir %{_prefix}/lib
32
33#
34# Default LTO to off.
35#
36%ifn %{defined with_lto}
37 %define with_lto 0
38%endif
39
40#
41# The GCC version depends on the type of build we are doing.
42#
43%if %{rsb_released}
44 %define rtems_gcc_version %{rsb_version}
45%else
46 %define rtems_gcc_version %{rtems_version}
47%endif
48
49#
50# Prepare the source code.
51#
52%prep
53  # save the build top directory and cd back to it rather than
54  # using 'cd ..' because some shells change $PWD to a symlink's
55  # target location and 'cd ..' fails.
56  build_top=$(pwd)
57
58  gcc_source=%{?gcc_external:%{gcc_expand_name}}%{!?gcc_external:"gcc-%{gcc_version}"}
59
60  # gcc and optional the g++ core if separate packages
61  source_dir_gcc=${gcc_source}
62  %source setup gcc -q -n ${gcc_source}
63
64  %patch setup gcc -p1
65  cd ${build_top}
66
67  # newlib
68  source_dir_newlib=%{?newlib_external:%{newlib_expand_name}}%{!?newlib_external:"newlib-%{newlib_version}"}
69  %source setup newlib -q -D -n ${source_dir_newlib}
70  %patch setup newlib -p1
71  cd ${build_top}
72
73  # Link newlib into the gcc source tree
74  %{__rmfile} ${source_dir_gcc}/newlib
75  %{__ln_s} $PWD/${source_dir_newlib}/newlib ${source_dir_gcc}/newlib
76
77  # MPFR
78  source_dir_mpfr="mpfr-%{mpfr_version}"
79  %source setup mpfr -q -D -n mpfr-%{mpfr_version}
80  %patch setup mpfr -p1
81  cd ${build_top}
82  # Build MPFR one-tree style
83  %{__rmfile} ${source_dir_gcc}/mpfr
84  %{__ln_s} $PWD/${source_dir_mpfr} ${source_dir_gcc}/mpfr
85
86  # MPC
87  source_dir_mpc="mpc-%{mpc_version}"
88  %source setup mpc -q -D -n mpc-%{mpc_version}
89  %patch setup mpc -p1
90  cd ${build_top}
91  # Build MPC one-tree style
92  %{__rmfile} ${source_dir_gcc}/mpc
93  %{__ln_s} $PWD/${source_dir_mpc} ${source_dir_gcc}/mpc
94
95  # GMP
96  source_dir_gmp="gmp-%{gmp_version}"
97  %source setup gmp -q -D -n gmp-%{gmp_version}
98  %patch setup gmp -p1
99  cd ${build_top}
100  # Build GMP one-tree style
101  %{__rmfile} ${source_dir_gcc}/gmp
102  %{__ln_s} $PWD/${source_dir_gmp} ${source_dir_gcc}/gmp
103
104  echo "%{gcc_version_message}" > ${source_dir_gcc}/gcc/DEV-PHASE
105
106  # Fix timestamps
107  cd ${source_dir_gcc}
108  contrib/gcc_update --touch
109  cd ${build_top}
110
111%build
112  build_top=$(pwd)
113
114  %{build_directory}
115
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_build_flags}
141
142  ../${source_dir_gcc}/configure \
143    --prefix=%{_prefix} \
144    --bindir=%{_bindir} \
145    --exec_prefix=%{_exec_prefix} \
146    --includedir=%{_includedir} \
147    --libdir=%{_gcclibdir} \
148    --libexecdir=%{_libexecdir} \
149    --mandir=%{_mandir} \
150    --infodir=%{_infodir} \
151    --datadir=%{_datadir} \
152    --build=%{_build} --host=%{_host} \
153    --target=%{_target} \
154    --disable-libstdcxx-pch \
155    --with-gnu-as --with-gnu-ld --verbose \
156    --with-newlib \
157    --disable-nls --without-included-gettext \
158    --disable-win32-registry \
159    --enable-version-specific-runtime-libs \
160    %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
161    --enable-newlib-io-c99-formats \
162    %{?disable_MAKEINFO:MAKEINFO=missing} \
163    %{?with_iconv:--enable-newlib-iconv} \
164    %{?with_iconv:--enable-newlib-iconv-encodings=%{_newlib_iconv_encodings}} \
165    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
166    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
167    %{?enable_obsolete:--enable-obsolete} \
168    %{?with_libgomp:--enable-libgomp} \
169    %{?gcc_configure_extra_options:%{gcc_configure_extra_options}} \
170    --enable-languages="$languages"
171
172  if test "%_host" != "%_build" ; then
173    # Bug in gcc-3.2.1:
174    # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
175    mkdir -p gcc/include
176    cp ../${source_dir_gcc}/gcc/gsyslimits.h gcc/include/syslimits.h
177  fi
178
179  %{__make} %{?_smp_mflags} all
180
181  cd ${build_top}
182
183%install
184  build_top=$(pwd)
185
186  %{__rmdir} $SB_BUILD_ROOT
187
188  cd ${build_dir}
189  %{__make} DESTDIR=$SB_BUILD_ROOT install
190  cd ${build_top}
191
192  # libiberty doesn't honor --libdir, but always installs to a
193  # magically guessed _libdir
194  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
195
196  # We use the version from binutils
197  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
198
199  # We don't ship info/dir
200  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
201
202  # Don't want libffi's man-pages
203  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
204
205  # Clean the symlinks away incase the source is a repo
206  # Note, delete as a directory because of MSYS2 support on Windows.
207  %{__rmdir} ${source_dir_gcc}/newlib
208  %{__rmdir} ${source_dir_gcc}/mpfr
209  %{__rmdir} ${source_dir_gcc}/mpc
210  %{__rmdir} ${source_dir_gcc}/gmp
211
212%testing
213  # Add testing here.
214  export RUNTESTFLAGS=--target_board=%{_target}-run
Note: See TracBrowser for help on using the repository browser.