blob: d8076bbdf17dd494a3f7ad46d9c45fdcafe61692 (
plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
#
# . ./build.vars and set -o errexit -o noglob are assumed.
#
if [ "${3}" = mingw_w64 ]; then
TARGET=x86_64-w64-mingw32;
if [ ! -L ${PKG_PREFIX}/mingw ]; then
secure_rm ${PKG_PREFIX}/mingw;
ln -sf . ${PKG_PREFIX}/mingw;
fi;
fi;
# Order: stage1, runtime, full, native
export MAKE="make LIBTOOL=slibtool";
if [ "${2}" = runtime ]\
|| [ "${2}" = libstdc++-v3 ]\
|| [ "${2}" = full ]; then
set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross;
cd ${PKG_BUILD_DIR};
if [ "${2}" = runtime ]; then
# GCC, compiler runtime.
if ! is_build_script_done build; then
make ${MAKEFLAGS} all-target-libgcc;
set_build_script_done build -install;
fi;
if ! is_build_script_done install; then
make ${MAKEFLAGS} install-target-libgcc;
set_build_script_done install finish;
fi;
elif [ "${2}" = libstdc++-v3 ]; then
# GCC, libstdc++-v3.
if ! is_build_script_done build; then
make ${MAKEFLAGS} all-target-libstdc++-v3;
set_build_script_done build -install;
fi;
if ! is_build_script_done install; then
make ${MAKEFLAGS} install-target-libstdc++-v3;
set_build_script_done install finish;
fi;
elif [ "${2}" = full ]; then
# GCC, everything else.
if ! is_build_script_done build; then
make ${MAKEFLAGS};
set_build_script_done build -install;
fi;
if ! is_build_script_done install; then
make ${MAKEFLAGS} install;
set_build_script_done install finish;
fi;
fi;
else
if [ "${2}" = stage1 ]\
|| [ "${2}" = host ]; then
# GCC, stage1.
if ! is_build_script_done fetch; then
fetch_git cbb-gcc-${PKG_GCC_VERSION} \
${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION};
set_build_script_done fetch -configure;
fi;
set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross;
export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \
cbb_sysroot_for_libgcc=${PKG_PREFIX} \
cbb_target=${TARGET} \
cbb_neutral_libiberty=no \
cbb_xgcc_for_specs=${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc;
GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}";
elif [ "${2}" = native ]; then
# GCC, native.
set_build_dir cbb-gcc-${PKG_GCC_VERSION} native;
export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \
cbb_sysroot_for_libgcc=${PKG_PREFIX} \
cbb_target=${TARGET} \
cbb_xgcc_for_specs=${TARGET}-gcc \
sysroot_headers_suffix=${PKG_PREFIX};
GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}";
fi;
GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)";
for __ in CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; do
export "${__}=${GCCFLAGS}";
done;
for __ in CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET; do
export "${__}=${GCCTARGET_FLAGS}";
done;
for __ in cbb_cflags_for_stage1 cbb_cflags_for_stage2 cbb_cflags_for_stage3 cbb_cflags_for_stage4; do
export "${__}=${CFLAGS_FOR_BUILD}" ;
done;
export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET;
if ! is_build_script_done configure; then
if [ "${2}" = stage1 ]\
|| [ "${2}" = host ]; then
insecure_mkdir ${PKG_PREFIX}/include;
[ \! -d ${PKG_PREFIX}/usr ] && \
ln -s -- . ${PKG_PREFIX}/usr;
_configure_args="--prefix=${PREFIX} --with-sysroot=${PKG_PREFIX}";
elif [ "${2}" = native ]; then
insecure_mkdir ${PKG_PREFIX}/${TARGET};
if [ \! -d ${PKG_PREFIX}/${TARGET}/usr ]; then
ln -s -- . ${PKG_PREFIX}/${TARGET}/usr;
fi;
if [ "${ARCH}" = nt32 ]; then
_configure_args="--host=i686-nt32-midipix";
else
_configure_args="--host=x86_64-nt64-midipix";
fi;
_configure_args="${_configure_args} \
--prefix=/ \
--with-elf=${PKG_PREFIX} \
--with-gmp=${PKG_PREFIX} \
--with-mpc=${PKG_PREFIX} \
--with-mpfr=${PKG_PREFIX} \
--with-sysroot=";
fi;
if [ "${TARGET#*mingw*}" != "${TARGET}" ]; then
_configure_args="${_configure_args} \
--enable-sjlj-exceptions";
if [ "${2}" != host ]; then
_configure_args="${_configure_args} \
--host=${TARGET} \
--without-headers";
export AR=${PKG_TARGET}-ar;
export AS=${PKG_TARGET}-as;
export CC=${PKG_TARGET}-gcc;
export CXX=${PKG_TARGET}-c++;
export RANLIB=${PKG_TARGET}-ranlib;
fi;
else
_configure_args="${_configure_args} \
--disable-sjlj-exceptions";
fi;
secure_rm ${PKG_BUILD_DIR};
insecure_mkdir ${PKG_BUILD_DIR};
secure_cd ${PKG_BUILD_DIR};
../cbb-gcc-${PKG_GCC_VERSION}/configure \
--disable-bootstrap \
--disable-libmudflap \
--disable-multilib \
--disable-nls \
--disable-obsolete \
--disable-symvers \
--enable-canonical-system-headers \
--enable-__cxa_atexit \
--enable-debug \
--enable-gnu-indirect-function \
--enable-gnu-unique-object \
--enable-initfini-array \
--enable-languages=c,c++,objc,lto \
--enable-libstdcxx-debug \
--enable-lto \
--enable-multiarch \
--enable-secureplt \
--enable-shared \
--enable-threads=posix \
--target=${TARGET} \
--with-fpmath=sse \
${_configure_args};
set_build_script_done configure clean -build;
else
cd ${PKG_BUILD_DIR};
fi;
if ! is_build_script_done clean; then
make ${MAKEFLAGS} clean;
set_build_script_done clean -build;
fi;
if ! is_build_script_done build; then
if [ "${2}" = stage1 ]\
|| [ "${2}" = host ]; then
make ${MAKEFLAGS} all-gcc;
elif [ "${2}" = native ]; then
make ${MAKEFLAGS} all-gcc;
make ${MAKEFLAGS} all-target-libgcc;
make ${MAKEFLAGS} all-target-libstdc++-v3;
make ${MAKEFLAGS} all;
fi;
set_build_script_done build -install;
fi;
if ! is_build_script_done install; then
if [ "${2}" = stage1 ]\
|| [ "${2}" = host ]; then
make ${MAKEFLAGS} install-gcc;
__="$(uname -s)";
if [ "${__#*CYGWIN*}" != "${__}" ]; then
ln -s -- ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a \
ln -s -- ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.so;
fi;
elif [ "${2}" = native ]; then
make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} install;
fi;
set_build_script_done install finish;
fi;
fi;
# vim:filetype=sh
|