summaryrefslogtreecommitdiffstats
path: root/build/unix/build-gcc/build-gcc.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /build/unix/build-gcc/build-gcc.sh
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/unix/build-gcc/build-gcc.sh')
-rwxr-xr-xbuild/unix/build-gcc/build-gcc.sh64
1 files changed, 64 insertions, 0 deletions
diff --git a/build/unix/build-gcc/build-gcc.sh b/build/unix/build-gcc/build-gcc.sh
new file mode 100755
index 0000000000..0a27af1ecd
--- /dev/null
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+set -e
+set -x
+
+make_flags="-j$(nproc)"
+
+apply_patch() {
+ if [ $# -ge 2 ]; then
+ pushd $root_dir/$1
+ shift
+ else
+ pushd $root_dir/gcc-source
+ fi
+ patch -p1 < $1
+ popd
+}
+
+build_binutils() {
+ # if binutils_configure_flags is not set at all, give it the default value
+ if [ -z "${binutils_configure_flags+xxx}" ];
+ then
+ # gold is disabled because we don't use it on automation, and also we ran into
+ # some issues with it using this script in build-clang.py.
+ #
+ # --enable-targets builds extra target support in ld.
+ # Enabling aarch64 support brings in arm support, so we don't need to specify that too.
+ #
+ # It is important to have the binutils --target and the gcc --target match,
+ # so binutils will install binaries in a place that gcc will look for them.
+ binutils_configure_flags="--enable-targets=aarch64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu --disable-gold --enable-plugins --disable-nls --with-sysroot=/"
+ fi
+
+ mkdir $root_dir/binutils-objdir
+ pushd $root_dir/binutils-objdir
+ ../binutils-source/configure --prefix=${prefix-/tools/gcc}/ $binutils_configure_flags
+ make $make_flags
+ make install $make_flags DESTDIR=$root_dir
+ export PATH=$root_dir/${prefix-/tools/gcc}/bin:$PATH
+ popd
+}
+
+build_gcc() {
+ # Be explicit about --build and --target so header and library install
+ # directories are consistent.
+ local target="${1:-x86_64-unknown-linux-gnu}"
+
+ mkdir $root_dir/gcc-objdir
+ pushd $root_dir/gcc-objdir
+
+ if [ -d $MOZ_FETCHES_DIR/sysroot ]; then
+ EXTRA_CONFIGURE_FLAGS="--with-build-sysroot=$MOZ_FETCHES_DIR/sysroot"
+ export CFLAGS_FOR_BUILD="--sysroot=$MOZ_FETCHES_DIR/sysroot"
+ fi
+ ../gcc-source/configure --prefix=${prefix-/tools/gcc} --build=x86_64-unknown-linux-gnu --target="${target}" --enable-languages=c,c++ --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro --with-sysroot=/ $EXTRA_CONFIGURE_FLAGS
+ make $make_flags
+ make $make_flags install-strip DESTDIR=$root_dir
+
+ cd $root_dir/tools
+ ln -s gcc gcc/bin/cc
+
+ tar caf $root_dir/gcc.tar.zst gcc/
+ popd
+}