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