Mon, 28 Mar 2011 19:41:02 +0200
Completely rework package including...
Simpify 64-bit -fPIC logic, instruct make to build in parallel,
force error condition on failed profile dependency, build the
standard 'bootstrap' target as suggested, correct grammar, wording,
and punctuation in general, upgrade to latest upstream vendor version,
rearrange package dependencies mpc, mpfr, and gmp, correct buildconf
thanks to new lto-plugin forced, avoid failed platform specific stage
comparison, adjust patch code to reflect new version update, and most
importantly adjust optimization flags to platform. Please note that
block 'correct hardcoded paths' is likely no yet complete.
gcc/gcc.patch | file | annotate | diff | comparison | revisions | |
gcc/gcc.spec | file | annotate | diff | comparison | revisions |
1.1 --- a/gcc/gcc.patch Sat Mar 26 17:31:59 2011 +0100 1.2 +++ b/gcc/gcc.patch Mon Mar 28 19:41:02 2011 +0200 1.3 @@ -1,6 +1,7 @@ 1.4 Index: config.guess 1.5 ---- config.guess.orig 2010-03-23 15:26:40.000000000 +0100 1.6 -+++ config.guess 2010-08-01 23:35:02.000000000 +0200 1.7 +diff -Nau config.guess.orig config.guess 1.8 +--- config.guess.orig 2011-03-21 16:02:29.000000000 +0100 1.9 ++++ config.guess 2011-03-27 18:06:45.404612233 +0200 1.10 @@ -194,7 +194,7 @@ 1.11 release='-gnu' 1.12 ;; 1.13 @@ -10,10 +11,11 @@ 1.14 ;; 1.15 esac 1.16 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: 1.17 -Index: gcc/config/alpha/osf.h 1.18 ---- gcc/config/alpha/osf.h.orig 2010-04-28 18:26:24.000000000 +0200 1.19 -+++ gcc/config/alpha/osf.h 2010-08-01 23:35:02.000000000 +0200 1.20 -@@ -77,7 +77,7 @@ 1.21 +Index: gcc/config/alpha/osf5.h 1.22 +diff -Nau gcc/config/alpha/osf5.h.orig gcc/config/alpha/osf5.h 1.23 +--- gcc/config/alpha/osf5.h.orig 2010-11-21 01:54:14.000000000 +0100 1.24 ++++ gcc/config/alpha/osf5.h 2011-03-27 18:06:45.432326155 +0200 1.25 +@@ -94,7 +94,7 @@ 1.26 constructor and call-frame data structures are not accidentally 1.27 overridden. */ 1.28 #define LINK_SPEC \ 1.29 @@ -23,9 +25,10 @@ 1.30 %{!shared:-call_shared}} %{pg} %{taso} %{rpath*}" 1.31 1.32 Index: gcc/config/i386/sol2-10.h 1.33 ---- gcc/config/i386/sol2-10.h.orig 2010-07-14 10:47:54.000000000 +0200 1.34 -+++ gcc/config/i386/sol2-10.h 2010-08-01 23:37:46.000000000 +0200 1.35 -@@ -114,7 +114,7 @@ 1.36 +diff -Nau gcc/config/i386/sol2-10.h.orig gcc/config/i386/sol2-10.h 1.37 +--- gcc/config/i386/sol2-10.h.orig 2011-01-26 21:23:17.000000000 +0100 1.38 ++++ gcc/config/i386/sol2-10.h 2011-03-27 18:06:45.455032224 +0200 1.39 +@@ -105,7 +105,7 @@ 1.40 -R /usr/ucblib/64} \ 1.41 %{!compat-bsd: \ 1.42 %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64:/lib/64:/usr/lib/64} \ 1.43 @@ -34,7 +37,7 @@ 1.44 1.45 #undef LINK_ARCH64_SPEC 1.46 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE 1.47 -@@ -131,7 +131,7 @@ 1.48 +@@ -122,7 +122,7 @@ 1.49 #endif 1.50 1.51 #define TARGET_LD_EMULATION "%{m64:-m " X86_64_EMULATION "}" \ 1.52 @@ -44,9 +47,10 @@ 1.53 #define TARGET_LD_EMULATION "" 1.54 #endif 1.55 Index: gcc/config/i386/sol2.h 1.56 ---- gcc/config/i386/sol2.h.orig 2010-07-14 10:47:54.000000000 +0200 1.57 -+++ gcc/config/i386/sol2.h 2010-08-01 23:35:02.000000000 +0200 1.58 -@@ -76,6 +76,9 @@ 1.59 +diff -Nau gcc/config/i386/sol2.h.orig gcc/config/i386/sol2.h 1.60 +--- gcc/config/i386/sol2.h.orig 2011-02-02 17:58:49.000000000 +0100 1.61 ++++ gcc/config/i386/sol2.h 2011-03-27 18:06:45.458713885 +0200 1.62 +@@ -73,6 +73,9 @@ 1.63 #undef ASM_QUAD 1.64 #endif 1.65 1.66 @@ -57,10 +61,11 @@ 1.67 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \ 1.68 do { \ 1.69 Index: gcc/config/sol2.h 1.70 ---- gcc/config/sol2.h.orig 2010-04-16 15:33:58.000000000 +0200 1.71 -+++ gcc/config/sol2.h 2010-08-01 23:35:02.000000000 +0200 1.72 -@@ -176,8 +176,8 @@ 1.73 - %{b} \ 1.74 +diff -Nau gcc/config/sol2.h.orig gcc/config/sol2.h 1.75 +--- gcc/config/sol2.h.orig 2011-01-26 21:23:17.000000000 +0100 1.76 ++++ gcc/config/sol2.h 2011-03-27 18:06:45.477952967 +0200 1.77 +@@ -183,8 +183,8 @@ 1.78 + "%{h*} %{v:-V} \ 1.79 %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \ 1.80 %{static:-dn -Bstatic} \ 1.81 - %{shared:-G -dy %{!mimpure-text:-z text}} \ 1.82 @@ -71,9 +76,10 @@ 1.83 %{Qy:} %{!Qn:-Qy}" 1.84 1.85 Index: gcc/system.h 1.86 ---- gcc/system.h.orig 2009-12-14 00:00:53.000000000 +0100 1.87 -+++ gcc/system.h 2010-08-01 23:35:02.000000000 +0200 1.88 -@@ -398,10 +398,6 @@ 1.89 +diff -Nau gcc/system.h.orig gcc/system.h 1.90 +--- gcc/system.h.orig 2011-01-09 13:41:33.000000000 +0100 1.91 ++++ gcc/system.h 2011-03-27 18:06:45.498233251 +0200 1.92 +@@ -430,10 +430,6 @@ 1.93 extern char *strstr (const char *, const char *); 1.94 #endif 1.95 1.96 @@ -85,8 +91,9 @@ 1.97 extern void *malloc (size_t); 1.98 #endif 1.99 Index: libcpp/charset.c 1.100 ---- libcpp/charset.c.orig 2010-03-29 22:07:29.000000000 +0200 1.101 -+++ libcpp/charset.c 2010-08-01 23:35:02.000000000 +0200 1.102 +diff -Nau libcpp/charset.c.orig libcpp/charset.c 1.103 +--- libcpp/charset.c.orig 2011-01-03 21:52:22.000000000 +0100 1.104 ++++ libcpp/charset.c 2011-03-27 18:06:45.522800310 +0200 1.105 @@ -75,6 +75,7 @@ 1.106 #define iconv_open(x, y) (errno = EINVAL, (iconv_t)-1) 1.107 #define iconv(a,b,c,d,e) (errno = EINVAL, (size_t)-1) 1.108 @@ -96,8 +103,9 @@ 1.109 #endif 1.110 1.111 Index: libcpp/internal.h 1.112 ---- libcpp/internal.h.orig 2010-03-29 22:07:29.000000000 +0200 1.113 -+++ libcpp/internal.h 2010-08-01 23:35:02.000000000 +0200 1.114 +diff -Nau libcpp/internal.h.orig libcpp/internal.h 1.115 +--- libcpp/internal.h.orig 2010-09-29 20:18:38.000000000 +0200 1.116 ++++ libcpp/internal.h 2011-03-27 18:06:45.537431542 +0200 1.117 @@ -29,6 +29,7 @@ 1.118 #if HAVE_ICONV 1.119 #include <iconv.h>
2.1 --- a/gcc/gcc.spec Sat Mar 26 17:31:59 2011 +0100 2.2 +++ b/gcc/gcc.spec Mon Mar 28 19:41:02 2011 +0200 2.3 @@ -22,7 +22,7 @@ 2.4 ## 2.5 2.6 # package version 2.7 -%define V_full 4.5.2 2.8 +%define V_full 4.6.0 2.9 %define V_comp %nil 2.10 2.11 # package information 2.12 @@ -60,14 +60,14 @@ 2.13 # build information 2.14 Prefix: %{l_prefix} 2.15 BuildRoot: %{l_buildroot} 2.16 -BuildPreReq: OpenPKG, openpkg >= 20060823, make, libtool 2.17 +BuildPreReq: OpenPKG, openpkg >= 20060823, make 2.18 PreReq: OpenPKG, openpkg >= 20060823 2.19 +BuildPreReq: mpc, mpfr, gmp 2.20 +PreReq: mpc, mpfr, gmp 2.21 %if "%{with_binutils}" == "yes" 2.22 BuildPreReq: binutils >= 2.14 2.23 PreReq: binutils >= 2.14 2.24 %endif 2.25 -BuildPreReq: mpc, mpfr, gmp 2.26 -PreReq: mpc, mpfr, gmp 2.27 %if "%{with_cxx}" == "yes" 2.28 BuildPreReq: libiconv 2.29 PreReq: libiconv 2.30 @@ -108,12 +108,24 @@ 2.31 %setup -q -T -D -b 4 2.32 %endif 2.33 %patch -p0 2.34 + %{l_shtool} subst \ 2.35 + -e 's;\(instname="\$dir/\$name"\)i;\1;' \ 2.36 + ltmain.sh 2.37 %{l_shtool} subst -v -s \ 2.38 -e 's;\(gmplibs="-lmpc\) \(-lmpfr -lgmp\);\1 -lm \2;' \ 2.39 configure 2.40 %{l_shtool} subst -v -s \ 2.41 -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \ 2.42 gcc/configure 2.43 + %{l_shtool} subst \ 2.44 + -e 's;[ \t]*-W[a-zA-Z0-9_\-][a-zA-Z0-9_\-]*,*;;g' \ 2.45 + lto-plugin/Makefile.in 2.46 + %{l_shtool} subst \ 2.47 + -e 's;-rpath *[^ \t][^ \t]*;;g' \ 2.48 + -e 's;--tag=disable-static;--tag=disable-shared;g' \ 2.49 + -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \ 2.50 + -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \ 2.51 + lto-plugin/Makefile.in 2.52 if [ ".%{V_comp}" != . ]; then 2.53 %{l_shtool} subst -v -s \ 2.54 -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ 2.55 @@ -181,6 +193,11 @@ 2.56 echo "am_cv_lib_iconv=no" 2.57 ) >config.cache 2.58 2.59 + # platform specific config logic 2.60 + case "%{l_platform -t}" in 2.61 + *i?86-sunos* ) echo "gcc_cv_prog_cmp_skip=true" >>config.cache;; 2.62 + esac 2.63 + 2.64 # configure the package 2.65 LD="$LD" \ 2.66 AS="$AS" \ 2.67 @@ -191,6 +208,7 @@ 2.68 LDFLAGS="%{l_ldflags}" \ 2.69 %endif 2.70 CONFIG_SHELL="%{l_bash}" \ 2.71 + GREP="%{l_bash}" \ 2.72 ../configure \ 2.73 --with-bugurl="http://openpkg.org/" \ 2.74 --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \ 2.75 @@ -236,26 +254,41 @@ 2.76 l_libcflags="-g" 2.77 l_libcxxflags="-g" 2.78 # at least GNU as from GNU binutils supports -pipe always 2.79 - "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && { 2.80 + "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && { 2.81 l_boot_cflags="$l_boot_cflags -pipe" 2.82 l_libcxxflags="$l_libcxxflags -pipe" 2.83 } 2.84 %if "%{with_optimize}" == "yes" 2.85 - # conservatively optimize the generated program code 2.86 - # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!) 2.87 + if [ ".$l_ccisgcc" = .yes ]; then 2.88 + l_ia32=native 2.89 + else 2.90 + l_ia32=pentium3 2.91 + fi 2.92 + case "%{l_platform -t}" in 2.93 + *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=$l_ia32" ;; 2.94 + *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; 2.95 + esac 2.96 + l_cflags="$l_cflags -O" 2.97 + l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" 2.98 + l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" 2.99 +%else 2.100 +%if "%{with_optimize}" == "port" 2.101 + # conservatively optimize the generated program code for portable use, 2.102 + # also _tune_ for particular CPUs, but _without_ requiring these CPUs! 2.103 + case "%{l_platform -t}" in 2.104 + *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; 2.105 + *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; 2.106 + esac 2.107 l_cflags="$l_cflags -O" 2.108 l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer" 2.109 - case "%{l_platform -t}" in 2.110 - *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;; 2.111 - *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; 2.112 - esac 2.113 l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates" 2.114 %else 2.115 - # else do no optimizations at all to reduce problems to minimum in advance 2.116 + # do not optimize at all to avoid problems 2.117 l_boot_cflags="$l_boot_cflags -O0" 2.118 l_libcxxflags="$l_libcxxflags -O0" 2.119 %endif 2.120 - maketarget="bootstrap2-lean" 2.121 +%endif 2.122 + maketarget="bootstrap" 2.123 %if "%{with_profile}" == "yes" 2.124 # GCC >= 3.4 supports a "profiledbootstrap" target to build an 2.125 # optimized version of itself through profiling. Because this 2.126 @@ -264,12 +297,15 @@ 2.127 # building with GCC as the bootstrapping C compiler. 2.128 if [ ".$l_ccisgcc" = .yes ]; then 2.129 maketarget="profiledbootstrap" 2.130 + else 2.131 + ( echo "Building a profiled GCC requires GCC. Please install GCC" 2.132 + echo "first and then build again with the profile option enabled." 2.133 + ) | %{l_rpmtool} msg -b -t error 2.134 + exit 1 2.135 fi 2.136 %endif 2.137 case "%{l_platform -t}" in 2.138 - amd64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; 2.139 - ia64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; 2.140 - sparc64-freebsd* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; 2.141 + *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; 2.142 esac 2.143 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" 2.144 l_cflags="$l_cflags %{l_cppflags}" 2.145 @@ -279,9 +315,10 @@ 2.146 %endif 2.147 2.148 # build the package 2.149 - MAKE="%{l_make} %{l_mflags}" \ 2.150 - %{l_make} %{l_mflags} \ 2.151 - MAKE="%{l_make} %{l_mflags}" \ 2.152 + MAKE="%{l_make} %{l_mflags -O}" \ 2.153 + %{l_make} %{l_mflags -O} \ 2.154 + GREP="grep" \ 2.155 + MAKE="%{l_make} %{l_mflags -O}" \ 2.156 BOOT_CFLAGS="${l_boot_cflags}" \ 2.157 CFLAGS="${l_cflags}" \ 2.158 CXXFLAGS="${l_cxxflags}" \ 2.159 @@ -326,6 +363,11 @@ 2.160 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \ 2.161 >/dev/null 2>&1 || true 2.162 2.163 + # correct hardcoded paths 2.164 + %{l_shtool} subst \ 2.165 + -e "s;\(dependency_libs='[ \t]*-L\).*;\1%{l_prefix}/lib -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]* -liberty';" \ 2.166 + $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la 2.167 + 2.168 # strip installation tree 2.169 rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} 2.170 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir