]>
Commit | Line | Data |
---|---|---|
166a6c21 | 1 | ############################################################################### |
802ea3af MT |
2 | # IPFire.org - An Open Source Firewall Solution # |
3 | # Copyright (C) - IPFire Development Team <info@ipfire.org> # | |
166a6c21 MT |
4 | ############################################################################### |
5 | ||
802ea3af | 6 | # Configure build to compile with cloog and ppl. |
1f543606 | 7 | build_cloog_ppl = 1 |
166a6c21 | 8 | |
802ea3af | 9 | name = gcc |
de58ea22 | 10 | version = 4.6.2 |
1f543606 | 11 | release = 3 |
f0d77f5d | 12 | |
802ea3af MT |
13 | maintainer = Michael Tremer <michael.tremer@ipfire.org> |
14 | groups = Development/Compilers | |
15 | url = http://gcc.gnu.org/ | |
16 | license = GPLv3+ and GPLv2+ with exceptions | |
17 | summary = Various compilers (C, C++, Objective-C, Java, ...). | |
166a6c21 | 18 | |
802ea3af | 19 | description |
166a6c21 MT |
20 | The gcc package contains the GNU Compiler Collection. \ |
21 | You'll need this package in order to compile C code. | |
802ea3af MT |
22 | end |
23 | ||
24 | # This is the at least required version of binutils. | |
25 | required_binutils_version = 2.21.51.0.8-1 | |
26 | ||
de58ea22 | 27 | source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/ |
802ea3af MT |
28 | sources = %{thisapp}.tar.gz |
29 | ||
30 | patches | |
31 | gcc46-hack.patch0 | |
32 | gcc46-c++-builtin-redecl.patch0 | |
33 | gcc46-pr33763.patch0 | |
34 | gcc46-libgomp-omp_h-multilib.patch0 | |
35 | gcc46-libtool-no-rpath.patch0 | |
36 | gcc46-cloog-dl.patch0 | |
37 | gcc46-pr38757.patch0 | |
38 | gcc46-no-add-needed.patch0 | |
39 | gcc46-unwind-debughook-sdt.patch0 | |
40 | gcc46-ppl-0.10.patch | |
41 | gcc46-Woverlength-string.patch0 | |
42 | gcc46-Woverlength-string-asm.patch0 | |
3c926509 | 43 | gcc-4.6.0-piepatches-20110407.patch |
802ea3af MT |
44 | end |
45 | ||
46 | build | |
47 | requires | |
48 | autogen | |
49 | binutils>=%{required_binutils_version} | |
50 | dejagnu | |
51 | elfutils-devel | |
52 | expect | |
53 | flex | |
54 | glibc-devel | |
55 | gmp-devel | |
56 | libffi-devel | |
57 | mpc-devel | |
58 | mpfr-devel | |
59 | texinfo | |
60 | zlib-devel | |
61 | end | |
62 | ||
63 | # If cloog support is enabled, we require the devel packages for build. | |
64 | if "%{build_cloog_ppl}" == "1" | |
65 | requires += cloog-ppl-devel ppl-devel | |
66 | end | |
67 | ||
68 | # A couple of configure arguments depending on the architecture and | |
69 | # configuration. | |
70 | configure_options = | |
71 | ||
72 | if "%{DISTRO_ARCH}" == "x86_64" | |
73 | configure_options = --disable-multilib | |
74 | end | |
75 | ||
76 | if "%{DISTRO_ARCH}" == "i686" | |
77 | configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic | |
78 | end | |
79 | ||
66e276de MT |
80 | if "%{DISTRO_ARCH}" == "armv5tel" |
81 | configure_options += --with-float=soft | |
82 | end | |
83 | ||
802ea3af MT |
84 | if "%{build_cloog_ppl}" == "1" |
85 | configure_options += --with-cloog --with-ppl | |
86 | end | |
87 | ||
88 | # CFLAGS for hardening. | |
89 | HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW | |
90 | ||
91 | prepare_cmds | |
92 | mkdir -v %{DIR_SRC}/gcc-build | |
93 | ||
94 | # Remove unneeded features that will save some compile time | |
95 | rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp} | |
96 | ||
97 | # Apply a sed substitution that will suppress the installation of | |
98 | # libiberty.a. The version of libiberty.a provided by Binutils will be used | |
99 | # instead: | |
100 | sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in | |
101 | ||
102 | # Branding gcc | |
103 | echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE | |
104 | ||
105 | # Libgomp uses -Werror regardless of --disable-werror, and this will cause a | |
106 | # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings: | |
107 | sed -e "s/-Werror//" -i libgomp/configure | |
108 | ||
109 | # The fixincludes script is known to occasionally erroneously attempt to | |
110 | # "fix" the system headers installed so far. As the headers up to this point | |
111 | # are known to not require fixing, issue the following command to prevent | |
112 | # the fixincludes script from running: | |
113 | sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in | |
114 | ||
115 | sed -i gcc/Makefile.in \ | |
116 | -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/" | |
117 | ||
118 | # we want to be able to control the pie patch logic via something other | |
119 | # than ALL_CFLAGS... | |
120 | sed -i gcc/Makefile.in \ | |
121 | -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ | |
122 | -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' | |
123 | ||
124 | # Enable the GCC hardening by default. | |
125 | sed -i gcc/Makefile.in \ | |
126 | -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |" | |
127 | ||
128 | # Compile the compiler with -fPIC as well. | |
129 | sed -i gcc/Makefile.in \ | |
130 | -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" | |
131 | ||
132 | ./contrib/gcc_update --touch | |
133 | end | |
134 | ||
135 | build | |
136 | cd %{DIR_SRC}/gcc-build | |
137 | ||
138 | # Modify CFLAGS | |
139 | OPT_FLAGS="%{CFLAGS}" | |
140 | CFLAGS="%{CFLAGS}" | |
141 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g') | |
142 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g') | |
143 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g') | |
144 | #CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g') | |
145 | CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g') | |
146 | CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g') | |
147 | ||
148 | CFLAGS="${CFLAGS}" \ | |
149 | CXXFLAGS="${CXXFLAGS}" \ | |
150 | XCFLAGS="${CFLAGS}" \ | |
151 | TCFLAGS="${CFLAGS}" \ | |
152 | ../%{thisapp}/configure \ | |
153 | --build=%{DISTRO_BUILDTARGET} \ | |
166a6c21 MT |
154 | --prefix=/usr \ |
155 | --libexecdir=/usr/lib \ | |
107ed6ee | 156 | --mandir=/usr/share/man \ |
b8b873e7 | 157 | --enable-esp \ |
166a6c21 MT |
158 | --enable-shared \ |
159 | --enable-threads=posix \ | |
160 | --enable-__cxa_atexit \ | |
161 | --enable-clocale=gnu \ | |
f23b0b6e MT |
162 | --enable-languages=c,c++,lto \ |
163 | --enable-bootstrap \ | |
164 | --enable-checking=release \ | |
166a6c21 MT |
165 | --disable-werror \ |
166 | --disable-libssp \ | |
167 | --disable-static \ | |
f23b0b6e MT |
168 | --with-system-zlib \ |
169 | --with-bugurl=http://bugtracker.ipfire.org \ | |
b415c6aa MT |
170 | --disable-libunwind-exceptions \ |
171 | --enable-gnu-unique-object \ | |
172 | --enable-linker-build-id \ | |
802ea3af MT |
173 | %{configure_options} |
174 | ||
175 | # GCC does not support a parallel build. | |
176 | make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS} | |
177 | end | |
178 | ||
179 | #test | |
180 | # cd %{DIR_SRC}/gcc-build && make check | |
181 | # cd %{DIR_APP} && ./contrib/test_summary | |
182 | #end | |
183 | ||
184 | install | |
185 | cd %{DIR_SRC}/gcc-build | |
186 | make install DESTDIR=%{BUILDROOT} | |
187 | ||
188 | mkdir -pv %{BUILDROOT}/lib | |
189 | ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp | |
190 | ln -sfv gcc %{BUILDROOT}/usr/bin/cc | |
191 | ||
192 | # Move libgcc_s to /lib | |
193 | mv -vf %{BUILDROOT}/usr/lib/libgcc_s.so.1 %{BUILDROOT}/lib/ | |
194 | ln -svf ../../lib/libgcc_s.so.1 %{BUILDROOT}/usr/lib/libgcc_s.so | |
195 | ||
196 | # Remove some GNU debugger stuff. | |
197 | rm -vf %{BUILDROOT}/usr/lib/lib*.py | |
198 | end | |
876f9cff MT |
199 | |
200 | keep_libraries | |
201 | /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a | |
202 | /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a | |
203 | end | |
802ea3af MT |
204 | end |
205 | ||
206 | packages | |
207 | package %{name} | |
208 | groups += Build | |
209 | ||
210 | requires | |
211 | binutils>=%{required_binutils_version} | |
212 | glibc-devel | |
7112214f | 213 | gmp-devel |
802ea3af MT |
214 | libgcc-devel |
215 | end | |
216 | ||
217 | if "%{build_cloog_ppl}" == "1" | |
218 | requires += cloog-ppl>=0.15 | |
219 | end | |
220 | end | |
221 | ||
222 | # XXX add package descriptions | |
223 | ||
224 | package %{name}-c++ | |
225 | requires = gcc=%{thisver} libstdc++-devel | |
226 | ||
227 | files | |
228 | /usr/bin/*++ | |
229 | /usr/lib/gcc/*/*/cc1plus | |
230 | /usr/share/man/man*/*++* | |
231 | end | |
232 | end | |
233 | ||
234 | package libgcc | |
235 | files | |
236 | /lib/libgcc*.so.* | |
237 | end | |
238 | end | |
239 | ||
240 | package libgcc-devel | |
241 | requires = libgcc=%{thisver} | |
242 | ||
243 | files | |
244 | /usr/lib/libgcc*.so | |
245 | end | |
246 | end | |
247 | ||
248 | package libstdc++ | |
249 | files | |
250 | /usr/lib/libstdc++*.so.* | |
251 | end | |
252 | end | |
253 | ||
254 | package libstdc++-devel | |
255 | files | |
256 | /usr/include/c++ | |
257 | /usr/lib/libstdc++*.so | |
258 | end | |
259 | end | |
260 | ||
261 | package libgomp | |
262 | files | |
263 | /usr/lib/libgomp*.so.* | |
264 | end | |
265 | end | |
266 | ||
267 | package libgomp | |
268 | files | |
269 | /usr/lib/libgomp*.so | |
270 | /usr/lib/libgomp.spec | |
271 | end | |
272 | end | |
273 | ||
274 | package libmudflap | |
275 | files | |
276 | /usr/lib/libmudflap*.so.* | |
277 | end | |
278 | end | |
279 | ||
280 | package libmudflap-devel | |
281 | files | |
282 | /usr/lib/libmudflap*.so | |
283 | end | |
284 | end | |
285 | ||
286 | package libquadmath | |
287 | files | |
288 | /usr/lib/libquadmath*.so.* | |
289 | end | |
290 | end | |
291 | ||
292 | package libquadmath-devel | |
293 | files | |
294 | /usr/lib/libquadmath*.so | |
295 | end | |
296 | end | |
1f9bc2f0 MT |
297 | |
298 | package %{name}-debuginfo | |
299 | template DEBUGINFO | |
300 | end | |
802ea3af | 301 | end |