# HG changeset patch # User Michael Schloh von Bennewitz # Date 1301334062 -7200 # Node ID 2289d64c212302940c9b57c6f1c44cbd520781cd # Parent 44acfa481149cb6a993f8936b4ab45c353037330 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. diff -r 44acfa481149 -r 2289d64c2123 gcc/gcc.patch --- a/gcc/gcc.patch Sat Mar 26 17:31:59 2011 +0100 +++ b/gcc/gcc.patch Mon Mar 28 19:41:02 2011 +0200 @@ -1,6 +1,7 @@ Index: config.guess ---- config.guess.orig 2010-03-23 15:26:40.000000000 +0100 -+++ config.guess 2010-08-01 23:35:02.000000000 +0200 +diff -Nau config.guess.orig config.guess +--- config.guess.orig 2011-03-21 16:02:29.000000000 +0100 ++++ config.guess 2011-03-27 18:06:45.404612233 +0200 @@ -194,7 +194,7 @@ release='-gnu' ;; @@ -10,10 +11,11 @@ ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: -Index: gcc/config/alpha/osf.h ---- gcc/config/alpha/osf.h.orig 2010-04-28 18:26:24.000000000 +0200 -+++ gcc/config/alpha/osf.h 2010-08-01 23:35:02.000000000 +0200 -@@ -77,7 +77,7 @@ +Index: gcc/config/alpha/osf5.h +diff -Nau gcc/config/alpha/osf5.h.orig gcc/config/alpha/osf5.h +--- gcc/config/alpha/osf5.h.orig 2010-11-21 01:54:14.000000000 +0100 ++++ gcc/config/alpha/osf5.h 2011-03-27 18:06:45.432326155 +0200 +@@ -94,7 +94,7 @@ constructor and call-frame data structures are not accidentally overridden. */ #define LINK_SPEC \ @@ -23,9 +25,10 @@ %{!shared:-call_shared}} %{pg} %{taso} %{rpath*}" Index: gcc/config/i386/sol2-10.h ---- gcc/config/i386/sol2-10.h.orig 2010-07-14 10:47:54.000000000 +0200 -+++ gcc/config/i386/sol2-10.h 2010-08-01 23:37:46.000000000 +0200 -@@ -114,7 +114,7 @@ +diff -Nau gcc/config/i386/sol2-10.h.orig gcc/config/i386/sol2-10.h +--- gcc/config/i386/sol2-10.h.orig 2011-01-26 21:23:17.000000000 +0100 ++++ gcc/config/i386/sol2-10.h 2011-03-27 18:06:45.455032224 +0200 +@@ -105,7 +105,7 @@ -R /usr/ucblib/64} \ %{!compat-bsd: \ %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64:/lib/64:/usr/lib/64} \ @@ -34,7 +37,7 @@ #undef LINK_ARCH64_SPEC #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE -@@ -131,7 +131,7 @@ +@@ -122,7 +122,7 @@ #endif #define TARGET_LD_EMULATION "%{m64:-m " X86_64_EMULATION "}" \ @@ -44,9 +47,10 @@ #define TARGET_LD_EMULATION "" #endif Index: gcc/config/i386/sol2.h ---- gcc/config/i386/sol2.h.orig 2010-07-14 10:47:54.000000000 +0200 -+++ gcc/config/i386/sol2.h 2010-08-01 23:35:02.000000000 +0200 -@@ -76,6 +76,9 @@ +diff -Nau gcc/config/i386/sol2.h.orig gcc/config/i386/sol2.h +--- gcc/config/i386/sol2.h.orig 2011-02-02 17:58:49.000000000 +0100 ++++ gcc/config/i386/sol2.h 2011-03-27 18:06:45.458713885 +0200 +@@ -73,6 +73,9 @@ #undef ASM_QUAD #endif @@ -57,10 +61,11 @@ #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \ do { \ Index: gcc/config/sol2.h ---- gcc/config/sol2.h.orig 2010-04-16 15:33:58.000000000 +0200 -+++ gcc/config/sol2.h 2010-08-01 23:35:02.000000000 +0200 -@@ -176,8 +176,8 @@ - %{b} \ +diff -Nau gcc/config/sol2.h.orig gcc/config/sol2.h +--- gcc/config/sol2.h.orig 2011-01-26 21:23:17.000000000 +0100 ++++ gcc/config/sol2.h 2011-03-27 18:06:45.477952967 +0200 +@@ -183,8 +183,8 @@ + "%{h*} %{v:-V} \ %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \ %{static:-dn -Bstatic} \ - %{shared:-G -dy %{!mimpure-text:-z text}} \ @@ -71,9 +76,10 @@ %{Qy:} %{!Qn:-Qy}" Index: gcc/system.h ---- gcc/system.h.orig 2009-12-14 00:00:53.000000000 +0100 -+++ gcc/system.h 2010-08-01 23:35:02.000000000 +0200 -@@ -398,10 +398,6 @@ +diff -Nau gcc/system.h.orig gcc/system.h +--- gcc/system.h.orig 2011-01-09 13:41:33.000000000 +0100 ++++ gcc/system.h 2011-03-27 18:06:45.498233251 +0200 +@@ -430,10 +430,6 @@ extern char *strstr (const char *, const char *); #endif @@ -85,8 +91,9 @@ extern void *malloc (size_t); #endif Index: libcpp/charset.c ---- libcpp/charset.c.orig 2010-03-29 22:07:29.000000000 +0200 -+++ libcpp/charset.c 2010-08-01 23:35:02.000000000 +0200 +diff -Nau libcpp/charset.c.orig libcpp/charset.c +--- libcpp/charset.c.orig 2011-01-03 21:52:22.000000000 +0100 ++++ libcpp/charset.c 2011-03-27 18:06:45.522800310 +0200 @@ -75,6 +75,7 @@ #define iconv_open(x, y) (errno = EINVAL, (iconv_t)-1) #define iconv(a,b,c,d,e) (errno = EINVAL, (size_t)-1) @@ -96,8 +103,9 @@ #endif Index: libcpp/internal.h ---- libcpp/internal.h.orig 2010-03-29 22:07:29.000000000 +0200 -+++ libcpp/internal.h 2010-08-01 23:35:02.000000000 +0200 +diff -Nau libcpp/internal.h.orig libcpp/internal.h +--- libcpp/internal.h.orig 2010-09-29 20:18:38.000000000 +0200 ++++ libcpp/internal.h 2011-03-27 18:06:45.537431542 +0200 @@ -29,6 +29,7 @@ #if HAVE_ICONV #include diff -r 44acfa481149 -r 2289d64c2123 gcc/gcc.spec --- a/gcc/gcc.spec Sat Mar 26 17:31:59 2011 +0100 +++ b/gcc/gcc.spec Mon Mar 28 19:41:02 2011 +0200 @@ -22,7 +22,7 @@ ## # package version -%define V_full 4.5.2 +%define V_full 4.6.0 %define V_comp %nil # package information @@ -60,14 +60,14 @@ # build information Prefix: %{l_prefix} BuildRoot: %{l_buildroot} -BuildPreReq: OpenPKG, openpkg >= 20060823, make, libtool +BuildPreReq: OpenPKG, openpkg >= 20060823, make PreReq: OpenPKG, openpkg >= 20060823 +BuildPreReq: mpc, mpfr, gmp +PreReq: mpc, mpfr, gmp %if "%{with_binutils}" == "yes" BuildPreReq: binutils >= 2.14 PreReq: binutils >= 2.14 %endif -BuildPreReq: mpc, mpfr, gmp -PreReq: mpc, mpfr, gmp %if "%{with_cxx}" == "yes" BuildPreReq: libiconv PreReq: libiconv @@ -108,12 +108,24 @@ %setup -q -T -D -b 4 %endif %patch -p0 + %{l_shtool} subst \ + -e 's;\(instname="\$dir/\$name"\)i;\1;' \ + ltmain.sh %{l_shtool} subst -v -s \ -e 's;\(gmplibs="-lmpc\) \(-lmpfr -lgmp\);\1 -lm \2;' \ configure %{l_shtool} subst -v -s \ -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \ gcc/configure + %{l_shtool} subst \ + -e 's;[ \t]*-W[a-zA-Z0-9_\-][a-zA-Z0-9_\-]*,*;;g' \ + lto-plugin/Makefile.in + %{l_shtool} subst \ + -e 's;-rpath *[^ \t][^ \t]*;;g' \ + -e 's;--tag=disable-static;--tag=disable-shared;g' \ + -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 [ ".%{V_comp}" != . ]; then %{l_shtool} subst -v -s \ -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ @@ -181,6 +193,11 @@ echo "am_cv_lib_iconv=no" ) >config.cache + # platform specific config logic + case "%{l_platform -t}" in + *i?86-sunos* ) echo "gcc_cv_prog_cmp_skip=true" >>config.cache;; + esac + # configure the package LD="$LD" \ AS="$AS" \ @@ -191,6 +208,7 @@ LDFLAGS="%{l_ldflags}" \ %endif CONFIG_SHELL="%{l_bash}" \ + GREP="%{l_bash}" \ ../configure \ --with-bugurl="http://openpkg.org/" \ --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \ @@ -236,26 +254,41 @@ l_libcflags="-g" l_libcxxflags="-g" # at least GNU as from GNU binutils supports -pipe always - "$AS" --version /dev/null | grep "^GNU assembler " >/dev/null && { + "$AS" --version /dev/null | grep "^GNU assembler" >/dev/null && { l_boot_cflags="$l_boot_cflags -pipe" l_libcxxflags="$l_libcxxflags -pipe" } %if "%{with_optimize}" == "yes" - # conservatively optimize the generated program code - # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!) + if [ ".$l_ccisgcc" = .yes ]; then + l_ia32=native + else + l_ia32=pentium3 + fi + case "%{l_platform -t}" in + *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=$l_ia32" ;; + *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; + esac + l_cflags="$l_cflags -O" + l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" + l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" +%else +%if "%{with_optimize}" == "port" + # conservatively optimize the generated program code for portable use, + # also _tune_ for particular CPUs, but _without_ requiring these CPUs! + case "%{l_platform -t}" in + *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; + *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; + esac l_cflags="$l_cflags -O" l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer" - case "%{l_platform -t}" in - *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;; - *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; - esac l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates" %else - # else do no optimizations at all to reduce problems to minimum in advance + # do not optimize at all to avoid problems l_boot_cflags="$l_boot_cflags -O0" l_libcxxflags="$l_libcxxflags -O0" %endif - maketarget="bootstrap2-lean" +%endif + maketarget="bootstrap" %if "%{with_profile}" == "yes" # GCC >= 3.4 supports a "profiledbootstrap" target to build an # optimized version of itself through profiling. Because this @@ -264,12 +297,15 @@ # building with GCC as the bootstrapping C compiler. if [ ".$l_ccisgcc" = .yes ]; then maketarget="profiledbootstrap" + else + ( echo "Building a profiled GCC requires GCC. Please install GCC" + echo "first and then build again with the profile option enabled." + ) | %{l_rpmtool} msg -b -t error + exit 1 fi %endif case "%{l_platform -t}" in - amd64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; - ia64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; - sparc64-freebsd* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; + *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; esac %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" l_cflags="$l_cflags %{l_cppflags}" @@ -279,9 +315,10 @@ %endif # build the package - MAKE="%{l_make} %{l_mflags}" \ - %{l_make} %{l_mflags} \ - MAKE="%{l_make} %{l_mflags}" \ + MAKE="%{l_make} %{l_mflags -O}" \ + %{l_make} %{l_mflags -O} \ + GREP="grep" \ + MAKE="%{l_make} %{l_mflags -O}" \ BOOT_CFLAGS="${l_boot_cflags}" \ CFLAGS="${l_cflags}" \ CXXFLAGS="${l_cxxflags}" \ @@ -326,6 +363,11 @@ $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \ >/dev/null 2>&1 || true + # 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 + # strip installation tree rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir