annotate sources/sections/gcc.sh @ 1682:64316ca2bc9b

Remove redundant list assignment in ccwrap that screws up ordering and puts the -L entries in the wrong order.
author Rob Landley <rob@landley.net>
date Fri, 05 Sep 2014 23:54:01 -0500
parents a2e491cd0800
children 398efd71a43e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 # Build binutils, c wrapper, and uClibc++
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
1207
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
3 # TOOLCHAIN_PREFIX affects the name of the generated tools, ala "${ARCH}-".
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 # Force gcc to build, largely against its will.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
1183
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
7 setupfor gcc-core
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
8 [ -z "$NO_CPLUSPLUS" ] && REUSE_CURSRC=1 setupfor gcc-g++
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
9
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
10 blank_workdir build-gcc
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
11
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 # GCC tries to "help out in the kitchen" by screwing up the kernel include
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 # files. Surgery with sed to cut out that horrible idea throw it away.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
14
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 sed -i 's@^STMP_FIX.*@@' "${CURSRC}/gcc/Makefile.in" || dienow
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
16
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 # The gcc ./configure manages to make the binutils one look sane. Again,
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 # wrap it so we can call it with different variables to beat sense out of it.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
19
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 function configure_gcc()
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 {
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
22 # Are we building C only, or C and C++?
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
23 [ -z "$NO_CPLUSPLUS" ] &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
24 STUFF="--enable-languages=c,c++ --disable-libstdcxx-pch" ||
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
25 STUFF="--enable-languages=c"
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
26
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
27 # Configure gcc
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
28 "$CURSRC/configure" --target="$CROSS_TARGET" --prefix="$STAGE_DIR" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 --disable-multilib --disable-nls --enable-c99 --enable-long-long \
1207
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
30 --enable-__cxa_atexit $STUFF --program-prefix="$TOOLCHAIN_PREFIX" \
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
31 "$@" $GCC_FLAGS &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
32
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
33 # Provide xgcc as a symlink to the target compiler, so gcc doesn't waste
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
34 # time trying to rebuild itself with itself. (If we want that, we'll do it
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
35 # ourselves via canadian cross.)
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
36 mkdir -p gcc &&
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
37 ln -s "$(which ${CC_FOR_TARGET:-cc})" gcc/xgcc || dienow
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 }
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
39
1090
affef1edbdba Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents: 1079
diff changeset
40 if [ -z "$HOST_ARCH" ]
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 then
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 # Produce a standard host->target cross compiler, which does not include
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 # thread support or libgcc_s.so to make it depend on the host less.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
44
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 # The only prerequisite for this is binutils, above. (It doesn't even
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 # require a C library for the target to exist yet, which is good because you
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
47 # have a chicken and egg problem otherwise. What would you have compiled
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 # that C library _with_?)
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
49
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
50 AR_FOR_TARGET="${ARCH}-ar" configure_gcc \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 --disable-threads --disable-shared --host="$CROSS_HOST"
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
52 else
1090
affef1edbdba Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents: 1079
diff changeset
53 # Canadian cross a compiler to run on $HOST_ARCH as its host and output
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 # binaries for $ARCH as its target.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
55
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
56 # GCC has some deep assumptions here, which are wrong. Lots of redundant
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 # corrections are required to make it stop.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
58
1090
affef1edbdba Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents: 1079
diff changeset
59 CC="${HOST_ARCH}-cc" AR="${HOST_ARCH}-ar" AS="${HOST_ARCH}-as" \
affef1edbdba Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents: 1079
diff changeset
60 LD="${HOST_ARCH}-ld" NM="${HOST_ARCH}-nm" \
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
61 CC_FOR_TARGET="${ARCH}-cc" AR_FOR_TARGET="${ARCH}-ar" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
62 NM_FOR_TARGET="${ARCH}-nm" GCC_FOR_TARGET="${ARCH}-cc" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
63 AS_FOR_TARGET="${ARCH}-as" LD_FOR_TARGET="${ARCH}-ld" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
64 CXX_FOR_TARGET="${ARCH}-c++" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
67 ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
68 ac_cv_path_AS_FOR_TARGET="${ARCH}-as" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
69 ac_cv_path_LD_FOR_TARGET="${ARCH}-ld" \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
70 configure_gcc --enable-threads=posix --enable-shared \
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
71 --build="$CROSS_HOST" --host="$CROSS_TARGET"
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
72 fi
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
73
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
74 # Now that it's configured, build and install gcc
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
75
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 make -j $CPUS configure-host &&
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
77 make -j $CPUS all-gcc LDFLAGS="$STATIC_FLAGS" &&
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
78
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
79 mkdir -p "$STAGE_DIR"/cc/lib || dienow
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
80
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
81 if [ ! -z "$HOST_ARCH" ] && [ -z "$NO_CPLUSPLUS" ]
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
82 then
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
83 # We also need to beat libsupc++ out of gcc (which uClibc++ needs to build).
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
84 # But don't want to build the whole of libstdc++-v3 because
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
85 # A) we're using uClibc++ instead, B) the build breaks.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
86
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
87 # The libsupc++ ./configure dies if run after the simple cross compiling
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
88 # ./configure, because gcc's build system is overcomplicated crap, so skip
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
89 # the uClibc++ build first time around and only do it for the canadian cross
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
90 # builds. (The simple cross compiler still needs basic C++ support to build
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 # the C++ libraries with, though.)
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
92
1532
a2e491cd0800 Fix source/target confusion that bites Fedora host = target builds.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
93 make -j $CPUS configure-target-libstdc++-v3 SHELL=sh &&
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
94 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ &&
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
95 make -j $CPUS &&
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
96 mv .libs/libsupc++.a "$STAGE_DIR"/cc/lib &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
97 cd ../../.. || dienow
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
98 fi
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
99
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
100 # Work around gcc bug during the install: we disabled multilib but it doesn't
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
101 # always notice.
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
102
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
103 ln -s lib "$STAGE_DIR/lib64" &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
104 make -j $CPUS install-gcc &&
1127
1f51b4a0517b The install-tools debris this script deletes wasn't there in gcc 3.x, so allow the delete to fail gracefully when USE_UNSTABLE his hooked up to an ancient version.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
105 rm "$STAGE_DIR/lib64" || dienow
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
106
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
107 # Move the gcc internal libraries and headers somewhere sane
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
108
1127
1f51b4a0517b The install-tools debris this script deletes wasn't there in gcc 3.x, so allow the delete to fail gracefully when USE_UNSTABLE his hooked up to an ancient version.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
109 rm -rf "$STAGE_DIR"/lib/gcc/*/*/install-tools 2>/dev/null
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
110 mv "$STAGE_DIR"/lib/gcc/*/*/include "$STAGE_DIR"/cc/include &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
111 mv "$STAGE_DIR"/lib/gcc/*/*/* "$STAGE_DIR"/cc/lib &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
112
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
113 # Move the compiler internal binaries into "tools"
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
114 ln -s "$CROSS_TARGET" "$STAGE_DIR/tools" &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
115 cp "$STAGE_DIR/libexec/gcc/"*/*/c* "$STAGE_DIR/tools/bin" &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
116 rm -rf "$STAGE_DIR/libexec" || dienow
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
117
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
118 # collect2 is evil, kill it.
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
119 # ln -sf ../../../../tools/bin/ld ${STAGE_DIR}/libexec/gcc/*/*/collect2 || dienow
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
120
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
121 # Prepare for ccwrap
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
122
1207
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
123 mv "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}gcc" "$STAGE_DIR/tools/bin/cc" &&
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
124 ln -sf "${TOOLCHAIN_PREFIX}cc" "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}gcc" &&
937
f2b4d7297c9d Largeish cleanup of ccwrap.c. Remove lots of uclibc-isms, put rawcc in tools/bin.
Rob Landley <rob@landley.net>
parents: 914
diff changeset
125 ln -s cc "$STAGE_DIR/tools/bin/rawcc" &&
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
126
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
127 # Wrap C++ too.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
128
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
129 if [ -z "$NO_CPLUSPLUS" ]
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
130 then
1207
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
131 mv "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}g++" "$STAGE_DIR/tools/bin/c++" &&
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
132 ln -sf "${TOOLCHAIN_PREFIX}cc" "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}g++" &&
4021fb1183d7 Environment sanitizing screwed up the cross-compiler.sh wrapper. Fix it, rename PROGRAM_PREFIX to TOOLCHAIN_PREFIX, and put a guard around sources/include.sh so it's safe to include multiple times.
Rob Landley <rob@landley.net>
parents: 1183
diff changeset
133 ln -sf "${TOOLCHAIN_PREFIX}cc" "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}c++" &&
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
134 ln -s c++ "$STAGE_DIR/tools/bin/raw++" || dienow
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
135 fi
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
136
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
137 # Make sure "tools" has everything distccd needs.
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
138
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
139 cd "$STAGE_DIR/tools" || dienow
937
f2b4d7297c9d Largeish cleanup of ccwrap.c. Remove lots of uclibc-isms, put rawcc in tools/bin.
Rob Landley <rob@landley.net>
parents: 914
diff changeset
140 ln -s cc "$STAGE_DIR/tools/bin/gcc" 2>/dev/null
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
141 [ -z "$NO_CPLUSPLUS" ] && ln -s c++ "$STAGE_DIR/tools/bin/g++" 2>/dev/null
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
142
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
143 rm -rf "${STAGE_DIR}"/{lib/gcc,libexec/gcc/install-tools,bin/${ARCH}-unknown-*}
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
144
1183
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
145 # Call binary package tarball "gcc", not "gcc-core".
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
146
61e7e9be8eb4 Add blank_workdir and make setupfor and cleanup use it. This means you can run an entire build.sh with NO_CLEANUP=1 on.
Rob Landley <rob@landley.net>
parents: 1164
diff changeset
147 PACKAGE=gcc cleanup