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