58 Patch0: gcc.patch |
58 Patch0: gcc.patch |
59 |
59 |
60 # build information |
60 # build information |
61 Prefix: %{l_prefix} |
61 Prefix: %{l_prefix} |
62 BuildRoot: %{l_buildroot} |
62 BuildRoot: %{l_buildroot} |
63 BuildPreReq: OpenPKG, openpkg >= 20060823, make, libtool |
63 BuildPreReq: OpenPKG, openpkg >= 20060823, make |
64 PreReq: OpenPKG, openpkg >= 20060823 |
64 PreReq: OpenPKG, openpkg >= 20060823 |
|
65 BuildPreReq: mpc, mpfr, gmp |
|
66 PreReq: mpc, mpfr, gmp |
65 %if "%{with_binutils}" == "yes" |
67 %if "%{with_binutils}" == "yes" |
66 BuildPreReq: binutils >= 2.14 |
68 BuildPreReq: binutils >= 2.14 |
67 PreReq: binutils >= 2.14 |
69 PreReq: binutils >= 2.14 |
68 %endif |
70 %endif |
69 BuildPreReq: mpc, mpfr, gmp |
|
70 PreReq: mpc, mpfr, gmp |
|
71 %if "%{with_cxx}" == "yes" |
71 %if "%{with_cxx}" == "yes" |
72 BuildPreReq: libiconv |
72 BuildPreReq: libiconv |
73 PreReq: libiconv |
73 PreReq: libiconv |
74 %endif |
74 %endif |
75 %if "%{with_java}" == "yes" |
75 %if "%{with_java}" == "yes" |
106 %endif |
106 %endif |
107 %if "%{with_fortran}" == "yes" |
107 %if "%{with_fortran}" == "yes" |
108 %setup -q -T -D -b 4 |
108 %setup -q -T -D -b 4 |
109 %endif |
109 %endif |
110 %patch -p0 |
110 %patch -p0 |
|
111 %{l_shtool} subst \ |
|
112 -e 's;\(instname="\$dir/\$name"\)i;\1;' \ |
|
113 ltmain.sh |
111 %{l_shtool} subst -v -s \ |
114 %{l_shtool} subst -v -s \ |
112 -e 's;\(gmplibs="-lmpc\) \(-lmpfr -lgmp\);\1 -lm \2;' \ |
115 -e 's;\(gmplibs="-lmpc\) \(-lmpfr -lgmp\);\1 -lm \2;' \ |
113 configure |
116 configure |
114 %{l_shtool} subst -v -s \ |
117 %{l_shtool} subst -v -s \ |
115 -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \ |
118 -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \ |
116 gcc/configure |
119 gcc/configure |
|
120 %{l_shtool} subst \ |
|
121 -e 's;[ \t]*-W[a-zA-Z0-9_\-][a-zA-Z0-9_\-]*,*;;g' \ |
|
122 lto-plugin/Makefile.in |
|
123 %{l_shtool} subst \ |
|
124 -e 's;-rpath *[^ \t][^ \t]*;;g' \ |
|
125 -e 's;--tag=disable-static;--tag=disable-shared;g' \ |
|
126 -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \ |
|
127 -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \ |
|
128 lto-plugin/Makefile.in |
117 if [ ".%{V_comp}" != . ]; then |
129 if [ ".%{V_comp}" != . ]; then |
118 %{l_shtool} subst -v -s \ |
130 %{l_shtool} subst -v -s \ |
119 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ |
131 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ |
120 `find . -name Makefile.in -type f -print` |
132 `find . -name Makefile.in -type f -print` |
121 fi |
133 fi |
179 # disable GNU iconv usage |
191 # disable GNU iconv usage |
180 ( echo "am_cv_func_iconv=no" |
192 ( echo "am_cv_func_iconv=no" |
181 echo "am_cv_lib_iconv=no" |
193 echo "am_cv_lib_iconv=no" |
182 ) >config.cache |
194 ) >config.cache |
183 |
195 |
|
196 # platform specific config logic |
|
197 case "%{l_platform -t}" in |
|
198 *i?86-sunos* ) echo "gcc_cv_prog_cmp_skip=true" >>config.cache;; |
|
199 esac |
|
200 |
184 # configure the package |
201 # configure the package |
185 LD="$LD" \ |
202 LD="$LD" \ |
186 AS="$AS" \ |
203 AS="$AS" \ |
187 CC="%{l_cc}" \ |
204 CC="%{l_cc}" \ |
188 CFLAGS="%{l_cflags}" \ |
205 CFLAGS="%{l_cflags}" \ |
189 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
206 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
190 CPPFLAGS="%{l_cppflags}" \ |
207 CPPFLAGS="%{l_cppflags}" \ |
191 LDFLAGS="%{l_ldflags}" \ |
208 LDFLAGS="%{l_ldflags}" \ |
192 %endif |
209 %endif |
193 CONFIG_SHELL="%{l_bash}" \ |
210 CONFIG_SHELL="%{l_bash}" \ |
|
211 GREP="%{l_bash}" \ |
194 ../configure \ |
212 ../configure \ |
195 --with-bugurl="http://openpkg.org/" \ |
213 --with-bugurl="http://openpkg.org/" \ |
196 --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \ |
214 --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \ |
197 --cache-file=./config.cache \ |
215 --cache-file=./config.cache \ |
198 --srcdir=`pwd`/.. \ |
216 --srcdir=`pwd`/.. \ |
234 l_cxxflags="" |
252 l_cxxflags="" |
235 l_boot_cflags="" |
253 l_boot_cflags="" |
236 l_libcflags="-g" |
254 l_libcflags="-g" |
237 l_libcxxflags="-g" |
255 l_libcxxflags="-g" |
238 # at least GNU as from GNU binutils supports -pipe always |
256 # at least GNU as from GNU binutils supports -pipe always |
239 "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && { |
257 "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && { |
240 l_boot_cflags="$l_boot_cflags -pipe" |
258 l_boot_cflags="$l_boot_cflags -pipe" |
241 l_libcxxflags="$l_libcxxflags -pipe" |
259 l_libcxxflags="$l_libcxxflags -pipe" |
242 } |
260 } |
243 %if "%{with_optimize}" == "yes" |
261 %if "%{with_optimize}" == "yes" |
244 # conservatively optimize the generated program code |
262 if [ ".$l_ccisgcc" = .yes ]; then |
245 # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!) |
263 l_ia32=native |
|
264 else |
|
265 l_ia32=pentium3 |
|
266 fi |
|
267 case "%{l_platform -t}" in |
|
268 *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=$l_ia32" ;; |
|
269 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; |
|
270 esac |
|
271 l_cflags="$l_cflags -O" |
|
272 l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" |
|
273 l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" |
|
274 %else |
|
275 %if "%{with_optimize}" == "port" |
|
276 # conservatively optimize the generated program code for portable use, |
|
277 # also _tune_ for particular CPUs, but _without_ requiring these CPUs! |
|
278 case "%{l_platform -t}" in |
|
279 *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; |
|
280 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; |
|
281 esac |
246 l_cflags="$l_cflags -O" |
282 l_cflags="$l_cflags -O" |
247 l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer" |
283 l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer" |
248 case "%{l_platform -t}" in |
|
249 *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;; |
|
250 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; |
|
251 esac |
|
252 l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates" |
284 l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates" |
253 %else |
285 %else |
254 # else do no optimizations at all to reduce problems to minimum in advance |
286 # do not optimize at all to avoid problems |
255 l_boot_cflags="$l_boot_cflags -O0" |
287 l_boot_cflags="$l_boot_cflags -O0" |
256 l_libcxxflags="$l_libcxxflags -O0" |
288 l_libcxxflags="$l_libcxxflags -O0" |
257 %endif |
289 %endif |
258 maketarget="bootstrap2-lean" |
290 %endif |
|
291 maketarget="bootstrap" |
259 %if "%{with_profile}" == "yes" |
292 %if "%{with_profile}" == "yes" |
260 # GCC >= 3.4 supports a "profiledbootstrap" target to build an |
293 # GCC >= 3.4 supports a "profiledbootstrap" target to build an |
261 # optimized version of itself through profiling. Because this |
294 # optimized version of itself through profiling. Because this |
262 # requires a (bootstrapping) C compiler with 64-bit arithmetic, |
295 # requires a (bootstrapping) C compiler with 64-bit arithmetic, |
263 # the whole approach is currently supported only if already |
296 # the whole approach is currently supported only if already |
264 # building with GCC as the bootstrapping C compiler. |
297 # building with GCC as the bootstrapping C compiler. |
265 if [ ".$l_ccisgcc" = .yes ]; then |
298 if [ ".$l_ccisgcc" = .yes ]; then |
266 maketarget="profiledbootstrap" |
299 maketarget="profiledbootstrap" |
|
300 else |
|
301 ( echo "Building a profiled GCC requires GCC. Please install GCC" |
|
302 echo "first and then build again with the profile option enabled." |
|
303 ) | %{l_rpmtool} msg -b -t error |
|
304 exit 1 |
267 fi |
305 fi |
268 %endif |
306 %endif |
269 case "%{l_platform -t}" in |
307 case "%{l_platform -t}" in |
270 amd64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
308 *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
271 ia64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
|
272 sparc64-freebsd* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
|
273 esac |
309 esac |
274 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
310 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
275 l_cflags="$l_cflags %{l_cppflags}" |
311 l_cflags="$l_cflags %{l_cppflags}" |
276 l_cxxflags="$l_cxxflags %{l_cppflags}" |
312 l_cxxflags="$l_cxxflags %{l_cppflags}" |
277 l_libcflags="$l_libcflags %{l_cppflags}" |
313 l_libcflags="$l_libcflags %{l_cppflags}" |
278 l_libcxxflags="$l_libcxxflags %{l_cppflags}" |
314 l_libcxxflags="$l_libcxxflags %{l_cppflags}" |
279 %endif |
315 %endif |
280 |
316 |
281 # build the package |
317 # build the package |
282 MAKE="%{l_make} %{l_mflags}" \ |
318 MAKE="%{l_make} %{l_mflags -O}" \ |
283 %{l_make} %{l_mflags} \ |
319 %{l_make} %{l_mflags -O} \ |
284 MAKE="%{l_make} %{l_mflags}" \ |
320 GREP="grep" \ |
|
321 MAKE="%{l_make} %{l_mflags -O}" \ |
285 BOOT_CFLAGS="${l_boot_cflags}" \ |
322 BOOT_CFLAGS="${l_boot_cflags}" \ |
286 CFLAGS="${l_cflags}" \ |
323 CFLAGS="${l_cflags}" \ |
287 CXXFLAGS="${l_cxxflags}" \ |
324 CXXFLAGS="${l_cxxflags}" \ |
288 LIBCFLAGS="${l_libcflags}" \ |
325 LIBCFLAGS="${l_libcflags}" \ |
289 LIBCXXFLAGS="${l_libcxxflags}" \ |
326 LIBCXXFLAGS="${l_libcxxflags}" \ |
324 done |
361 done |
325 mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \ |
362 mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \ |
326 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \ |
363 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \ |
327 >/dev/null 2>&1 || true |
364 >/dev/null 2>&1 || true |
328 |
365 |
|
366 # correct hardcoded paths |
|
367 %{l_shtool} subst \ |
|
368 -e "s;\(dependency_libs='[ \t]*-L\).*;\1%{l_prefix}/lib -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]* -liberty';" \ |
|
369 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la |
|
370 |
329 # strip installation tree |
371 # strip installation tree |
330 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} |
372 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} |
331 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir |
373 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir |
332 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true |
374 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true |
333 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true |
375 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true |