Correct and improve several packaging aspects including...

Sun, 03 Apr 2011 13:34:55 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sun, 03 Apr 2011 13:34:55 +0200
changeset 337
f71e028eb3e2
parent 336
fa72b60f59c9
child 338
1153ac6bac7e

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.

gcc/gcc.spec file | annotate | diff | comparison | revisions
     1.1 --- a/gcc/gcc.spec	Wed Mar 30 19:37:58 2011 +0200
     1.2 +++ b/gcc/gcc.spec	Sun Apr 03 13:34:55 2011 +0200
     1.3 @@ -36,7 +36,7 @@
     1.4  Group:        Compiler
     1.5  License:      GPL
     1.6  Version:      %{V_full}
     1.7 -Release:      20110330
     1.8 +Release:      20110331
     1.9  
    1.10  #   package options
    1.11  %option       with_binutils  yes
    1.12 @@ -133,9 +133,23 @@
    1.13          -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \
    1.14          -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \
    1.15          lto-plugin/Makefile.in
    1.16 +%if "%{with_cxx}" == "yes"
    1.17 +    %{l_shtool} subst \
    1.18 +        -e 's;\(pythondir *= *\$(datadir)\)/gcc-\$(gcc_version);\1/gcc;' \
    1.19 +        libstdc++-v3/python/Makefile.in
    1.20 +%endif
    1.21 +%if "%{with_java}" == "yes"
    1.22 +    %{l_shtool} subst \
    1.23 +        -e 's;\(default_python_dir\) *=.*;\1=/share/gcc/python/libjava;' \
    1.24 +        libjava/configure
    1.25 +    %{l_shtool} subst \
    1.26 +        -e 's;JAR *= *@JAR@;JAR = $(here)/scripts/jar;' \
    1.27 +        libjava/Makefile.in
    1.28 +%endif
    1.29      if [ ".%{V_comp}" != . ]; then
    1.30          %{l_shtool} subst -v -s \
    1.31              -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
    1.32 +            -e 's;(libexecdir)/gcc/;(libexecdir)/gcc%{V_comp}/;' \
    1.33              `find . -name Makefile.in -type f -print`
    1.34      fi
    1.35      %{l_shtool} subst \
    1.36 @@ -152,11 +166,15 @@
    1.37      %{l_shtool} subst \
    1.38          -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \
    1.39          libstdc++-v3/include/ext/codecvt_specializations.h
    1.40 +    %{l_shtool} subst \
    1.41 +        -e 's;.*with_arch_32=\${with_arch_32:-pentium4}.*;;' \
    1.42 +        -e 's;with_arch_32=\${with_arch_32:-pentiumpro};arch_without_sse2=yes;' \
    1.43 +        gcc/config.gcc
    1.44  
    1.45  %build
    1.46      #   create build subdirectory
    1.47 -    %{l_shtool} mkdir -p obj
    1.48 -    cd obj
    1.49 +    %{l_shtool} mkdir -p objbld
    1.50 +    cd objbld
    1.51  
    1.52      #   locate ld(1) and as(1) accordingly
    1.53  %if "%{with_binutils}" == "yes"
    1.54 @@ -171,8 +189,8 @@
    1.55      l_with_gnu_ld_as=""
    1.56      echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD"
    1.57      echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS"
    1.58 -    $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"
    1.59 -    $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"
    1.60 +    $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"
    1.61 +    $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"
    1.62  
    1.63      #   determine threads use
    1.64  %if "%{with_threads}" == "yes"
    1.65 @@ -227,9 +245,7 @@
    1.66          --mandir=%{l_prefix}/man \
    1.67          --infodir=%{l_prefix}/info \
    1.68          --includedir=%{l_prefix}/include/gcc%{V_comp} \
    1.69 -        --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
    1.70          --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
    1.71 -        --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
    1.72          --enable-languages="${l_enable_languages}" \
    1.73          --enable-threads="${l_enable_threads}" \
    1.74          --disable-maintainer-mode \
    1.75 @@ -276,34 +292,25 @@
    1.76        echo "Pay attention when building on one computer and installing on another as"
    1.77        echo "problems may be platform specific. If in doubt, disable optimization."
    1.78      ) | %{l_rpmtool} msg -b -t warn
    1.79 -    if [ ".$l_ccisgcc" = .yes ]; then
    1.80 -        l_archia32=native; l_archia64=native; l_archamd64=native
    1.81 -    else
    1.82 +    if [ ".$l_ccisgcc" != .yes ]; then
    1.83          #   CPU native detection only works with GCC (see driver-i386.c)
    1.84          ( echo "Platform specific optimization is enabled, but detection of appropriate"
    1.85            echo "native architecture is only possible when bootstrapping GCC using a pre-"
    1.86 -          echo "installed GCC. The current build is using a different compiler, so to"
    1.87 -          echo "provide any optimization at all a wild guess is made and a CPU type"
    1.88 -          echo "hardcoded instead of using accurate native detection."
    1.89 +          echo "installed GCC. The current build is using a different compiler, so such"
    1.90 +          echo "optimization is generically built while deferring native architecture"
    1.91 +          echo "detection to the final GCC binary."
    1.92            echo ""
    1.93 -          echo "To achieve accurate optimization of GCC please install GCC first. Then"
    1.94 -          echo "build this package a second time which will use GCC to bootstrap itself."
    1.95 +          echo "To achieve native architecture detection while bootstrapping please"
    1.96 +          echo "install GCC first and then build GCC a second time."
    1.97          ) | %{l_rpmtool} msg -b -t notice
    1.98 -
    1.99 -        #   guess lowest common denominator CPU types
   1.100 -        #   http://en.wikipedia.org/wiki/(X86|X64-64)
   1.101 -        #   http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
   1.102 -        l_archia32=pentium3; l_archia64=nocona; l_archamd64=k8
   1.103      fi
   1.104 -    #   this optimization logic is unportable and could cause problems
   1.105 -    #   if installing the resulting binary package on a different host!
   1.106 +    #   tuning without specifying '-march' is portable and in theory
   1.107 +    #   allows the resulting GCC binaries to execute on other hosts!
   1.108      case "%{l_platform -t}" in
   1.109 -        *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
   1.110 -        *sun-*      ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;;
   1.111 -        *i?86-*     ) l_boot_cflags="$l_boot_cflags -march=$l_archia32" ;;
   1.112 -        *ia64-*     ) l_boot_cflags="$l_boot_cflags -march=$l_archia64" ;;
   1.113 -        *amd64-*    ) l_boot_cflags="$l_boot_cflags -march=$l_archamd64" ;;
   1.114 -        *           ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;;
   1.115 +        *sun4[uv]-*                  ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
   1.116 +        *sun*-*                      ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;;
   1.117 +        *i?86-* | *amd64-* | *ia64-* ) l_boot_cflags="$l_boot_cflags -mtune=native" ;;
   1.118 +        *                            ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;;
   1.119      esac
   1.120      l_cflags="$l_cflags -O"
   1.121      l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer"
   1.122 @@ -371,8 +378,8 @@
   1.123      #   fetch GNU platform triple
   1.124      triple=`./config.guess`
   1.125  
   1.126 -    #   perform the standard installation procedure
   1.127 -    ( cd obj
   1.128 +    #   perform standard installation procedure
   1.129 +    ( cd objbld
   1.130        %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.131      ) || exit $?
   1.132  
   1.133 @@ -404,8 +411,8 @@
   1.134  
   1.135      #   correct hardcoded paths
   1.136      %{l_shtool} subst \
   1.137 -        -e "s;\(dependency_libs='[ \t]*-L\).*;\1%{l_prefix}/lib -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]* -liberty';" \
   1.138 -       $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la
   1.139 +        -e "s;\(dependency_libs\) *=.*;\1='-L%{l_prefix}/lib\ -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}\ -liberty';" \
   1.140 +       $RPM_BUILD_ROOT%{l_prefix}/libexec/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la
   1.141  
   1.142      #   strip installation tree
   1.143      rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}

mercurial