annotate sources/sections/binutils-gcc.sh @ 842:dee27a32b160

Fix static toolchain wrapping so distcc works with them too.
author Rob Landley <rob@landley.net>
date Sat, 10 Oct 2009 12:08:59 -0500
parents fc498452494a
children 96afbdffbf97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
832
fc498452494a Add missing chunk too make distcc work again.
Rob Landley <rob@landley.net>
parents: 823
diff changeset
1 # Build binutils, c wrapper, and uClibc++
823
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # Build binutils, which provides the linker and assembler and such.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 # PROGRAM_PREFIX affects the name of the generated tools, ala "${ARCH}-".
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 setupfor binutils
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 # The binutils ./configure stage is _really_stupid_, and we need to define
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 # lots of environment variables to make it behave.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
11
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 function configure_binutils()
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 {
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 "$CURSRC/configure" --prefix="$STAGE_DIR" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 --build="$CROSS_HOST" --host="$FROM_HOST" --target="$CROSS_TARGET" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 --disable-nls --disable-shared --disable-multilib --disable-werror \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 --with-lib-path=lib --program-prefix="$PROGRAM_PREFIX" $BINUTILS_FLAGS
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
18
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 [ $? -ne 0 ] && dienow
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 }
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
21
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 if [ -z "$FROM_ARCH" ]
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 then
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 # Create a simple cross compiler, from this host to target $ARCH.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 # This has no prerequisites.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
26
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 # The binutils ./configure stage is _really_stupid_. Define lots of
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
28 # environment variables to make it behave.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
29
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 AR=ar AS=as LD=ld NM=nm OBJDUMP=objdump OBJCOPY=objcopy configure_binutils
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 else
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 # Canadian cross for an arbitrary host/target. The new compiler will run
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 # on $FROM_ARCH as its host, and build executables for $ARCH as its target.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 # (Use host==target to produce a native compiler.) Doing this requires
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 # existing host ($FROM_ARCH) _and_ target ($ARCH) cross compilers as
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
36 # prerequisites.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
37
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 AR="${FROM_ARCH}-ar" CC="${FROM_ARCH}-cc" configure_binutils
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 fi
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
40
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 # Now that it's configured, build and install binutils
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
42
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 make -j $CPUS configure-host &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS" &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 make -j $CPUS install &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 mkdir -p "$STAGE_DIR/include" &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
47 cp "$CURSRC/include/libiberty.h" "$STAGE_DIR/include"
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
48
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 cleanup build-binutils
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
50
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 # Force gcc to build, largely against its will.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
52
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
53 setupfor gcc-core build-gcc
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 setupfor gcc-g++ build-gcc gcc-core
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
55
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
56 # GCC tries to "help out in the kitchen" by screwing up the kernel include
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 # files. Surgery with sed to cut out that horrible idea throw it away.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
58
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
59 sed -i 's@^STMP_FIX.*@@' "${CURSRC}/gcc/Makefile.in" || dienow
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
60
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
61 # The gcc ./configure manages to make the binutils one look sane. Again,
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
62 # wrap it so we can call it with different variables to beat sense out of it.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
63
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
64 function configure_gcc()
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 {
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 "$CURSRC/configure" --target="$CROSS_TARGET" --prefix="$STAGE_DIR" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
67 --disable-multilib --disable-nls --enable-c99 --enable-long-long \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
68 --enable-__cxa_atexit --enable-languages=c,c++ --disable-libstdcxx-pch \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
69 --program-prefix="$PROGRAM_PREFIX" "$@" $GCC_FLAGS &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
70 mkdir -p gcc &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
71 ln -s `which ${CC_FOR_TARGET:-cc}` gcc/xgcc || dienow
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
72 }
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
73
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
74 if [ -z "$FROM_ARCH" ]
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
75 then
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 # Produce a standard host->target cross compiler, which does not include
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
77 # thread support or libgcc_s.so to make it depend on the host less.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
78
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
79 # The only prerequisite for this is binutils, above. (It doesn't even
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
80 # require a C library for the target to exist yet, which is good because you
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
81 # have a chicken and egg problem otherwise. What would you have compiled
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
82 # that C library _with_?)
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
83
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
84 AR_FOR_TARGET="${ARCH}-ar" configure_gcc \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
85 --disable-threads --disable-shared --host="$CROSS_HOST"
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
86 else
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
87 # Canadian cross a compiler to run on $FROM_ARCH as its host and output
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
88 # binaries for $ARCH as its target.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
89
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
90 # GCC has some deep assumptions here, which are wrong. Lots of redundant
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 # corrections are required to make it stop.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
92
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
93 CC="${FROM_ARCH}-cc" AR="${FROM_ARCH}-ar" AS="${FROM_ARCH}-as" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
94 LD="${FROM_ARCH}-ld" NM="${FROM_ARCH}-nm" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
95 CC_FOR_TARGET="${ARCH}-cc" AR_FOR_TARGET="${ARCH}-ar" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
96 NM_FOR_TARGET="${ARCH}-nm" GCC_FOR_TARGET="${ARCH}-cc" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
97 AS_FOR_TARGET="${ARCH}-as" LD_FOR_TARGET="${ARCH}-ld" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
98 CXX_FOR_TARGET="${ARCH}-c++" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
99 ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
100 ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
101 ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
102 ac_cv_path_AS_FOR_TARGET="${ARCH}-as" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
103 ac_cv_path_LD_FOR_TARGET="${ARCH}-ld" \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
104 configure_gcc --enable-threads=posix --enable-shared \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
105 --build="$CROSS_HOST" --host="$CROSS_TARGET"
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
106 fi
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
107
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
108 # Now that it's configured, build and install gcc
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
109
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
110 make -j $CPUS configure-host &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
111 make -j $CPUS all-gcc LDFLAGS="$STATIC_FLAGS" &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
112
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
113 # Work around gcc bug; we disabled multilib but it doesn't always notice.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
114
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
115 ln -s lib "$STAGE_DIR/lib64" &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
116 make -j $CPUS install-gcc &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
117 rm "$STAGE_DIR/lib64" &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
118 ln -s "${PROGRAM_PREFIX}gcc" "$STAGE_DIR/bin/${PROGRAM_PREFIX}cc" || dienow
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
119
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
120 # Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build).
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
121 # But don't want to build the whole of libstdc++-v3 because
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
122 # A) we're using uClibc++ instead, B) the build breaks.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
123
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
124 if [ ! -z "$FROM_ARCH" ]
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
125 then
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
126 # The libsupc++ ./configure dies if run after the simple cross compiling
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
127 # ./configure, because gcc's build system is overcomplicated crap. So
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
128 # skip the uClibc++ build first time around. We still build C++ support
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
129 # in gcc because we need it to canadian cross build uClibc++ later.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
130
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
131 make -j $CPUS configure-target-libstdc++-v3 &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
132 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
133 make -j $CPUS &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
134 mv .libs/libsupc++.a "$STAGE_DIR"/lib || dienow
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
135 fi
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
136
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
137 # We're done with that source and could theoretically cleanup gcc-core and
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
138 # build-gcc here, but we still need the timestamps if we do binary package
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
139 # tarballs.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
140
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
141 function build_ccwrap()
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
142 {
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
143 # build and install gcc wrapper script.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
144
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
145 TEMP="${FROM_ARCH}-cc"
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
146 [ -z "$FROM_ARCH" ] && TEMP="$CC"
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
147
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
148 mv "$STAGE_DIR/bin/${PROGRAM_PREFIX}"{gcc,rawgcc} &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
149 "$TEMP" "$SOURCES/toys/ccwrap.c" -Os -s \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
150 -o "$STAGE_DIR/bin/${PROGRAM_PREFIX}gcc" "$@" $STATIC_FLAGS \
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
151 -DGCC_UNWRAPPED_NAME='"'"${PROGRAM_PREFIX}rawgcc"'"' &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
152
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
153 # Move the gcc internal libraries and headers somewhere sane
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
154
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
155 mkdir -p "$STAGE_DIR"/gcc &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
156 mv "$STAGE_DIR"/lib/gcc/*/*/include "$STAGE_DIR"/gcc/include &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
157 mv "$STAGE_DIR"/lib/gcc/*/* "$STAGE_DIR"/gcc/lib &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
158
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
159 # Rub gcc's nose in the binutils output. (It's RIGHT THERE! Find it!)
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
160
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
161 cd "$STAGE_DIR"/libexec/gcc/*/*/ &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
162 cp -s "../../../../$CROSS_TARGET/bin/"* . &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
163
832
fc498452494a Add missing chunk too make distcc work again.
Rob Landley <rob@landley.net>
parents: 823
diff changeset
164 ln -s ${CROSS_TARGET} ${STAGE_DIR}/tools &&
842
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
165 ln -sf ../../../../tools/bin/ld ${STAGE_DIR}/libexec/gcc/*/*/collect2 || dienow
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
166
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
167 # These are allowed to fail, there for static toolchains that don't make 'em.
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
168
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
169 ln -s ../../bin/${PROGRAM_PREFIX}-rawgcc gcc 2>/dev/null
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
170 ln -s ../../bin/${PROGRAM_PREFIX}-rawgcc cc 2>/dev/null
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
171 ln -s ../../bin/${PROGRAM_PREFIX}-rawg++ g++ 2>/dev/null
dee27a32b160 Fix static toolchain wrapping so distcc works with them too.
Rob Landley <rob@landley.net>
parents: 832
diff changeset
172 ln -s ../../bin/${PROGRAM_PREFIX}-rawg++ c++ 2>/dev/null
832
fc498452494a Add missing chunk too make distcc work again.
Rob Landley <rob@landley.net>
parents: 823
diff changeset
173
823
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
174 # Wrap C++ too.
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
175
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
176 mv "$STAGE_DIR/bin/${PROGRAM_PREFIX}"{g++,rawg++} &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
177 rm "$STAGE_DIR/bin/${PROGRAM_PREFIX}c++" &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
178 ln -s "$STAGE_DIR/bin/${PROGRAM_PREFIX}"{rawg++,rawc++} &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
179 ln -s "$STAGE_DIR/bin/${PROGRAM_PREFIX}"{gcc,g++} &&
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
180 ln -s "$STAGE_DIR/bin/${PROGRAM_PREFIX}"{gcc,c++} || dienow
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
181 }
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
182
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
183 if [ -z "$FROM_ARCH" ]
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
184 then
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
185 build_ccwrap
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
186 else
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
187 build_ccwrap -DGIMME_AN_S
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
188 fi
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
189
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
190 mv "$WORK"/{gcc-core,gcc}
3c6565240019 Oops. Commit the new file from 820.
Rob Landley <rob@landley.net>
parents:
diff changeset
191 PACKAGE=gcc cleanup build-gcc "${STAGE_DIR}"/{lib/gcc,{libexec/gcc,gcc/lib}/install-tools,bin/${ARCH}-unknown-*}