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