# HG changeset patch # User Michael Schloh von Bennewitz # Date 1301830495 -7200 # Node ID f71e028eb3e2df198811ab07195d2ef25b5dd93d # Parent fa72b60f59c992bcb2ea292409050fe29ffab2e5 Correct and improve several packaging aspects including... Correct datadir path for python modules, correct jar(1) path for building libgcj classes, strip libexecdir path of version numbers, improve name of oblbld build path, clean whitespace from as(1) and ld(1) GNU detection, remove seemingly discarded '--with-local-prefix' configure argument, and correct hardcoded lto plugin libtool archive dependency information. Most importantly, correct IA32 architecture detection logic in config.gcc to correctly emit SSE2 instructions conditionally, leading to the removal of all '-march' bootstrap options and replacement with unconditional (for IA32/AMD64) '-mtune=native' options. Comments and buildtime warnings are corrected appropriately. In theory these changes cause a more portable, orthoganal, and optimal bootstrap to be built. diff -r fa72b60f59c9 -r f71e028eb3e2 gcc/gcc.spec --- a/gcc/gcc.spec Wed Mar 30 19:37:58 2011 +0200 +++ b/gcc/gcc.spec Sun Apr 03 13:34:55 2011 +0200 @@ -36,7 +36,7 @@ Group: Compiler License: GPL Version: %{V_full} -Release: 20110330 +Release: 20110331 # package options %option with_binutils yes @@ -133,9 +133,23 @@ -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \ -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \ lto-plugin/Makefile.in +%if "%{with_cxx}" == "yes" + %{l_shtool} subst \ + -e 's;\(pythondir *= *\$(datadir)\)/gcc-\$(gcc_version);\1/gcc;' \ + libstdc++-v3/python/Makefile.in +%endif +%if "%{with_java}" == "yes" + %{l_shtool} subst \ + -e 's;\(default_python_dir\) *=.*;\1=/share/gcc/python/libjava;' \ + libjava/configure + %{l_shtool} subst \ + -e 's;JAR *= *@JAR@;JAR = $(here)/scripts/jar;' \ + libjava/Makefile.in +%endif if [ ".%{V_comp}" != . ]; then %{l_shtool} subst -v -s \ -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ + -e 's;(libexecdir)/gcc/;(libexecdir)/gcc%{V_comp}/;' \ `find . -name Makefile.in -type f -print` fi %{l_shtool} subst \ @@ -152,11 +166,15 @@ %{l_shtool} subst \ -e 's;;"%{l_prefix}/include/iconv.h";' \ libstdc++-v3/include/ext/codecvt_specializations.h + %{l_shtool} subst \ + -e 's;.*with_arch_32=\${with_arch_32:-pentium4}.*;;' \ + -e 's;with_arch_32=\${with_arch_32:-pentiumpro};arch_without_sse2=yes;' \ + gcc/config.gcc %build # create build subdirectory - %{l_shtool} mkdir -p obj - cd obj + %{l_shtool} mkdir -p objbld + cd objbld # locate ld(1) and as(1) accordingly %if "%{with_binutils}" == "yes" @@ -171,8 +189,8 @@ l_with_gnu_ld_as="" echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD" echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS" - $LD --version /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" - $AS --version /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" + $LD --version /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" + $AS --version /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" # determine threads use %if "%{with_threads}" == "yes" @@ -227,9 +245,7 @@ --mandir=%{l_prefix}/man \ --infodir=%{l_prefix}/info \ --includedir=%{l_prefix}/include/gcc%{V_comp} \ - --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \ --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \ - --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \ --enable-languages="${l_enable_languages}" \ --enable-threads="${l_enable_threads}" \ --disable-maintainer-mode \ @@ -276,34 +292,25 @@ echo "Pay attention when building on one computer and installing on another as" echo "problems may be platform specific. If in doubt, disable optimization." ) | %{l_rpmtool} msg -b -t warn - if [ ".$l_ccisgcc" = .yes ]; then - l_archia32=native; l_archia64=native; l_archamd64=native - else + if [ ".$l_ccisgcc" != .yes ]; then # CPU native detection only works with GCC (see driver-i386.c) ( echo "Platform specific optimization is enabled, but detection of appropriate" echo "native architecture is only possible when bootstrapping GCC using a pre-" - echo "installed GCC. The current build is using a different compiler, so to" - echo "provide any optimization at all a wild guess is made and a CPU type" - echo "hardcoded instead of using accurate native detection." + echo "installed GCC. The current build is using a different compiler, so such" + echo "optimization is generically built while deferring native architecture" + echo "detection to the final GCC binary." echo "" - echo "To achieve accurate optimization of GCC please install GCC first. Then" - echo "build this package a second time which will use GCC to bootstrap itself." + echo "To achieve native architecture detection while bootstrapping please" + echo "install GCC first and then build GCC a second time." ) | %{l_rpmtool} msg -b -t notice - - # guess lowest common denominator CPU types - # http://en.wikipedia.org/wiki/(X86|X64-64) - # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html - l_archia32=pentium3; l_archia64=nocona; l_archamd64=k8 fi - # this optimization logic is unportable and could cause problems - # if installing the resulting binary package on a different host! + # tuning without specifying '-march' is portable and in theory + # allows the resulting GCC binaries to execute on other hosts! case "%{l_platform -t}" in - *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; - *sun-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; - *i?86-* ) l_boot_cflags="$l_boot_cflags -march=$l_archia32" ;; - *ia64-* ) l_boot_cflags="$l_boot_cflags -march=$l_archia64" ;; - *amd64-* ) l_boot_cflags="$l_boot_cflags -march=$l_archamd64" ;; - * ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; + *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; + *sun*-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; + *i?86-* | *amd64-* | *ia64-* ) l_boot_cflags="$l_boot_cflags -mtune=native" ;; + * ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; esac l_cflags="$l_cflags -O" l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" @@ -371,8 +378,8 @@ # fetch GNU platform triple triple=`./config.guess` - # perform the standard installation procedure - ( cd obj + # perform standard installation procedure + ( cd objbld %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT ) || exit $? @@ -404,8 +411,8 @@ # correct hardcoded paths %{l_shtool} subst \ - -e "s;\(dependency_libs='[ \t]*-L\).*;\1%{l_prefix}/lib -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]* -liberty';" \ - $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la + -e "s;\(dependency_libs\) *=.*;\1='-L%{l_prefix}/lib\ -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}\ -liberty';" \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la # strip installation tree rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}