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

5
Last change on this file since 1ad33b0 was 1ad33b0, checked in by Sebastian Huber <sebastian.huber@…>, on 03/31/17 at 07:55:08

Always use GCC provided zlib

Always use the GCC provided zlib to make the compiler as independent of
the host system as possible.

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