summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2003-01-18 05:21:02 +0000
committerMartin Schlemmer <azarah@gentoo.org>2003-01-18 05:21:02 +0000
commitce5a6337e0b8b9e9ad9dafdae3db965227c314ed (patch)
tree6a092d06fc5571526dfca3e871c49f938cfe5b11 /sys-devel
parentmove dfb.c to a patch and add a small patch for 0.7 (diff)
downloadhistorical-ce5a6337e0b8b9e9ad9dafdae3db965227c314ed.tar.gz
historical-ce5a6337e0b8b9e9ad9dafdae3db965227c314ed.tar.bz2
historical-ce5a6337e0b8b9e9ad9dafdae3db965227c314ed.zip
add some patches
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/gcc/ChangeLog7
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc31-loop-load-final-value.patch79
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc32-athlon-alignment.patch11
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc32-fix-sixtrack.patch52
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc32-libjava-x86_64-biarch-sigaction.patch11
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc32-pr8213.patch69
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc32-pr8988.patch69
-rw-r--r--sys-devel/gcc/files/3.2.1/gcc32-strip-dotdot.patch84
-rw-r--r--sys-devel/gcc/files/digest-gcc-3.2.1-r73
-rw-r--r--sys-devel/gcc/gcc-3.2.1-r7.ebuild506
10 files changed, 890 insertions, 1 deletions
diff --git a/sys-devel/gcc/ChangeLog b/sys-devel/gcc/ChangeLog
index 750b69e880f8..ab2a30a44e2a 100644
--- a/sys-devel/gcc/ChangeLog
+++ b/sys-devel/gcc/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for sys-devel/gcc
# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/ChangeLog,v 1.58 2003/01/09 00:53:50 seemant Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/ChangeLog,v 1.59 2003/01/18 05:21:02 azarah Exp $
+
+*gcc-3.2.1-r7 (18 Jan 2003)
+
+ 18 Jan 2003; Martin Schlemmer <azarah@gentoo.org> gcc-3.2.1-r7.ebuild :
+ Add some patches from Mandrake/Suse.
*gcc-3.2.1-r6 (16 Dec 2002)
diff --git a/sys-devel/gcc/files/3.2.1/gcc31-loop-load-final-value.patch b/sys-devel/gcc/files/3.2.1/gcc31-loop-load-final-value.patch
new file mode 100644
index 000000000000..525262c43f41
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc31-loop-load-final-value.patch
@@ -0,0 +1,79 @@
+2002-04-22 Jan Hubicka <jh@suse.cz>
+
+ * loop.c (gen_load_of_final_value): New.
+ (loop_givs_rescan, strength_reduce, check_dbra_loop): Use it.
+
+--- gcc-3.1-20020515/gcc/loop.c.loop-load-final-value 2002-05-17 00:15:52.000000000 +0200
++++ gcc-3.1-20020515/gcc/loop.c 2002-05-17 00:32:20.000000000 +0200
+@@ -354,6 +354,7 @@ static rtx loop_insn_sink_or_swim PARAMS
+ static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int));
+ static void loop_delete_insns PARAMS ((rtx, rtx));
+ static HOST_WIDE_INT remove_constant_addition PARAMS ((rtx *));
++static rtx gen_load_of_final_value PARAMS ((rtx, rtx));
+ void debug_ivs PARAMS ((const struct loop *));
+ void debug_iv_class PARAMS ((const struct iv_class *));
+ void debug_biv PARAMS ((const struct induction *));
+@@ -4797,7 +4798,8 @@ loop_givs_rescan (loop, bl, reg_map)
+ v->mult_val, v->add_val, v->dest_reg);
+ else if (v->final_value)
+ loop_insn_sink_or_swim (loop,
+- gen_move_insn (v->dest_reg, v->final_value));
++ gen_load_of_final_value (v->dest_reg,
++ v->final_value));
+
+ if (loop_dump_stream)
+ {
+@@ -5154,8 +5156,9 @@ strength_reduce (loop, flags)
+ value, so we don't need another one. We can't calculate the
+ proper final value for such a biv here anyways. */
+ if (bl->final_value && ! bl->reversed)
+- loop_insn_sink_or_swim (loop, gen_move_insn
+- (bl->biv->dest_reg, bl->final_value));
++ loop_insn_sink_or_swim (loop,
++ gen_load_of_final_value (bl->biv->dest_reg,
++ bl->final_value));
+
+ if (loop_dump_stream)
+ fprintf (loop_dump_stream, "Reg %d: biv eliminated\n",
+@@ -5164,8 +5167,8 @@ strength_reduce (loop, flags)
+ /* See above note wrt final_value. But since we couldn't eliminate
+ the biv, we must set the value after the loop instead of before. */
+ else if (bl->final_value && ! bl->reversed)
+- loop_insn_sink (loop, gen_move_insn (bl->biv->dest_reg,
+- bl->final_value));
++ loop_insn_sink (loop, gen_load_of_final_value (bl->biv->dest_reg,
++ bl->final_value));
+ }
+
+ /* Go through all the instructions in the loop, making all the
+@@ -8360,7 +8363,7 @@ check_dbra_loop (loop, insn_count)
+ if ((REGNO_LAST_UID (bl->regno) != INSN_UID (first_compare))
+ || ! bl->init_insn
+ || REGNO_FIRST_UID (bl->regno) != INSN_UID (bl->init_insn))
+- loop_insn_sink (loop, gen_move_insn (reg, final_value));
++ loop_insn_sink (loop, gen_load_of_final_value (reg, final_value));
+
+ /* Delete compare/branch at end of loop. */
+ delete_related_insns (PREV_INSN (loop_end));
+@@ -10355,6 +10358,21 @@ loop_insn_sink (loop, pattern)
+ return loop_insn_emit_before (loop, 0, loop->sink, pattern);
+ }
+
++/* bl->final_value can be eighter general_operand or PLUS of general_operand
++ and constant. Emit sequence of intructions to load it into REG */
++static rtx
++gen_load_of_final_value (reg, final_value)
++ rtx reg, final_value;
++{
++ rtx seq;
++ start_sequence ();
++ final_value = force_operand (final_value, reg);
++ if (final_value != reg)
++ emit_move_insn (reg, final_value);
++ seq = gen_sequence ();
++ end_sequence ();
++ return seq;
++}
+
+ /* If the loop has multiple exits, emit insn for PATTERN before the
+ loop to ensure that it will always be executed no matter how the
diff --git a/sys-devel/gcc/files/3.2.1/gcc32-athlon-alignment.patch b/sys-devel/gcc/files/3.2.1/gcc32-athlon-alignment.patch
new file mode 100644
index 000000000000..0019eee6ae45
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc32-athlon-alignment.patch
@@ -0,0 +1,11 @@
+--- gcc-3.2/gcc/config/i386/i386.c.athlon-alignment 2002-09-20 13:58:03.000000000 +0200
++++ gcc-3.2/gcc/config/i386/i386.c 2002-09-20 14:03:59.000000000 +0200
+@@ -857,7 +857,7 @@ override_options ()
+ {&pentium_cost, 0, 0, 16, 7, 16, 7, 16, 1},
+ {&pentiumpro_cost, 0, 0, 16, 15, 16, 7, 16, 1},
+ {&k6_cost, 0, 0, 32, 7, 32, 7, 32, 1},
+- {&athlon_cost, 0, 0, 16, 7, 64, 7, 16, 1},
++ {&athlon_cost, 0, 0, 16, 7, 16, 7, 16, 1},
+ {&pentium4_cost, 0, 0, 0, 0, 0, 0, 0, 1}
+ };
+
diff --git a/sys-devel/gcc/files/3.2.1/gcc32-fix-sixtrack.patch b/sys-devel/gcc/files/3.2.1/gcc32-fix-sixtrack.patch
new file mode 100644
index 000000000000..4a4338fcaaa3
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc32-fix-sixtrack.patch
@@ -0,0 +1,52 @@
+--- gcc-3.2/gcc/loop.c.fix-sixtrack 2002-09-20 14:56:57.000000000 +0200
++++ gcc-3.2/gcc/loop.c 2002-09-20 15:30:57.000000000 +0200
+@@ -4661,7 +4661,7 @@ loop_givs_reduce (loop, bl)
+ rtx insert_before;
+
+ if (! auto_inc_opt)
+- insert_before = tv->insn;
++ insert_before = NEXT_INSN (tv->insn);
+ else if (auto_inc_opt == 1)
+ insert_before = NEXT_INSN (v->insn);
+ else
+--- gcc-3.2/gcc/emit-rtl.c.fix-sixtrack 2002-09-20 14:56:56.000000000 +0200
++++ gcc-3.2/gcc/emit-rtl.c 2002-09-20 15:30:57.000000000 +0200
+@@ -1829,11 +1829,36 @@ set_mem_attributes (ref, t, objectp)
+
+ do
+ {
++ tree index = TREE_OPERAND (t, 1);
++ tree array = TREE_OPERAND (t, 0);
++ tree domain = TYPE_DOMAIN (TREE_TYPE (array));
++ tree low_bound = (domain ? TYPE_MIN_VALUE (domain) : 0);
++ tree unit_size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (array)));
++
++ /* We assume all arrays have sizes that are a multiple of a byte.
++ First subtract the lower bound, if any, in the type of the
++ index, then convert to sizetype and multiply by the size of the
++ array element. */
++ if (low_bound != 0 && ! integer_zerop (low_bound))
++ index = fold (build (MINUS_EXPR, TREE_TYPE (index),
++ index, low_bound));
++
++ /* If the index has a self-referential type, pass it to a
++ WITH_RECORD_EXPR; if the component size is, pass our
++ component to one. */
++ if (! TREE_CONSTANT (index)
++ && contains_placeholder_p (index))
++ index = build (WITH_RECORD_EXPR, TREE_TYPE (index), index, t);
++ if (! TREE_CONSTANT (unit_size)
++ && contains_placeholder_p (unit_size))
++ unit_size = build (WITH_RECORD_EXPR, sizetype,
++ unit_size, array);
++
+ off_tree
+ = fold (build (PLUS_EXPR, sizetype,
+ fold (build (MULT_EXPR, sizetype,
+- TREE_OPERAND (t, 1),
+- TYPE_SIZE_UNIT (TREE_TYPE (t)))),
++ index,
++ unit_size)),
+ off_tree));
+ t = TREE_OPERAND (t, 0);
+ }
diff --git a/sys-devel/gcc/files/3.2.1/gcc32-libjava-x86_64-biarch-sigaction.patch b/sys-devel/gcc/files/3.2.1/gcc32-libjava-x86_64-biarch-sigaction.patch
new file mode 100644
index 000000000000..016aa11d4494
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc32-libjava-x86_64-biarch-sigaction.patch
@@ -0,0 +1,11 @@
+--- gcc-3.2/libjava/include/dwarf2-signal.h.libjava-x86_64-biarch-sigaction 2002-09-20 12:08:46.000000000 -0400
++++ gcc-3.2/libjava/include/dwarf2-signal.h 2002-09-20 13:30:07.000000000 -0400
+@@ -209,7 +209,7 @@ do \
+ while (0)
+ #endif
+ #elif !defined(__ia64__)
+-#if defined(__x86_64__)
++#if defined(__x86_64__) || (defined(__i386__) && !defined(SYS_sigaction))
+ #define SYS_sigaction SYS_rt_sigaction
+ #endif
+ #define INIT_SEGV \
diff --git a/sys-devel/gcc/files/3.2.1/gcc32-pr8213.patch b/sys-devel/gcc/files/3.2.1/gcc32-pr8213.patch
new file mode 100644
index 000000000000..762d198f4cfd
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc32-pr8213.patch
@@ -0,0 +1,69 @@
+2002-10-30 Jan Hubicka <jh@suse.cz>
+
+ PR target/8213
+ * config/i386/i386.c (ix86_expand_int_movcc): Fix RTL sharing problem.
+
+2002-11-04 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
+
+ * testsuite/gcc.c-torture/execute/20021104.c: New test.
+
+--- gcc-3.2/gcc/config/i386/i386.c.pr8213 2002-11-04 12:56:37.000000000 -0500
++++ gcc-3.2/gcc/config/i386/i386.c 2002-11-04 13:21:22.000000000 -0500
+@@ -8274,11 +8274,11 @@ ix86_expand_int_movcc (operands)
+ /* On x86_64 the lea instruction operates on Pmode, so we need to get arithmetics
+ done in proper mode to match. */
+ if (diff == 1)
+- tmp = out;
++ tmp = copy_rtx (out);
+ else
+ {
+ rtx out1;
+- out1 = out;
++ out1 = copy_rtx (out);
+ tmp = gen_rtx_MULT (mode, out1, GEN_INT (diff & ~1));
+ nops++;
+ if (diff & 1)
+@@ -8302,12 +8302,12 @@ ix86_expand_int_movcc (operands)
+ clob = gen_rtx_REG (CCmode, FLAGS_REG);
+ clob = gen_rtx_CLOBBER (VOIDmode, clob);
+
+- tmp = gen_rtx_SET (VOIDmode, out, tmp);
++ tmp = gen_rtx_SET (VOIDmode, copy_rtx (out), tmp);
+ tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, copy_rtx (tmp), clob));
+ emit_insn (tmp);
+ }
+ else
+- emit_insn (gen_rtx_SET (VOIDmode, out, tmp));
++ emit_insn (gen_rtx_SET (VOIDmode, copy_rtx (out), tmp));
+ }
+ if (out != operands[0])
+ emit_move_insn (operands[0], copy_rtx (out));
+--- gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20021104.c.pr8213 2002-11-04 13:22:33.000000000 -0500
++++ gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20021104.c 2002-11-04 13:24:12.000000000 -0500
+@@ -0,0 +1,26 @@
++/* PR target/8213
++ This testcase, distilled from GNU gmp 4.1, was miscompiled on x86-64
++ because of RTL sharing problems. */
++
++int f(long x, long y)
++{
++ if ((x < 0) == (y < 0))
++ {
++ if (x == 0)
++ return -(y != 0);
++ if (y == 0)
++ return x != 0;
++ }
++ else
++ {
++ return x >= 0 ? 1 : -1;
++ }
++}
++
++int main(void)
++{
++ if (f(-1, 1) != -1)
++ abort();
++
++ return 0;
++}
diff --git a/sys-devel/gcc/files/3.2.1/gcc32-pr8988.patch b/sys-devel/gcc/files/3.2.1/gcc32-pr8988.patch
new file mode 100644
index 000000000000..dfb4a85c881b
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc32-pr8988.patch
@@ -0,0 +1,69 @@
+2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR optimization/8988
+ * loop.c (maybe_eliminate_biv): Kill REG_EQUAL notes mentioning
+ the biv when eliminating.
+
+2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.c-torture/execute/20021219-1.c: New test.
+
+--- gcc-3.2.1/gcc/testsuite/gcc.c-torture/execute/20021219-1.c.pr8988 2002-12-20 14:51:16.000000000 +0100
++++ gcc-3.2.1/gcc/testsuite/gcc.c-torture/execute/20021219-1.c 2002-12-20 14:51:04.000000000 +0100
+@@ -0,0 +1,18 @@
++/* PR optimization/8988 */
++/* Contributed by Kevin Easton */
++
++void foo(char *p1, char **p2)
++{}
++
++int main(void)
++{
++ char str[] = "foo { xx }";
++ char *ptr = str + 5;
++
++ foo(ptr, &ptr);
++
++ while (*ptr && (*ptr == 13 || *ptr == 32))
++ ptr++;
++
++ return 0;
++}
+--- gcc-3.2.1/gcc/loop.c.pr8988 2002-12-20 11:54:51.000000000 +0100
++++ gcc-3.2.1/gcc/loop.c 2002-12-20 11:54:51.000000000 +0100
+@@ -8536,11 +8536,12 @@ maybe_eliminate_biv (loop, bl, eliminate
+ enum rtx_code code = GET_CODE (p);
+ basic_block where_bb = 0;
+ rtx where_insn = threshold >= insn_count ? 0 : p;
++ rtx note;
+
+ /* If this is a libcall that sets a giv, skip ahead to its end. */
+ if (GET_RTX_CLASS (code) == 'i')
+ {
+- rtx note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
++ note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
+
+ if (note)
+ {
+@@ -8558,6 +8559,8 @@ maybe_eliminate_biv (loop, bl, eliminate
+ }
+ }
+ }
++
++ /* Closely examine the insn if the biv is mentioned. */
+ if ((code == INSN || code == JUMP_INSN || code == CALL_INSN)
+ && reg_mentioned_p (reg, PATTERN (p))
+ && ! maybe_eliminate_biv_1 (loop, PATTERN (p), p, bl,
+@@ -8569,6 +8572,12 @@ maybe_eliminate_biv (loop, bl, eliminate
+ bl->regno, INSN_UID (p));
+ break;
+ }
++
++ /* If we are eliminating, kill REG_EQUAL notes mentioning the biv. */
++ if (eliminate_p
++ && (note = find_reg_note (p, REG_EQUAL, NULL_RTX)) != NULL_RTX
++ && reg_mentioned_p (reg, XEXP (note, 0)))
++ remove_note (p, note);
+ }
+
+ if (p == loop->end)
diff --git a/sys-devel/gcc/files/3.2.1/gcc32-strip-dotdot.patch b/sys-devel/gcc/files/3.2.1/gcc32-strip-dotdot.patch
new file mode 100644
index 000000000000..088c307309be
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.1/gcc32-strip-dotdot.patch
@@ -0,0 +1,84 @@
+2002-07-17 Alan Modra <amodra@bigpond.net.au>
+
+ * prefix.c (update_path): Strip ".." components when prior dir
+ doesn't exist. Pass correct var to UPDATE_PATH_HOST_CANONICALIZE.
+
+--- gcc-3.2/gcc/prefix.c.strip-dotdot 2001-10-11 05:15:55.000000000 +0200
++++ gcc-3.2/gcc/prefix.c 2002-08-17 09:37:01.000000000 +0200
+@@ -251,7 +252,7 @@ update_path (path, key)
+ const char *path;
+ const char *key;
+ {
+- char *result;
++ char *result, *p;
+
+ if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
+ {
+@@ -271,9 +272,66 @@ update_path (path, key)
+ else
+ result = xstrdup (path);
+
++#ifndef ALWAYS_STRIP_DOTDOT
++#define ALWAYS_STRIP_DOTDOT 0
++#endif
++
++ p = result;
++ while (1)
++ {
++ char *src, *dest;
++
++ p = strchr (p, '.');
++ if (p == NULL)
++ break;
++ /* Look for `/../' */
++ if (p[1] == '.'
++ && IS_DIR_SEPARATOR (p[2])
++ && (p != result && IS_DIR_SEPARATOR (p[-1])))
++ {
++ *p = 0;
++ if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
++ {
++ *p = '.';
++ break;
++ }
++ else
++ {
++ /* We can't access the dir, so we won't be able to
++ access dir/.. either. Strip out `dir/../'. If `dir'
++ turns out to be `.', strip one more path component. */
++ dest = p;
++ do
++ {
++ --dest;
++ while (dest != result && IS_DIR_SEPARATOR (*dest))
++ --dest;
++ while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
++ --dest;
++ }
++ while (dest != result && *dest == '.');
++ /* If we have something like `./..' or `/..', don't
++ strip anything more. */
++ if (*dest == '.' || IS_DIR_SEPARATOR (*dest))
++ {
++ *p = '.';
++ break;
++ }
++ src = p + 3;
++ while (IS_DIR_SEPARATOR (*src))
++ ++src;
++ p = dest;
++ while ((*dest++ = *src++) != 0)
++ ;
++ }
++ }
++ else
++ ++p;
++ }
++
+ #ifdef UPDATE_PATH_HOST_CANONICALIZE
+ /* Perform host dependent canonicalization when needed. */
+- UPDATE_PATH_HOST_CANONICALIZE (path);
++ UPDATE_PATH_HOST_CANONICALIZE (result);
+ #endif
+
+ #ifdef DIR_SEPARATOR_2
diff --git a/sys-devel/gcc/files/digest-gcc-3.2.1-r7 b/sys-devel/gcc/files/digest-gcc-3.2.1-r7
new file mode 100644
index 000000000000..bc91959d5eed
--- /dev/null
+++ b/sys-devel/gcc/files/digest-gcc-3.2.1-r7
@@ -0,0 +1,3 @@
+MD5 94a4a76c602b422c8edd66433eeacb7f gcc-3.2.1.tar.bz2 20605134
+MD5 e363241306dc1a8ab10ac94171906e06 gcc-3.2.1-branch-update-20021208.patch.bz2 1049463
+MD5 b53b0c7527293d3ef2c42938d2558974 gcc-3.2.1-manpages.tar.bz2 127306
diff --git a/sys-devel/gcc/gcc-3.2.1-r7.ebuild b/sys-devel/gcc/gcc-3.2.1-r7.ebuild
new file mode 100644
index 000000000000..282f65c65862
--- /dev/null
+++ b/sys-devel/gcc/gcc-3.2.1-r7.ebuild
@@ -0,0 +1,506 @@
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.1-r7.ebuild,v 1.1 2003/01/18 05:21:02 azarah Exp $
+
+IUSE="static nls bootstrap java build"
+
+inherit eutils flag-o-matic libtool
+
+# Compile problems with these (bug #6641 among others)...
+filter-flags "-fno-exceptions -fomit-frame-pointer"
+
+# Some odd problems with -march=k6[-2] (bug #12791)
+replace-flags "-march=k6-2" "-march=i586"
+replace-flags "-march=k6" "-march=i586"
+
+# Recently there has been a lot of stability problem in Gentoo-land. Many
+# things can be the cause to this, but I believe that it is due to gcc3
+# still having issues with optimizations, or with it not filtering bad
+# combinations (protecting the user maybe from himeself) yet.
+#
+# This can clearly be seen in large builds like glibc, where too aggressive
+# CFLAGS cause the tests to fail miserbly.
+#
+# Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
+# knows what he is talking about:
+#
+# People really shouldn't force code-specific options on... It's a
+# bad idea. The -march options aren't just to look pretty. They enable
+# options that are sensible (and include sse,mmx,3dnow when apropriate).
+#
+# The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
+# you do not like it, comment it, but do not bugreport if you run into
+# problems.
+#
+# <azarah@gentoo.org> (13 Oct 2002)
+strip-flags
+
+# Theoretical cross compiler support
+[ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}"
+
+LOC="/usr"
+MY_PV="`echo ${PV} | awk -F. '{ gsub(/_pre.*|_alpha.*/, ""); print $1 "." $2 }'`"
+MY_PV_FULL="`echo ${PV} | awk '{ gsub(/_pre.*|_alpha.*/, ""); print $0 }'`"
+
+LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${MY_PV_FULL}"
+BINPATH="${LOC}/${CCHOST}/gcc-bin/${MY_PV}"
+DATAPATH="${LOC}/share/gcc-data/${CCHOST}/${MY_PV}"
+# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
+# We will handle /usr/include/g++-v3/ with gcc-config ...
+STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}"
+
+# Patch tarball support ...
+#PATCH_VER="1.0"
+PATCH_VER=""
+
+# Snapshot support ...
+#SNAPSHOT="2002-08-12"
+SNAPSHOT=""
+
+# Branch update support ...
+#BRANCH_UPDATE="20021208"
+BRANCH_UPDATE="20021208"
+
+if [ -z "${SNAPSHOT}" ]
+then
+ S="${WORKDIR}/${P}"
+ SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/${P}/${P}.tar.bz2"
+
+ if [ -n "${PATCH_VER}" ]
+ then
+ SRC_URI="${SRC_URI}
+ mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
+ fi
+
+ if [ -n "${BRANCH_UPDATE}" ]
+ then
+ SRC_URI="${SRC_URI}
+ mirror://gentoo/${P}-branch-update-${BRANCH_UPDATE}.patch.bz2"
+ fi
+else
+ S="${WORKDIR}/gcc-${SNAPSHOT//-}"
+ SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT//-}.tar.bz2"
+fi
+SRC_URI="${SRC_URI} mirror://gentoo/${P}-manpages.tar.bz2"
+
+DESCRIPTION="Modern C/C++ compiler written by the GNU people"
+HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
+
+LICENSE="GPL-2 LGPL-2.1"
+KEYWORDS="~x86 ~ppc ~sparc ~alpha"
+
+# Ok, this is a hairy one again, but lets assume that we
+# are not cross compiling, than we want SLOT to only contain
+# $PV, as people upgrading to new gcc layout will not have
+# their old gcc unmerged ...
+if [ "${CHOST}" == "${CCHOST}" ]
+then
+ SLOT="${MY_PV}"
+else
+ SLOT="${CCHOST}-${MY_PV}"
+fi
+
+DEPEND="virtual/glibc
+ >=sys-devel/gcc-config-1.2
+ !build? ( >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext ) )"
+
+RDEPEND="virtual/glibc
+ >=sys-devel/gcc-config-1.3.0
+ >=sys-libs/zlib-1.1.4
+ >=sys-apps/texinfo-4.2-r4
+ !build? ( >=sys-libs/ncurses-5.2-r2 )"
+
+PDEPEND="sys-devel/gcc-config"
+
+
+# Hack used to patch Makefiles to install into the build dir
+FAKE_ROOT=""
+
+src_unpack() {
+ if [ -z "${SNAPSHOT}" ]
+ then
+ unpack ${P}.tar.bz2
+
+ if [ -n "${PATCH_VER}" ]
+ then
+ unpack ${P}-patches-${PATCH_VER}.tar.bz2
+ fi
+ else
+ unpack gcc-${SNAPSHOT//-}.tar.bz2
+ fi
+
+ cd ${S}
+ # Fixup libtool to correctly generate .la files with portage
+ elibtoolize --portage --shallow
+
+ # Branch update ...
+ if [ -n "${BRANCH_UPDATE}" ]
+ then
+ epatch ${DISTDIR}/${P}-branch-update-${BRANCH_UPDATE}.patch.bz2
+ fi
+
+ # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2
+ if [ -n "${PATCH_VER}" ]
+ then
+ epatch ${WORKDIR}/patch
+ fi
+
+ # Fix bug URL
+ epatch ${FILESDIR}/${PV}/${P}-bug-url.patch
+
+ # Patches from Redhat ...
+ epatch ${FILESDIR}/${PV}/gcc32-ada-make.patch
+ epatch ${FILESDIR}/${PV}/gcc32-shared-pthread.patch
+ use sparc && epatch ${FILESDIR}/${PV}/gcc32-sparc32-hack.patch
+ epatch ${FILESDIR}/${PV}/gcc32-testsuite.patch
+ epatch ${FILESDIR}/${PV}/gcc32-tls-reload-fix.patch
+
+ # Patches from Mandrake/Suse ...
+ epatch ${FILESDIR}/${PV}/gcc31-loop-load-final-value.patch
+ epatch ${FILESDIR}/${PV}/gcc32-fix-sixtrack.patch
+ epatch ${FILESDIR}/${PV}/gcc32-pr8213.patch
+ epatch ${FILESDIR}/${PV}/gcc32-strip-dotdot.patch
+ epatch ${FILESDIR}/${PV}/gcc32-athlon-alignment.patch
+ epatch ${FILESDIR}/${PV}/gcc32-libjava-x86_64-biarch-sigaction.patch
+ epatch ${FILESDIR}/${PV}/gcc32-pr8988.patch
+
+ # Install our pre generated manpages if we do not have perl ...
+ if [ ! -x /usr/bin/perl ]
+ then
+ cd ${S}; unpack ${P}-manpages.tar.bz2
+ fi
+
+ # Currently if any path is changed via the configure script, it breaks
+ # installing into ${D}. We should not patch it in src_install() with
+ # absolute paths, as some modules then gets rebuild with the wrong
+ # paths. Thus we use $FAKE_ROOT.
+ einfo "Fixing Makefiles..."
+ cd ${S}
+ for x in $(find . -name Makefile.in)
+ do
+ # Fix --datadir=
+ cp ${x} ${x}.orig
+ sed -e 's:datadir = @datadir@:datadir = $(FAKE_ROOT)@datadir@:' \
+ ${x}.orig > ${x}
+
+ # Fix --bindir=
+ cp ${x} ${x}.orig
+ sed -e 's:bindir = @bindir@:bindir = $(FAKE_ROOT)@bindir@:' \
+ ${x}.orig > ${x}
+
+ # Fix --includedir=
+ cp ${x} ${x}.orig
+ sed -e 's:includedir = @includedir@:includedir = $(FAKE_ROOT)@includedir@:' \
+ ${x}.orig > ${x}
+
+ # Fix --with-gxx-include-dir=
+ cp ${x} ${x}.orig
+ sed -e 's:gxx_include_dir = @gxx_:gxx_include_dir = $(FAKE_ROOT)@gxx_:' \
+ -e 's:glibcppinstalldir = @gxx_:glibcppinstalldir = $(FAKE_ROOT)@gxx_:' \
+ ${x}.orig > ${x}
+
+ # Where java security stuff should be installed
+ cp ${x} ${x}.orig
+ sed -e 's:secdir = $(libdir)/security:secdir = $(FAKE_ROOT)$(LIBPATH)/security:' \
+ ${x}.orig > ${x}
+
+ rm -f ${x}.orig
+ done
+
+ # This next bit is for updating libtool linker scripts ...
+ OLD_GCC_VERSION="`gcc -dumpversion`"
+
+ if [ "${OLD_GCC_VERSION}" != "${MY_PV_FULL}" ]
+ then
+ echo "${OLD_GCC_VERSION}" > ${WORKDIR}/.oldgccversion
+ fi
+}
+
+src_compile() {
+ local myconf=""
+ local gcc_lang=""
+
+ if [ -z "`use build`" ]
+ then
+ myconf="${myconf} --enable-shared"
+ gcc_lang="c,c++,ada,f77,objc"
+ else
+ gcc_lang="c"
+ fi
+ if [ -z "`use nls`" ] || [ "`use build`" ]
+ then
+ myconf="${myconf} --disable-nls"
+ else
+ myconf="${myconf} --enable-nls --without-included-gettext"
+ fi
+ if [ -n "`use java`" ] && [ -z "`use build`" ]
+ then
+ gcc_lang="${gcc_lang},java"
+ fi
+
+ # In general gcc does not like optimization, and add -O2 where
+ # it is safe.
+ export CFLAGS="${CFLAGS//-O?}"
+ export CXXFLAGS="${CXXFLAGS//-O?}"
+
+ # Build in a separate build tree
+ mkdir -p ${WORKDIR}/build
+ cd ${WORKDIR}/build
+
+ einfo "Configuring GCC..."
+ addwrite "/dev/zero"
+ ${S}/configure --prefix=${LOC} \
+ --bindir=${BINPATH} \
+ --includedir=${LIBPATH}/include \
+ --datadir=${DATAPATH} \
+ --mandir=${DATAPATH}/man \
+ --infodir=${DATAPATH}/info \
+ --enable-shared \
+ --host=${CHOST} \
+ --target=${CCHOST} \
+ --with-system-zlib \
+ --enable-languages=${gcc_lang} \
+ --enable-threads=posix \
+ --enable-long-long \
+ --disable-checking \
+ --enable-cstdio=stdio \
+ --enable-clocale=generic \
+ --enable-__cxa_atexit \
+ --enable-version-specific-runtime-libs \
+ --with-gxx-include-dir=${STDCXX_INCDIR} \
+ --with-local-prefix=${LOC}/local \
+ ${myconf} || die
+
+ touch ${S}/gcc/c-gperf.h
+
+ # Do not make manpages if we do not have perl ...
+ if [ ! -x /usr/bin/perl ]
+ then
+ find ${S} -name '*.[17]' -exec touch {} \; || :
+ fi
+
+ # Setup -j in MAKEOPTS
+ get_number_of_jobs
+
+ einfo "Building GCC..."
+ if [ -z "`use static`" ]
+ then
+ # Fix for our libtool-portage.patch
+ S="${WORKDIR}/build" \
+ emake bootstrap-lean \
+ LIBPATH="${LIBPATH}" \
+ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
+ # Above FLAGS optimize and speedup build, thanks
+ # to Jeff Garzik <jgarzik@mandrakesoft.com>
+ else
+ S="${WORKDIR}/build" \
+ emake LDFLAGS=-static bootstrap \
+ LIBPATH="${LIBPATH}" \
+ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die
+ fi
+}
+
+src_install() {
+ # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as
+ # this can break the build.
+ for x in cd ${WORKDIR}/build/gcc/include/*
+ do
+ if [ -L ${x} ]
+ then
+ rm -f ${x}
+ fi
+ done
+
+ einfo "Installing GCC..."
+ # Do the 'make install' from the build directory
+ cd ${WORKDIR}/build
+ S="${WORKDIR}/build" \
+ make prefix=${D}${LOC} \
+ bindir=${D}${BINPATH} \
+ includedir=${D}${LIBPATH}/include \
+ datadir=${D}${DATAPATH} \
+ mandir=${D}${DATAPATH}/man \
+ infodir=${D}${DATAPATH}/info \
+ LIBPATH="${LIBPATH}" \
+ FAKE_ROOT="${D}" \
+ install || die
+
+ [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}"
+
+ dodir /lib /usr/bin
+ dodir /etc/env.d/gcc
+ echo "PATH=\"${BINPATH}\"" > ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "LDPATH=\"${LIBPATH}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "MANPATH=\"${DATAPATH}/man\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "INFOPATH=\"${DATAPATH}/info\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ # Also set CC and CXX
+ echo "CC=\"gcc\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+ echo "CXX=\"g++\"" >> ${D}/etc/env.d/gcc/${CCHOST}-${MY_PV_FULL}
+
+ # Install wrappers
+# Handled by gcc-config now ...
+# exeinto /lib
+# doexe ${FILESDIR}/cpp
+# exeinto /usr/bin
+# doexe ${FILESDIR}/cc
+
+# This should be invalidated by the linker scripts we have as the latest
+# fix for bug #4411
+#
+# # gcc-3.1 have a problem with the ordering of Search Directories. For
+# # instance, if you have libreadline.so in /lib, and libreadline.a in
+# # /usr/lib, then it will link with libreadline.a instead of .so. As far
+# # as I can see from the source, /lib should be searched before /usr/lib,
+# # and this also differs from gcc-2.95.3 and possibly 3.0.4, but ill have
+# # to check on 3.0.4. Thanks to Daniel Robbins for noticing this oddity,
+# # bugzilla bug #4411
+# #
+# # Azarah - 3 Jul 2002
+# #
+# cd ${D}${LIBPATH}
+# dosed -e "s:%{L\*} %(link_libgcc):%{L\*} -L/lib %(link_libgcc):" \
+# ${LIBPATH}/specs
+
+ # Make sure we dont have stuff lying around that
+ # can nuke multiple versions of gcc
+ if [ -z "`use build`" ]
+ then
+ cd ${D}${LIBPATH}
+
+ # Tell libtool files where real libraries are
+ for LA in ${D}${LOC}/lib/*.la ${D}${LIBPATH}/../*.la
+ do
+ if [ -f ${LA} ]
+ then
+ sed -e "s:/usr/lib:${LIBPATH}:" ${LA} > ${LA}.hacked
+ mv ${LA}.hacked ${LA}
+ mv ${LA} ${D}${LIBPATH}
+ fi
+ done
+
+ # Move all the libraries to version specific libdir.
+ for x in ${D}${LOC}/lib/*.{so,a}* ${D}${LIBPATH}/../*.{so,a}*
+ do
+ [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}
+ done
+
+ # Move Java headers to compiler-specific dir
+ for x in ${D}${LOC}/include/gc*.h ${D}${LOC}/include/j*.h
+ do
+ [ -f ${x} ] && mv -f ${x} ${D}${LIBPATH}/include/
+ done
+ for x in gcj gnu java javax org
+ do
+ if [ -d ${D}${LOC}/include/${x} ]
+ then
+ dodir /${LIBPATH}/include/${x}
+ mv -f ${D}${LOC}/include/${x}/* ${D}${LIBPATH}/include/${x}/
+ rm -rf ${D}${LOC}/include/${x}
+ fi
+ done
+
+ # Move libgcj.spec to compiler-specific directories
+ [ -f ${D}${LOC}/lib/libgcj.spec ] && \
+ mv -f ${D}${LOC}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
+
+ # Rename jar because it could clash with Kaffe's jar if this gcc is
+ # primary compiler (aka don't have the -<version> extension)
+ cd ${D}${LOC}/${CCHOST}/gcc-bin/${MY_PV}
+ [ -f jar ] && mv -f jar gcj-jar
+
+ # Move <cxxabi.h> to compiler-specific directories
+ [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \
+ mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
+
+ # These should be symlinks
+ cd ${D}${BINPATH}
+ rm -f ${CCHOST}-{gcc,g++,c++,g77}
+ [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc
+ [ -f g++ ] && ln -sf g++ ${CCHOST}-g++
+ [ -f g++ ] && ln -sf g++ ${CCHOST}-c++
+ [ -f g77 ] && ln -sf g77 ${CCHOST}-g77
+ fi
+
+ # This one comes with binutils
+ if [ -f ${D}${LOC}/lib/libiberty.a ]
+ then
+ rm -f ${D}${LOC}/lib/libiberty.a
+ fi
+
+ cd ${S}
+ if [ -z "`use build`" ]
+ then
+ cd ${S}
+ docinto /${CCHOST}
+ dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README
+ docinto ${CCHOST}/html
+ dohtml *.html
+ cd ${S}/boehm-gc
+ docinto ${CCHOST}/boehm-gc
+ dodoc ChangeLog doc/{README*,barrett_diagram}
+ docinto ${CCHOST}/boehm-gc/html
+ dohtml doc/*.html
+ cd ${S}/gcc
+ docinto ${CCHOST}/gcc
+ dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE
+ cd ${S}/libf2c
+ docinto ${CCHOST}/libf2c
+ dodoc ChangeLog README TODO *.netlib
+ cd ${S}/libffi
+ docinto ${CCHOST}/libffi
+ dodoc ChangeLog* LICENSE README
+ cd ${S}/libiberty
+ docinto ${CCHOST}/libiberty
+ dodoc ChangeLog COPYING.LIB README
+ cd ${S}/libobjc
+ docinto ${CCHOST}/libobjc
+ dodoc ChangeLog README* THREADS*
+ cd ${S}/libstdc++-v3
+ docinto ${CCHOST}/libstdc++-v3
+ dodoc ChangeLog* README
+ docinto ${CCHOST}/libstdc++-v3/html
+ dohtml -r -a css,diff,html,txt,xml docs/html/*
+ cp -f docs/html/17_intro/[A-Z]* \
+ ${D}/usr/share/doc/${PF}/${DOCDESTTREE}/17_intro/
+
+ if [ -n "`use java`" ]
+ then
+ cd ${S}/fastjar
+ docinto ${CCHOST}/fastjar
+ dodoc AUTHORS CHANGES COPYING ChangeLog NEWS README
+ cd ${S}/libjava
+ docinto ${CCHOST}/libjava
+ dodoc ChangeLog* COPYING HACKING LIBGCJ_LICENSE NEWS README THANKS
+ fi
+ else
+ rm -rf ${D}/usr/share/{man,info}
+ fi
+
+ # Fix ncurses b0rking
+ find ${D}/ -name '*curses.h' -exec rm -f {} \;
+}
+
+pkg_postinst() {
+
+ if [ "${ROOT}" = "/" -a "${COMPILER}" = "gcc3" -a "${CHOST}" == "${CCHOST}" ]
+ then
+ gcc-config --use-portage-chost ${CCHOST}-${MY_PV_FULL}
+ fi
+
+ # Update libtool linker scripts to reference new gcc version ...
+ if [ -f ${WORKDIR}/.oldgccversion -a "${ROOT}" = "/" ]
+ then
+ OLD_GCC_VERSION="`cat ${WORKDIR}/.oldgccversion`"
+
+ cp -f ${FILESDIR}/fix_libtool_files.sh ${T}
+ chmod +x ${T}/fix_libtool_files.sh
+ ${T}/fix_libtool_files.sh ${OLD_GCC_VERSION}
+ fi
+
+ # Fix ncurses b0rking (if r5 isn't unmerged)
+ find ${ROOT}/usr/lib/gcc-lib -name '*curses.h' -exec rm -f {} \;
+}
+