blob: 5b32da0e146518e49d1e2e11b16659fbd7408ddf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# cc1 compilation fails if the file blocks limit is too low
ulimit -f unlimited &&
. "$GRIMOIRE/FUNCTIONS" &&
# using -pipe causes spurious test-suite failures
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
CFLAGS=${CFLAGS/-pipe/} &&
CXXFLAGS=${CXXFLAGS/-pipe/} &&
if list_find "$GCC_COMPILER" "fortran"; then
OPTS+=" --enable-libquadmath"
else
OPTS+=" --disable-libquadmath"
fi &&
persistent_read gmp GMP_BUILD_ARCH GMP_BUILD_ARCH &&
persistent_read mpfr MPFR_BUILD_ARCH MPFR_BUILD_ARCH &&
if [[ $GMP_BUILD_ARCH != ${SMGL_COMPAT_ARCHS[4]}
|| $MPFR_BUILD_ARCH != ${SMGL_COMPAT_ARCHS[4]} ]]; then
message "${PROBLEM_COLOR}" 1>&2 &&
message "gmp and/or mpfr have been built with a different archspec, building gcc now" 1>&2 &&
message "would result in a broken compiler" 1>&2 &&
message "${DEFAULT_COLOR}" 1>&2
return 1
fi &&
# install gcc libraries to /lib instead of /lib64
sedit "s/lib64/lib/" gcc/config/i386/linux64.h &&
# tell gcc to target binaries to expect the linker in /lib instead of /lib64
sedit "s/lib64/lib/" gcc/config/i386/t-linux64 &&
if [[ "$ARCHITECTURE" == "pentium4" ||
"$ARCHITECTURE" == "pentium-m" ]]; then
CFLAGS=${CFLAGS//-ffast-math/}
CXXFLAGS=${CXXFLAGS//-ffast-math/}
fi &&
# fixes seg-fault on libiberty/splay.c in v 4.3.2
if is_version_less $(installed_version $SPELL) 5.0.0; then
CFLAGS="-O1 $CFLAGS"
fi &&
if [[ $CROSS_INSTALL == on ]]; then
OPTS="--host=$HOST $OPTS"
else
OPTS="--build=$HOST $OPTS"
fi &&
# store CFLAGS and LDFLAGS persistently so they can be read by the other
# split spells later, see bug #10087
GCC_CFLAGS="$CFLAGS" &&
GCC_LDFLAGS="$LDFLAGS" &&
persistent_add GCC_CFLAGS GCC_LDFLAGS &&
# when updating this spell please check if this is still necessary:
if [[ $GCJ_AWT == y ]]; then
CFLAGS="$CFLAGS -I${INSTALL_ROOT}/usr/include/freetype2"
fi &&
if list_find "$GCC_COMPILER" "ada" ; then
# setup bootstrap ada compiler
ADA_PATH=${SOURCE13/.tar.bz2/} &&
PATH=$SOURCE_DIRECTORY/$ADA_PATH/bin:$PATH &&
export CC="$SOURCE_DIRECTORY/$ADA_PATH/bin/gcc" &&
export INCLUDE_DIR="$SOURCE_DIRECTORY/$ADA_PATH/lib/gcc/$HOST/${VERSION13}/include" &&
export LIB_DIR="$SOURCE_DIRECTORY/$ADA_PATH/lib/gcc/$HOST/${VERSION13}/" &&
export LDFLAGS="-L${LIB_DIR}" &&
export LIBRARY_PATH="$LIB_DIR" &&
export LD_LIBRARY_PATH="$LIB_DIR" &&
export COMPILER_PATH="$SOURCE_DIRECTORY/$ADA_PATH/bin" &&
export ADA_OBJECTS_PATH="$LIB_DIR/adalib" &&
export ADA_INCLUDE_PATH="$LIB_DIR/adainclude" &&
OPTS="--enable-libada $OPTS"
fi &&
OPTS="$GCJ_HOME $OPTS" &&
OPTS="--prefix=${INSTALL_ROOT}/usr $OPTS" &&
OPTS="--libdir=${INSTALL_ROOT}/usr/lib $OPTS" &&
OPTS="--libexecdir=${INSTALL_ROOT}/usr/lib $OPTS" &&
OPTS="--mandir=${INSTALL_ROOT}/usr/share/man $OPTS" &&
OPTS="--infodir=${INSTALL_ROOT}/usr/share/info $OPTS" &&
OPTS="--with-bugurl=http://bugs.sourcemage.org $OPTS" &&
OPTS="--enable-languages=${GCC_COMPILER// /,},lto $OPTS" &&
OPTS="--enable-shared $OPTS" &&
OPTS="--enable-threads=posix $OPTS" &&
OPTS="--enable-__cxa_atexit $OPTS" &&
OPTS="--disable-libunwind-exceptions $OPTS" &&
OPTS="--enable-clocale=gnu $OPTS" &&
OPTS="--disable-libstdcxx-pch $OPTS" &&
OPTS="--enable-bootstrap $OPTS" &&
OPTS="--enable-gnu-unique-object $OPTS" &&
OPTS="--enable-linker-build-id $OPTS" &&
if [[ "$GCC_CLOOG" == "y" ]]; then
OPTS="--enable-cloog-backend=isl $OPTS" &&
OPTS="--disable-isl-version-check $OPTS"
else
OPTS="--without-isl --without-cloog $OPTS"
fi &&
OPTS="--enable-plugin $OPTS" &&
OPTS="--enable-install-libiberty $OPTS" &&
OPTS="--with-linker-hash-style=gnu $OPTS" &&
OPTS="--disable-werror $OPTS" &&
OPTS="--enable-checking=release $OPTS" &&
OPTS="--enable-default-pie $OPTS" &&
OPTS="--enable-default-ssp $OPTS" &&
OPTS="--enable-cet=auto $OPTS" &&
OPTS="--enable-lto $OPTS" &&
OPTS="$GCC_MULTILIB $OPTS" &&
case "$HOST" in
*-musl)
OPTS="--disable-multilib $OPTS" &&
OPTS="--disable-libssp $OPTS" &&
OPTS="--disable-libmpx $OPTS" &&
OPTS="--disable-libmudflap $OPTS" &&
OPTS="--disable-libsanitizer $OPTS" &&
OPTS="--disable-symvers $OPTS"
;;
esac &&
# https://sourceware.org/bugzilla/show_bug.cgi?id=21930
export glibcxx_cv_c99_math_cxx98=yes glibcxx_cv_c99_math_cxx11=yes &&
cd $SOURCE_DIRECTORY.bld &&
$SOURCE_DIRECTORY/configure $OPTS &&
if is_version_less $(installed_version $SPELL) 4.9.0; then
if ! spell_ok gcc49; then
message "${PROBLEM_COLOR}" 1>&2 &&
message "This version of gcc needs gcc >= 4.9.0 to be able to compile. Spell" 1>&2 &&
message "gcc49 is available to support this, but is not found to be installed." 1>&2 &&
message "Please cast gcc49 first." 1>&2 &&
message "${DEFAULT_COLOR}" 1>&2
return 1
fi
make CC=/opt/gcc49/bin/gcc CXX=/opt/gcc49/bin/g++ CPP=/opt/gcc49/bin/cpp \
CFLAGS="$CFLAGS" BOOT_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $GCC_TARGET
else
make CFLAGS="$CFLAGS" BOOT_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $GCC_TARGET
fi
|