]>
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 | ||
80 | if "%{build_cloog_ppl}" == "1" | |
81 | configure_options += --with-cloog --with-ppl | |
82 | end | |
83 | ||
84 | # CFLAGS for hardening. | |
85 | HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW | |
86 | ||
87 | prepare_cmds | |
88 | mkdir -v %{DIR_SRC}/gcc-build | |
89 | ||
90 | # Remove unneeded features that will save some compile time | |
91 | rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp} | |
92 | ||
93 | # Apply a sed substitution that will suppress the installation of | |
94 | # libiberty.a. The version of libiberty.a provided by Binutils will be used | |
95 | # instead: | |
96 | sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in | |
97 | ||
98 | # Branding gcc | |
99 | echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE | |
100 | ||
101 | # Libgomp uses -Werror regardless of --disable-werror, and this will cause a | |
102 | # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings: | |
103 | sed -e "s/-Werror//" -i libgomp/configure | |
104 | ||
105 | # The fixincludes script is known to occasionally erroneously attempt to | |
106 | # "fix" the system headers installed so far. As the headers up to this point | |
107 | # are known to not require fixing, issue the following command to prevent | |
108 | # the fixincludes script from running: | |
109 | sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in | |
110 | ||
111 | sed -i gcc/Makefile.in \ | |
112 | -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/" | |
113 | ||
114 | # we want to be able to control the pie patch logic via something other | |
115 | # than ALL_CFLAGS... | |
116 | sed -i gcc/Makefile.in \ | |
117 | -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ | |
118 | -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' | |
119 | ||
120 | # Enable the GCC hardening by default. | |
121 | sed -i gcc/Makefile.in \ | |
122 | -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |" | |
123 | ||
124 | # Compile the compiler with -fPIC as well. | |
125 | sed -i gcc/Makefile.in \ | |
126 | -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" | |
127 | ||
128 | ./contrib/gcc_update --touch | |
129 | end | |
130 | ||
131 | build | |
132 | cd %{DIR_SRC}/gcc-build | |
133 | ||
134 | # Modify CFLAGS | |
135 | OPT_FLAGS="%{CFLAGS}" | |
136 | CFLAGS="%{CFLAGS}" | |
137 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g') | |
138 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g') | |
139 | CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g') | |
140 | #CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g') | |
141 | CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g') | |
142 | CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g') | |
143 | ||
144 | CFLAGS="${CFLAGS}" \ | |
145 | CXXFLAGS="${CXXFLAGS}" \ | |
146 | XCFLAGS="${CFLAGS}" \ | |
147 | TCFLAGS="${CFLAGS}" \ | |
148 | ../%{thisapp}/configure \ | |
149 | --build=%{DISTRO_BUILDTARGET} \ | |
166a6c21 MT |
150 | --prefix=/usr \ |
151 | --libexecdir=/usr/lib \ | |
107ed6ee | 152 | --mandir=/usr/share/man \ |
b8b873e7 | 153 | --enable-esp \ |
166a6c21 MT |
154 | --enable-shared \ |
155 | --enable-threads=posix \ | |
156 | --enable-__cxa_atexit \ | |
157 | --enable-clocale=gnu \ | |
f23b0b6e MT |
158 | --enable-languages=c,c++,lto \ |
159 | --enable-bootstrap \ | |
160 | --enable-checking=release \ | |
166a6c21 MT |
161 | --disable-werror \ |
162 | --disable-libssp \ | |
163 | --disable-static \ | |
f23b0b6e MT |
164 | --with-system-zlib \ |
165 | --with-bugurl=http://bugtracker.ipfire.org \ | |
b415c6aa MT |
166 | --disable-libunwind-exceptions \ |
167 | --enable-gnu-unique-object \ | |
168 | --enable-linker-build-id \ | |
802ea3af MT |
169 | %{configure_options} |
170 | ||
171 | # GCC does not support a parallel build. | |
172 | make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS} | |
173 | end | |
174 | ||
175 | #test | |
176 | # cd %{DIR_SRC}/gcc-build && make check | |
177 | # cd %{DIR_APP} && ./contrib/test_summary | |
178 | #end | |
179 | ||
180 | install | |
181 | cd %{DIR_SRC}/gcc-build | |
182 | make install DESTDIR=%{BUILDROOT} | |
183 | ||
184 | mkdir -pv %{BUILDROOT}/lib | |
185 | ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp | |
186 | ln -sfv gcc %{BUILDROOT}/usr/bin/cc | |
187 | ||
188 | # Move libgcc_s to /lib | |
189 | mv -vf %{BUILDROOT}/usr/lib/libgcc_s.so.1 %{BUILDROOT}/lib/ | |
190 | ln -svf ../../lib/libgcc_s.so.1 %{BUILDROOT}/usr/lib/libgcc_s.so | |
191 | ||
192 | # Remove some GNU debugger stuff. | |
193 | rm -vf %{BUILDROOT}/usr/lib/lib*.py | |
194 | end | |
876f9cff MT |
195 | |
196 | keep_libraries | |
197 | /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a | |
198 | /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a | |
199 | end | |
802ea3af MT |
200 | end |
201 | ||
202 | packages | |
203 | package %{name} | |
204 | groups += Build | |
205 | ||
206 | requires | |
207 | binutils>=%{required_binutils_version} | |
208 | glibc-devel | |
7112214f | 209 | gmp-devel |
802ea3af MT |
210 | libgcc-devel |
211 | end | |
212 | ||
213 | if "%{build_cloog_ppl}" == "1" | |
214 | requires += cloog-ppl>=0.15 | |
215 | end | |
216 | end | |
217 | ||
218 | # XXX add package descriptions | |
219 | ||
220 | package %{name}-c++ | |
221 | requires = gcc=%{thisver} libstdc++-devel | |
222 | ||
223 | files | |
224 | /usr/bin/*++ | |
225 | /usr/lib/gcc/*/*/cc1plus | |
226 | /usr/share/man/man*/*++* | |
227 | end | |
228 | end | |
229 | ||
230 | package libgcc | |
231 | files | |
232 | /lib/libgcc*.so.* | |
233 | end | |
234 | end | |
235 | ||
236 | package libgcc-devel | |
237 | requires = libgcc=%{thisver} | |
238 | ||
239 | files | |
240 | /usr/lib/libgcc*.so | |
241 | end | |
242 | end | |
243 | ||
244 | package libstdc++ | |
245 | files | |
246 | /usr/lib/libstdc++*.so.* | |
247 | end | |
248 | end | |
249 | ||
250 | package libstdc++-devel | |
251 | files | |
252 | /usr/include/c++ | |
253 | /usr/lib/libstdc++*.so | |
254 | end | |
255 | end | |
256 | ||
257 | package libgomp | |
258 | files | |
259 | /usr/lib/libgomp*.so.* | |
260 | end | |
261 | end | |
262 | ||
263 | package libgomp | |
264 | files | |
265 | /usr/lib/libgomp*.so | |
266 | /usr/lib/libgomp.spec | |
267 | end | |
268 | end | |
269 | ||
270 | package libmudflap | |
271 | files | |
272 | /usr/lib/libmudflap*.so.* | |
273 | end | |
274 | end | |
275 | ||
276 | package libmudflap-devel | |
277 | files | |
278 | /usr/lib/libmudflap*.so | |
279 | end | |
280 | end | |
281 | ||
282 | package libquadmath | |
283 | files | |
284 | /usr/lib/libquadmath*.so.* | |
285 | end | |
286 | end | |
287 | ||
288 | package libquadmath-devel | |
289 | files | |
290 | /usr/lib/libquadmath*.so | |
291 | end | |
292 | end | |
293 | end |