gcc/gcc.spec

changeset 337
f71e028eb3e2
parent 335
6eb79a12ee37
child 338
1153ac6bac7e
equal deleted inserted replaced
6:0e0b4b2a3b6e 7:c2b118b2b174
34 Distribution: OpenPKG Community 34 Distribution: OpenPKG Community
35 Class: CORE 35 Class: CORE
36 Group: Compiler 36 Group: Compiler
37 License: GPL 37 License: GPL
38 Version: %{V_full} 38 Version: %{V_full}
39 Release: 20110330 39 Release: 20110331
40 40
41 # package options 41 # package options
42 %option with_binutils yes 42 %option with_binutils yes
43 %option with_cxx yes 43 %option with_cxx yes
44 %option with_objc no 44 %option with_objc no
131 -e 's;-rpath *[^ \t][^ \t]*;;g' \ 131 -e 's;-rpath *[^ \t][^ \t]*;;g' \
132 -e 's;--tag=disable-static;--tag=disable-shared;g' \ 132 -e 's;--tag=disable-static;--tag=disable-shared;g' \
133 -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \ 133 -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \
134 -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \ 134 -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \
135 lto-plugin/Makefile.in 135 lto-plugin/Makefile.in
136 %if "%{with_cxx}" == "yes"
137 %{l_shtool} subst \
138 -e 's;\(pythondir *= *\$(datadir)\)/gcc-\$(gcc_version);\1/gcc;' \
139 libstdc++-v3/python/Makefile.in
140 %endif
141 %if "%{with_java}" == "yes"
142 %{l_shtool} subst \
143 -e 's;\(default_python_dir\) *=.*;\1=/share/gcc/python/libjava;' \
144 libjava/configure
145 %{l_shtool} subst \
146 -e 's;JAR *= *@JAR@;JAR = $(here)/scripts/jar;' \
147 libjava/Makefile.in
148 %endif
136 if [ ".%{V_comp}" != . ]; then 149 if [ ".%{V_comp}" != . ]; then
137 %{l_shtool} subst -v -s \ 150 %{l_shtool} subst -v -s \
138 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ 151 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
152 -e 's;(libexecdir)/gcc/;(libexecdir)/gcc%{V_comp}/;' \
139 `find . -name Makefile.in -type f -print` 153 `find . -name Makefile.in -type f -print`
140 fi 154 fi
141 %{l_shtool} subst \ 155 %{l_shtool} subst \
142 -e 's;^\(do-compare\) *\(=.*\);#\1-shouldnt-be-defined-here \2;' \ 156 -e 's;^\(do-compare\) *\(=.*\);#\1-shouldnt-be-defined-here \2;' \
143 config/*.mk 157 config/*.mk
150 ;; 164 ;;
151 esac 165 esac
152 %{l_shtool} subst \ 166 %{l_shtool} subst \
153 -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \ 167 -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \
154 libstdc++-v3/include/ext/codecvt_specializations.h 168 libstdc++-v3/include/ext/codecvt_specializations.h
169 %{l_shtool} subst \
170 -e 's;.*with_arch_32=\${with_arch_32:-pentium4}.*;;' \
171 -e 's;with_arch_32=\${with_arch_32:-pentiumpro};arch_without_sse2=yes;' \
172 gcc/config.gcc
155 173
156 %build 174 %build
157 # create build subdirectory 175 # create build subdirectory
158 %{l_shtool} mkdir -p obj 176 %{l_shtool} mkdir -p objbld
159 cd obj 177 cd objbld
160 178
161 # locate ld(1) and as(1) accordingly 179 # locate ld(1) and as(1) accordingly
162 %if "%{with_binutils}" == "yes" 180 %if "%{with_binutils}" == "yes"
163 # allow OpenPKG binutils 181 # allow OpenPKG binutils
164 LD=%{l_tool_locate ld ld} 182 LD=%{l_tool_locate ld ld}
169 AS=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin:/usr/local/bin:/usr/local/sbin which as` 187 AS=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin:/usr/local/bin:/usr/local/sbin which as`
170 %endif 188 %endif
171 l_with_gnu_ld_as="" 189 l_with_gnu_ld_as=""
172 echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD" 190 echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD"
173 echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS" 191 echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS"
174 $LD --version </dev/null 2>/dev/null | grep "^GNU ld " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-ld" 192 $LD --version </dev/null 2>/dev/null | grep "^GNU ld" >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-ld"
175 $AS --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-as" 193 $AS --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-as"
176 194
177 # determine threads use 195 # determine threads use
178 %if "%{with_threads}" == "yes" 196 %if "%{with_threads}" == "yes"
179 l_enable_threads="posix" 197 l_enable_threads="posix"
180 %else 198 %else
225 --prefix=%{l_prefix} \ 243 --prefix=%{l_prefix} \
226 --exec-prefix=%{l_prefix} \ 244 --exec-prefix=%{l_prefix} \
227 --mandir=%{l_prefix}/man \ 245 --mandir=%{l_prefix}/man \
228 --infodir=%{l_prefix}/info \ 246 --infodir=%{l_prefix}/info \
229 --includedir=%{l_prefix}/include/gcc%{V_comp} \ 247 --includedir=%{l_prefix}/include/gcc%{V_comp} \
230 --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
231 --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \ 248 --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
232 --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
233 --enable-languages="${l_enable_languages}" \ 249 --enable-languages="${l_enable_languages}" \
234 --enable-threads="${l_enable_threads}" \ 250 --enable-threads="${l_enable_threads}" \
235 --disable-maintainer-mode \ 251 --disable-maintainer-mode \
236 --disable-shared \ 252 --disable-shared \
237 --disable-nls \ 253 --disable-nls \
274 echo "stages as well as stage comparison and even the final installation." 290 echo "stages as well as stage comparison and even the final installation."
275 echo "" 291 echo ""
276 echo "Pay attention when building on one computer and installing on another as" 292 echo "Pay attention when building on one computer and installing on another as"
277 echo "problems may be platform specific. If in doubt, disable optimization." 293 echo "problems may be platform specific. If in doubt, disable optimization."
278 ) | %{l_rpmtool} msg -b -t warn 294 ) | %{l_rpmtool} msg -b -t warn
279 if [ ".$l_ccisgcc" = .yes ]; then 295 if [ ".$l_ccisgcc" != .yes ]; then
280 l_archia32=native; l_archia64=native; l_archamd64=native
281 else
282 # CPU native detection only works with GCC (see driver-i386.c) 296 # CPU native detection only works with GCC (see driver-i386.c)
283 ( echo "Platform specific optimization is enabled, but detection of appropriate" 297 ( echo "Platform specific optimization is enabled, but detection of appropriate"
284 echo "native architecture is only possible when bootstrapping GCC using a pre-" 298 echo "native architecture is only possible when bootstrapping GCC using a pre-"
285 echo "installed GCC. The current build is using a different compiler, so to" 299 echo "installed GCC. The current build is using a different compiler, so such"
286 echo "provide any optimization at all a wild guess is made and a CPU type" 300 echo "optimization is generically built while deferring native architecture"
287 echo "hardcoded instead of using accurate native detection." 301 echo "detection to the final GCC binary."
288 echo "" 302 echo ""
289 echo "To achieve accurate optimization of GCC please install GCC first. Then" 303 echo "To achieve native architecture detection while bootstrapping please"
290 echo "build this package a second time which will use GCC to bootstrap itself." 304 echo "install GCC first and then build GCC a second time."
291 ) | %{l_rpmtool} msg -b -t notice 305 ) | %{l_rpmtool} msg -b -t notice
292
293 # guess lowest common denominator CPU types
294 # http://en.wikipedia.org/wiki/(X86|X64-64)
295 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
296 l_archia32=pentium3; l_archia64=nocona; l_archamd64=k8
297 fi 306 fi
298 # this optimization logic is unportable and could cause problems 307 # tuning without specifying '-march' is portable and in theory
299 # if installing the resulting binary package on a different host! 308 # allows the resulting GCC binaries to execute on other hosts!
300 case "%{l_platform -t}" in 309 case "%{l_platform -t}" in
301 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; 310 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
302 *sun-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; 311 *sun*-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;;
303 *i?86-* ) l_boot_cflags="$l_boot_cflags -march=$l_archia32" ;; 312 *i?86-* | *amd64-* | *ia64-* ) l_boot_cflags="$l_boot_cflags -mtune=native" ;;
304 *ia64-* ) l_boot_cflags="$l_boot_cflags -march=$l_archia64" ;; 313 * ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;;
305 *amd64-* ) l_boot_cflags="$l_boot_cflags -march=$l_archamd64" ;;
306 * ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;;
307 esac 314 esac
308 l_cflags="$l_cflags -O" 315 l_cflags="$l_cflags -O"
309 l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" 316 l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer"
310 l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" 317 l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates"
311 %else 318 %else
369 rm -rf $RPM_BUILD_ROOT 376 rm -rf $RPM_BUILD_ROOT
370 377
371 # fetch GNU platform triple 378 # fetch GNU platform triple
372 triple=`./config.guess` 379 triple=`./config.guess`
373 380
374 # perform the standard installation procedure 381 # perform standard installation procedure
375 ( cd obj 382 ( cd objbld
376 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 383 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
377 ) || exit $? 384 ) || exit $?
378 385
379 # cleanup installation tree 386 # cleanup installation tree
380 mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \ 387 mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \
402 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \ 409 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
403 >/dev/null 2>&1 || true 410 >/dev/null 2>&1 || true
404 411
405 # correct hardcoded paths 412 # correct hardcoded paths
406 %{l_shtool} subst \ 413 %{l_shtool} subst \
407 -e "s;\(dependency_libs='[ \t]*-L\).*;\1%{l_prefix}/lib -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]* -liberty';" \ 414 -e "s;\(dependency_libs\) *=.*;\1='-L%{l_prefix}/lib\ -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}\ -liberty';" \
408 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la 415 $RPM_BUILD_ROOT%{l_prefix}/libexec/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la
409 416
410 # strip installation tree 417 # strip installation tree
411 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} 418 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
412 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir 419 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
413 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true 420 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true

mercurial