annotate sources/sections/gcc.sh @ 1130:c222ae88733a

Add NO_CPLUSPLUS config option, to skip c++ support entirely.
author Rob Landley <rob@landley.net>
date Sun, 20 Jun 2010 16:25:35 -0500
parents 1f51b4a0517b
children 3a959ee85558
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
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
3 # PROGRAM_PREFIX affects the name of the generated tools, ala "${ARCH}-".
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
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
7 setupfor gcc-core build-gcc
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
8 [ -z "$NO_CPLUSPLUS" ] && setupfor gcc-g++ build-gcc gcc-core
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
9
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
10 # 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
11 # 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
12
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 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
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 # 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
16 # 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
17
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 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
19 {
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
20 # 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
21 [ -z "$NO_CPLUSPLUS" ] &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
22 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
23 STUFF="--enable-languages=c"
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
24
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
25 # 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
26 "$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
27 --disable-multilib --disable-nls --enable-c99 --enable-long-long \
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
28 --enable-__cxa_atexit $STUFF --program-prefix="$PROGRAM_PREFIX" \
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
29 "$@" $GCC_FLAGS &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
30
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
31 # 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
32 # 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
33 # 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
34 mkdir -p gcc &&
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
35 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
36 }
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
37
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
38 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
39 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
40 # 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
41 # 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
42
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 # 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
44 # 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
45 # 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
46 # 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
47
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 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
49 --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
50 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
51 # 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
52 # 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
53
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 # 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
55 # 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
56
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
57 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
58 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
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 --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
70 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
71
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 # 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
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 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
75 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
76
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
77 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
78
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
79 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
80 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
81 # 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
82 # 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
83 # 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
84
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 # 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
86 # ./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
87 # 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
88 # 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
89 # 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
90
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 make -j $CPUS configure-target-libstdc++-v3 &&
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 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
93 make -j $CPUS &&
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
94 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
95 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
96 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
97
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
98 # 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
99 # always notice.
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
100
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
101 ln -s lib "$STAGE_DIR/lib64" &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
102 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
103 rm "$STAGE_DIR/lib64" || dienow
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
104
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
105 # 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
106
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
107 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
108 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
109 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
110
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
111 # Move the compiler internal binaries into "tools"
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
112 ln -s "$CROSS_TARGET" "$STAGE_DIR/tools" &&
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
113 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
114 rm -rf "$STAGE_DIR/libexec" || dienow
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
115
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
116 # collect2 is evil, kill it.
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
117 # 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
118
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
119 # 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
120
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
121 mv "$STAGE_DIR/bin/${PROGRAM_PREFIX}gcc" "$STAGE_DIR/tools/bin/cc" &&
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
122 ln -sf "${PROGRAM_PREFIX}cc" "$STAGE_DIR/bin/${PROGRAM_PREFIX}gcc" &&
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
123 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
124
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
125 # 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
126
1130
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
127 if [ -z "$NO_CPLUSPLUS" ]
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
128 then
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
129 mv "$STAGE_DIR/bin/${PROGRAM_PREFIX}g++" "$STAGE_DIR/tools/bin/c++" &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
130 ln -sf "${PROGRAM_PREFIX}cc" "$STAGE_DIR/bin/${PROGRAM_PREFIX}g++" &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
131 ln -sf "${PROGRAM_PREFIX}cc" "$STAGE_DIR/bin/${PROGRAM_PREFIX}c++" &&
c222ae88733a Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents: 1127
diff changeset
132 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
133 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
134
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
135 # 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
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 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
138 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
139 [ -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
140
914
8a698351f241 Tweak sequencing to build cross-static properly.
Rob Landley <rob@landley.net>
parents: 909
diff changeset
141 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
142
1079
ce7cc07f44b3 Fix alt-gcc build and remove alt-patches for gcc and binutils.
Rob Landley <rob@landley.net>
parents: 937
diff changeset
143 # Little dance so binary package tarball would be called "gcc", not "gcc-core".
ce7cc07f44b3 Fix alt-gcc build and remove alt-patches for gcc and binutils.
Rob Landley <rob@landley.net>
parents: 937
diff changeset
144 mv "$WORK"/{*gcc-core,gcc}
909
1720e1d988db Deleting the gcc build directory has to happen from the right current working directory.
Rob Landley <rob@landley.net>
parents: 905
diff changeset
145 PACKAGE=gcc cleanup build-gcc