1 | # |
---|
2 | # GCC 4.6 Version 1. |
---|
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 | Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host} |
---|
15 | Version: %{gcc_version} |
---|
16 | Release: %{release} |
---|
17 | URL: http://gcc.gnu.org/ |
---|
18 | BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) |
---|
19 | |
---|
20 | # |
---|
21 | # Source |
---|
22 | # |
---|
23 | # |
---|
24 | # GCC core and G++ |
---|
25 | # |
---|
26 | Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_version}.tar.bz2 |
---|
27 | %if %{enable_cxx} |
---|
28 | Source1: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_pkgvers}/%{gcc_version}/gcc-g++-%{gcc_version}.tar.bz2 |
---|
29 | %endif |
---|
30 | |
---|
31 | # |
---|
32 | # Newlib |
---|
33 | # |
---|
34 | Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz |
---|
35 | |
---|
36 | # |
---|
37 | # Packages GCC requires |
---|
38 | # |
---|
39 | Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2 |
---|
40 | Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz |
---|
41 | Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2 |
---|
42 | |
---|
43 | # |
---|
44 | # The GCC library directory |
---|
45 | # |
---|
46 | %global _gcclibdir %{_prefix}/lib |
---|
47 | |
---|
48 | # |
---|
49 | # Prepare the source code. |
---|
50 | # |
---|
51 | %prep |
---|
52 | %setup -q -c -T -n %{name}-%{version} |
---|
53 | |
---|
54 | # gcc core |
---|
55 | %setup -q -T -D -n %{name}-%{version} -a0 |
---|
56 | cd gcc-%{gcc_version} |
---|
57 | %{?patch0:%patch0 -p1} |
---|
58 | cd .. |
---|
59 | |
---|
60 | # g++ |
---|
61 | %{?source1:%setup -q -T -D -n %{name}-%{version} -a1} |
---|
62 | cd gcc-%{gcc_version} |
---|
63 | %{?patch1:%patch1 -p1} |
---|
64 | cd .. |
---|
65 | |
---|
66 | # newlib |
---|
67 | %setup -q -T -D -n %{name}-%{version} -a10 |
---|
68 | cd newlib-%{newlib_version} |
---|
69 | %{?patch10:%patch10 -p1} |
---|
70 | cd .. |
---|
71 | # Link newlib into the gcc source tree |
---|
72 | ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version} |
---|
73 | |
---|
74 | # MPFR |
---|
75 | %setup -q -T -D -n %{name}-%{version} -a20 |
---|
76 | cd mpfr-%{mpfr_version} |
---|
77 | %{?patch20:%patch20 -p1} |
---|
78 | cd .. |
---|
79 | # Build MPFR one-tree style |
---|
80 | ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr |
---|
81 | |
---|
82 | # MPC |
---|
83 | %setup -q -T -D -n %{name}-%{version} -a21 |
---|
84 | cd mpc-%{mpc_version} |
---|
85 | %{?patch21:%patch21 -p1} |
---|
86 | cd .. |
---|
87 | # Build MPC one-tree style |
---|
88 | ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc |
---|
89 | |
---|
90 | # GMP |
---|
91 | %setup -q -T -D -n %{name}-%{version} -a22 |
---|
92 | cd gmp-%{gmp_version} |
---|
93 | %{?patch22:%patch22 -p1} |
---|
94 | cd .. |
---|
95 | # Build GMP one-tree style |
---|
96 | ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp |
---|
97 | |
---|
98 | echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE |
---|
99 | |
---|
100 | # Fix timestamps |
---|
101 | cd gcc-%{gcc_version} |
---|
102 | contrib/gcc_update --touch |
---|
103 | cd .. |
---|
104 | |
---|
105 | %build |
---|
106 | export PATH="%{_bindir}:${PATH}" |
---|
107 | mkdir -p build |
---|
108 | cd build |
---|
109 | languages="c" |
---|
110 | %if %{enable_cxx} |
---|
111 | languages="$languages,c++" |
---|
112 | %endif |
---|
113 | %if "%{_build}" != "%{_host}" |
---|
114 | CFLAGS_FOR_BUILD="-g -O2 -Wall" \ |
---|
115 | CC="%{_host}-gcc ${TB_OPT_FLAGS}" \ |
---|
116 | %else |
---|
117 | # gcc is not ready to be compiled with -std=gnu99 |
---|
118 | CC=$(echo "%{__cc} ${TB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \ |
---|
119 | %endif |
---|
120 | ../gcc-%{gcc_version}/configure \ |
---|
121 | --prefix=%{_prefix} \ |
---|
122 | --bindir=%{_bindir} \ |
---|
123 | --exec_prefix=%{_exec_prefix} \ |
---|
124 | --includedir=%{_includedir} \ |
---|
125 | --libdir=%{_gcclibdir} \ |
---|
126 | --libexecdir=%{_libexecdir} \ |
---|
127 | --mandir=%{_mandir} \ |
---|
128 | --infodir=%{_infodir} \ |
---|
129 | --datadir=%{_datadir} \ |
---|
130 | --build=%_build --host=%_host \ |
---|
131 | --target=%{_target} \ |
---|
132 | --disable-libstdcxx-pch \ |
---|
133 | --with-gnu-as --with-gnu-ld --verbose \ |
---|
134 | --with-newlib \ |
---|
135 | --with-system-zlib \ |
---|
136 | --disable-nls --without-included-gettext \ |
---|
137 | --disable-win32-registry \ |
---|
138 | --enable-version-specific-runtime-libs \ |
---|
139 | --disable-lto \ |
---|
140 | %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \ |
---|
141 | %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \ |
---|
142 | --enable-newlib-io-c99-formats \ |
---|
143 | %{?with_iconv:--enable-newlib-iconv} \ |
---|
144 | --enable-languages="$languages" |
---|
145 | |
---|
146 | %if "%_host" != "%_build" |
---|
147 | # Bug in gcc-3.2.1: |
---|
148 | # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs |
---|
149 | mkdir -p gcc/include |
---|
150 | cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h |
---|
151 | %endif |
---|
152 | |
---|
153 | %{__make} %{?_smp_mflags} all |
---|
154 | cd .. |
---|
155 | |
---|
156 | %install |
---|
157 | export PATH="%{_bindir}:${PATH}" |
---|
158 | rm -rf $TB_BUILD_ROOT |
---|
159 | |
---|
160 | cd build |
---|
161 | %{__make} DESTDIR=$TB_BUILD_ROOT install |
---|
162 | cd .. |
---|
163 | |
---|
164 | # libiberty doesn't honor --libdir, but always installs to a |
---|
165 | # magically guessed _libdir |
---|
166 | rm -f ${TB_BUILD_ROOT}%{_libdir}/libiberty.a |
---|
167 | |
---|
168 | # We use the version from binutils |
---|
169 | rm -f $TB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext} |
---|
170 | |
---|
171 | # We don't ship info/dir |
---|
172 | rm -f $TB_BUILD_ROOT%{_infodir}/dir |
---|
173 | |
---|
174 | # Don't want libffi's man-pages |
---|
175 | rm -f $TB_BUILD_ROOT%{_mandir}/man3/*ffi* |
---|