3 # SPDX-FileCopyrightText: 2024 Kienan Stewart <kstewart@efficios.com
4 # SPDX-License-Identifier: GPL-2.0-or-later
7 SRC_DIR
="${SRC_DIR:-/src/gcc-releases-gcc-4.8.5}"
8 PATCH_DIR
="${PATCH_DIR:-/src/patches}"
9 BIN_SUFFIX
="${BIN_SUFFIX:-4.8}"
10 IFS
=' ' read -r -a TARGETS
<<< "${TARGETS:-aarch64-linux-gnu}"
11 HOST
="${HOST:-x86_64-pc-linux-gnu}"
12 CONFIGURE_ARGS
=(${CONFIGURE_ARGS:-})
13 MAKE_ARGS
=(${MAKE_ARGS:-})
14 MAKE_INSTALL_ARGS
=(${MAKE_INSTALL_ARGS:-})
17 CXXSTD
="${CXXSTD:-gnu++98}"
21 cd "${SRC_DIR}" ||
exit 1
22 while read -r line
; do
23 EXT
=$
(echo "$line" |
rev | cut
-d.
-f1 |
rev)
25 if [[ "${EXT}" =~
[0-9]+ ]] ; then
28 patch -p"${PATCH_LEVEL}" < "${line}"
29 done < <(find "${PATCH_DIR}" -type f |
sort)
31 NPROC
="${NPROC:=$(nproc)}"
32 CFLAGS
=(-std="${CSTD}" -w)
33 CXXFLAGS
=(-std="${CXXSTD}" -w)
36 cd "${SRC_DIR}" ||
exit 1
37 mkdir
-p "/output/usr/local/gcc${BIN_SUFFIX}"
38 .
/contrib
/download_prerequisites
39 PREREQS
=(gmp isl mpfr mpc
)
40 for PREREQ
in "${PREREQS[@]}" ; do
41 cd "${SRC_DIR}/${PREREQ}" ||
continue
43 --prefix="/usr/local/gcc${BIN_SUFFIX}"
48 --with-gmp-prefix="/usr/local/gcc${BIN_SUFFIX}"
53 --with-gmp="/usr/local/gcc${BIN_SUFFIX}"
54 --with-mpfr="/usr/local/gcc${BIN_SUFFIX}"
58 ARGS
+=(--with-gmp="/usr/local/gcc${BIN_SUFFIX}")
61 .
/configure
"${ARGS[@]}"
67 cd "${BUILD_DIR}" ||
exit 1
69 for TARGET
in "${TARGETS[@]}" ; do
70 echo "*** Building for target: ${TARGET} ***"
72 mkdir
-p "${BUILD_DIR}"
73 cd "${BUILD_DIR}" ||
continue
76 PROGRAM_PREFIX
="${TARGET}-"
80 --enable-fix-cortex-a64-84319
97 powerpc64le-linux-gnu
)
98 # Disable multilib so that ppc64el kernel can be built, since
99 # legacy Makefiles compile vdso in 32bits unconditionally.
100 # @see https://bugzilla.redhat.com/show_bug.cgi?id=1237363
101 # @see https://bugzilla.redhat.com/show_bug.cgi?id=1205236
102 # @see https://bugs.launchpad.net/ubuntu/trusty/+source/linux/+bug/1433809/
105 --enable-targets=powerpcle-linux
107 --with-long-double-128
112 '--disable-softfloat'
114 '--enable-targets=powerpc-linux,powerpc64-linux'
115 '--with-cpu=default32'
116 '--with-long-double-128'
120 echo "Not supported in gcc-4.8"
126 --with-long-double-128
134 echo "Unrecognized target: ${TARGET}"
138 mkdir
-p "/output/usr/local/gcc${BIN_SUFFIX}/lib/gcc-cross/${TARGET}" /output
/usr
/local
141 "${SRC_DIR}/configure" --build="${HOST}" --host="${HOST}" --enable-languages=c
,c
++ \
142 --program-prefix="${PROGRAM_PREFIX}" --target="${TARGET}" --program-suffix="-${BIN_SUFFIX}" \
143 --prefix="/usr/local/gcc${BIN_SUFFIX}" --with-system-zlib \
144 --libexecdir="/usr/local/gcc${BIN_SUFFIX}/lib/" \
145 --libdir="/usr/local/gcc${BIN_SUFFIX}/lib/" \
146 --includedir="/usr/local/gcc${BIN_SUFFIX}/${TARGET}/include" \
147 --disable-bootstrap --disable-nls --disable-shared --enable-host-shared \
148 --enable-threads=posix
--enable-default-pie --with-sysroot=/ \
149 --without-target-system-zlib --enable-multiarch \
150 --with-isl="/usr/local/gcc${BIN_SUFFIX}" \
151 --with-gmp="/usr/local/gcc${BIN_SUFFIX}" \
152 --with-mpfr="/usr/local/gcc${BIN_SUFFIX}" \
153 --with-mpc="/usr/local/gcc${BIN_SUFFIX}" \
154 "${TARGET_ARGS[@]}" "${CONFIGURE_ARGS[@]}" \
155 CFLAGS
="${CFLAGS[*]}" CXXFLAGS
="${CXXFLAGS[*]}"
157 # This avoids building libgcc and binutils
158 # Copy include files from gcc-12 cross prior to build
159 mkdir
-p "/usr/local/gcc${BIN_SUFFIX}/${TARGET}/lib"
160 mkdir
-p "/usr/local/gcc${BIN_SUFFIX}/bin/"
161 cp -r "/usr/lib/gcc-cross/${TARGET}/12/"* "/usr/local/gcc${BIN_SUFFIX}/${TARGET}/"
162 cp -r "/usr/lib/gcc/x86_64-linux-gnu/12/"* "/usr/local/gcc${BIN_SUFFIX}/${TARGET}/lib/"
163 cp -r "/usr/${TARGET}/"* "/usr/local/gcc${BIN_SUFFIX}/${TARGET}/"
164 # And the binutils binaries
165 cp "/usr/bin/${TARGET}-"* "/usr/local/gcc${BIN_SUFFIX}/bin/"
167 make -j"${NPROC}" "${MAKE_ARGS[@]}" CFLAGS="${CFLAGS[*]}" CXXFLAGS="${CXXFLAGS[*]}" \
168 LD_LIBRARY_PATH
="/usr/local/gcc${BIN_SUFFIX}/lib:${LD_LIBRARY_PATH}"
169 # Do not use -jN with make install, it often breaks.
170 make install "${MAKE_INSTALL_ARGS[@]}" \
171 LD_LIBRARY_PATH
="/usr/local/gcc${BIN_SUFFIX}/lib:${LD_LIBRARY_PATH}"
173 if [ -n "${DEBUG}" ] ; then
174 echo $
(($
(date +%s
) - START
)) > "/output/${TARGET}.time"
177 cp config.log
"/output/config-${TARGET}.log"
180 cp -r "/usr/local/gcc${BIN_SUFFIX}" "/output/usr/local/"
183 # 1. Copy the output tarball from the Makefile to a Debian bookworm instance
184 # 2. Unpack, eg. `tar -xzf gcc55.tar.gz -C /`
185 # 3. Build a small test program, eg.
186 # LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gcc5.5/bin \
187 # PATH=$PATH:/usr/local/gcc5.5/bin \
188 # aarch64-linux-gnu-gcc-5.5 -o hello hello.c
189 # 4. Copy the built binary to a system with that native architecture and run it
190 # 5. Upload to object storage, eg.
191 # s3cmd put gcc55.tar.gz s3://jenkins/gcc-5.5-x86_64-linux-gnu-cross.tgz
This page took 0.039822 seconds and 4 git commands to generate.