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 | Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release} |
---|
15 | Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host} |
---|
16 | Version: %{gcc_version} |
---|
17 | Release: %{release} |
---|
18 | URL: http://gcc.gnu.org/ |
---|
19 | BuildRoot: %{_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 | %setup -q -c -n %{name}-%{version} |
---|
37 | %{?source1:%setup -q -D -T -n %{name}-%{version} -a1} |
---|
38 | cd gcc-%{gcc_version} |
---|
39 | %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}} |
---|
40 | %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}} |
---|
41 | %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}} |
---|
42 | %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}} |
---|
43 | %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}} |
---|
44 | %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}} |
---|
45 | %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}} |
---|
46 | %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}} |
---|
47 | %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}} |
---|
48 | %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}} |
---|
49 | cd .. |
---|
50 | |
---|
51 | # newlib |
---|
52 | %setup -q -D -T -n %{name}-%{version} -a10 |
---|
53 | cd newlib-%{newlib_version} |
---|
54 | %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}} |
---|
55 | %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}} |
---|
56 | %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}} |
---|
57 | %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}} |
---|
58 | %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}} |
---|
59 | %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}} |
---|
60 | %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}} |
---|
61 | %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}} |
---|
62 | %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}} |
---|
63 | %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}} |
---|
64 | cd .. |
---|
65 | |
---|
66 | # Link newlib into the gcc source tree |
---|
67 | ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version} |
---|
68 | |
---|
69 | # MPFR |
---|
70 | %setup -q -D -T -n %{name}-%{version} -a20 |
---|
71 | cd mpfr-%{mpfr_version} |
---|
72 | %{?patch20:%patch20 -p1} |
---|
73 | cd .. |
---|
74 | # Build MPFR one-tree style |
---|
75 | ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr |
---|
76 | |
---|
77 | # MPC |
---|
78 | %setup -q -D -T -n %{name}-%{version} -a21 |
---|
79 | cd mpc-%{mpc_version} |
---|
80 | %{?patch21:%patch21 -p1} |
---|
81 | cd .. |
---|
82 | # Build MPC one-tree style |
---|
83 | ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc |
---|
84 | |
---|
85 | # GMP |
---|
86 | %setup -q -D -T -n %{name}-%{version} -a22 |
---|
87 | cd gmp-%{gmp_version} |
---|
88 | %{?patch22:%patch22 -p1} |
---|
89 | cd .. |
---|
90 | # Build GMP one-tree style |
---|
91 | ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp |
---|
92 | |
---|
93 | echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE |
---|
94 | |
---|
95 | # Fix timestamps |
---|
96 | cd gcc-%{gcc_version} |
---|
97 | contrib/gcc_update --touch |
---|
98 | cd .. |
---|
99 | |
---|
100 | %build |
---|
101 | if test "%{_build}" != "%{_host}" ; then |
---|
102 | build_dir="build-cxc" |
---|
103 | else |
---|
104 | build_dir="build" |
---|
105 | fi |
---|
106 | mkdir -p ${build_dir} |
---|
107 | cd ${build_dir} |
---|
108 | languages="c" |
---|
109 | %if %{enable_cxx} |
---|
110 | languages="$languages,c++" |
---|
111 | %endif |
---|
112 | if test "%{_build}" != "%{_host}" ; then |
---|
113 | CFLAGS_FOR_BUILD="-g -O2 -Wall" |
---|
114 | CC="%{_host}-gcc ${SB_OPT_FLAGS}" |
---|
115 | CXXFLAGS_FOR_BUILD="-g -O2 -Wall" |
---|
116 | CXX="%{_host}-g++ ${SB_OPT_FLAGS}" |
---|
117 | else |
---|
118 | # gcc is not ready to be compiled with -std=gnu99 |
---|
119 | CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') |
---|
120 | CXX=$(echo "%{__cxx} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') |
---|
121 | fi |
---|
122 | export CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX |
---|
123 | ../gcc-%{gcc_version}/configure \ |
---|
124 | --prefix=%{_prefix} \ |
---|
125 | --bindir=%{_bindir} \ |
---|
126 | --exec_prefix=%{_exec_prefix} \ |
---|
127 | --includedir=%{_includedir} \ |
---|
128 | --libdir=%{_gcclibdir} \ |
---|
129 | --libexecdir=%{_libexecdir} \ |
---|
130 | --mandir=%{_mandir} \ |
---|
131 | --infodir=%{_infodir} \ |
---|
132 | --datadir=%{_datadir} \ |
---|
133 | --build=%{_build} --host=%{_host} \ |
---|
134 | --target=%{_target} \ |
---|
135 | --disable-libstdcxx-pch \ |
---|
136 | --with-gnu-as --with-gnu-ld --verbose \ |
---|
137 | --with-newlib \ |
---|
138 | --with-system-zlib \ |
---|
139 | --disable-nls --without-included-gettext \ |
---|
140 | --disable-win32-registry \ |
---|
141 | --enable-version-specific-runtime-libs \ |
---|
142 | --disable-lto \ |
---|
143 | --enable-newlib-io-c99-formats \ |
---|
144 | %{?with_iconv:--enable-newlib-iconv} \ |
---|
145 | %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \ |
---|
146 | %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \ |
---|
147 | %{?enable_obsolete:--enable-obsolete} \ |
---|
148 | --enable-languages="$languages" |
---|
149 | |
---|
150 | unset CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX |
---|
151 | |
---|
152 | if test "%_host" != "%_build" ; then |
---|
153 | # Bug in gcc-3.2.1: |
---|
154 | # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs |
---|
155 | mkdir -p gcc/include |
---|
156 | cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h |
---|
157 | fi |
---|
158 | |
---|
159 | %{__make} %{?_smp_mflags} all |
---|
160 | cd .. |
---|
161 | |
---|
162 | %install |
---|
163 | %{__rmdir} $SB_BUILD_ROOT |
---|
164 | |
---|
165 | cd ${build_dir} |
---|
166 | %{__make} DESTDIR=$SB_BUILD_ROOT install |
---|
167 | cd .. |
---|
168 | |
---|
169 | # libiberty doesn't honor --libdir, but always installs to a |
---|
170 | # magically guessed _libdir |
---|
171 | %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a |
---|
172 | |
---|
173 | # We use the version from binutils |
---|
174 | %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext} |
---|
175 | |
---|
176 | # We don't ship info/dir |
---|
177 | %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir |
---|
178 | |
---|
179 | # Don't want libffi's man-pages |
---|
180 | %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi* |
---|
181 | |
---|
182 | %testing |
---|
183 | # Add testing here. |
---|
184 | export RUNTESTFLAGS=--target_board=%{_target}-run |
---|