CI: build in ci, more streamlined toolchain

Reviewed-on: #2
Co-authored-by: Stepan Usatiuk <stepan@usatiuk.com>
Co-committed-by: Stepan Usatiuk <stepan@usatiuk.com>
This commit is contained in:
2024-04-28 08:36:50 +02:00
committed by Stepan Usatiuk
parent bf31f41d9a
commit df13f41be2
15 changed files with 245 additions and 62 deletions

45
ficus-toolchain/build-all.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -euxo pipefail
if [ -z "$FICUS_ROOT" ]; then
echo "$FICUS_ROOT" is blank
fi
export SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
export PREFIX="$FICUS_ROOT/toolchain/gcc-x86_64-ficus-prefix/"
export TARGET=x86_64-ficus
export PATH="$PREFIX/bin:$PATH"
cd "$SCRIPT_DIR"
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi
if [ -z "${BUILD_PARALLEL}" ]
then
export BUILD_PARALLEL=$(nproc)
fi
if [ -z "${BUILD_PARALLEL_GCC}" ]
then
export BUILD_PARALLEL_GCC=$BUILD_PARALLEL
fi
if [[ "$1" != "s2only" ]]
then
"$SCRIPT_DIR"/build-s1.sh
cd "$SCRIPT_DIR"
fi
if [[ "$1" = "s1only" ]]
then exit 0
fi
mkdir -p "$FICUS_ROOT/sysroot"
"$SCRIPT_DIR"/build-newlib.sh
cd "$SCRIPT_DIR"
"$SCRIPT_DIR"/build-s2.sh
cd "$SCRIPT_DIR"

View File

@@ -14,7 +14,7 @@ cd newlib
# rm -rf build
mkdir -p build
cd build
#../newlib-4.4.0.20231231/configure --enable-newlib-supplied-syscalls --prefix=/usr --target=$TARGET
make -j$(nproc) all
../newlib-4.4.0.20231231/configure --enable-newlib-supplied-syscalls --prefix=/usr --target=$TARGET
make -j$BUILD_PARALLEL all
make DESTDIR="$FICUS_ROOT/sysroot" install
cp -r "$FICUS_ROOT/sysroot/usr"/x86_64-ficus/* "$FICUS_ROOT/sysroot/usr"

48
ficus-toolchain/build-s1.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
set -euxo pipefail
if [ -z "$FICUS_ROOT" ]; then
echo "$FICUS_ROOT" is blank
exit 1
fi
if [ -z "$PREFIX" ]; then
echo "PREFIX" is blank
exit 1
fi
if [ -z "$SCRIPT_DIR" ]; then
echo "SCRIPT_DIR" is blank
exit 1
fi
cd "$SCRIPT_DIR"
mkdir -p "$FICUS_ROOT/sysroot"
cd binutils-x86_64-ficus
mkdir -p build
cd build
../binutils-2.41/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot="$PREFIX/../../sysroot" --disable-nls --disable-werror
make -j$(nproc)
make install
cd ../../
cd gcc-x86_64-ficus
rm -rf build
mkdir -p build
cd build
pushd ../gcc-13.2.0/
./contrib/download_prerequisites
popd
../gcc-13.2.0/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot="$PREFIX/../../sysroot" --disable-nls --enable-languages=c,c++ --with-newlib --without-headers --disable-fixincludes --enable-version-specific-runtime-libs
make -j$(nproc) all-gcc
make -j$(nproc) all-target-libgcc
make install-gcc
make install-target-libgcc
find "$PREFIX" -exec strip {} \;
cd ../../

39
ficus-toolchain/build-s2.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
set -euxo pipefail
if [ -z "$FICUS_ROOT" ]; then
echo "$FICUS_ROOT" is blank
exit 1
fi
if [ -z "$PREFIX" ]; then
echo "PREFIX" is blank
exit 1
fi
if [ -z "$SCRIPT_DIR" ]; then
echo "SCRIPT_DIR" is blank
exit 1
fi
cd "$SCRIPT_DIR"
cd gcc-x86_64-ficus
rm -rf build
mkdir -p build
cd build
pushd ../gcc-13.2.0/
./contrib/download_prerequisites
popd
../gcc-13.2.0/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot="$PREFIX/../../sysroot" --disable-nls \
--enable-languages=c,c++ --with-newlib --disable-fixincludes --disable-libstdcxx-threads \
--enable-version-specific-runtime-libs
make -j$BUILD_PARALLEL_GCC all-gcc
make -j$BUILD_PARALLEL all-target-libgcc
make -j$BUILD_PARALLEL all-target-libstdc++-v3
make install-gcc
find "$PREFIX" -exec strip {} \;
make install-target-libgcc
make install-target-libstdc++-v3

View File

@@ -1,51 +0,0 @@
#!/bin/bash
set -euxo pipefail
if [ -z "$FICUS_ROOT" ]; then
echo "$FICUS_ROOT" is blank
fi
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
export PREFIX="$FICUS_ROOT/toolchain/gcc-x86_64-ficus-prefix/"
export TARGET=x86_64-ficus
export PATH="$PREFIX/bin:$PATH"
cd "$SCRIPT_DIR"
mkdir -p "$FICUS_ROOT/sysroot"
cd binutils-x86_64-ficus
mkdir -p build
cd build
../binutils-2.41/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot="$FICUS_ROOT/sysroot" --disable-nls --disable-werror
make -j$(nproc)
make install
cd ../../
cd gcc-x86_64-ficus
rm -rf build
mkdir -p build
cd build
../gcc-13.2.0/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot="$FICUS_ROOT/sysroot" --disable-nls --enable-languages=c,c++ --with-newlib --without-headers --enable-version-specific-runtime-libs --with-gmp=/opt/homebrew --with-mpc=/opt/homebrew --with-mpfr=/opt/homebrew
make -j$(nproc) all-gcc
make -j$(nproc) all-target-libgcc
make install-gcc
make install-target-libgcc
cd ../../
"$SCRIPT_DIR"/build-newlib.sh
cd gcc-x86_64-ficus
rm -rf build
mkdir -p build
cd build
../gcc-13.2.0/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot="$FICUS_ROOT/sysroot" --disable-nls \
--enable-languages=c,c++ --with-newlib --disable-libstdcxx-threads \
--enable-version-specific-runtime-libs --with-gmp=/opt/homebrew --with-mpc=/opt/homebrew --with-mpfr=/opt/homebrew
make -j$(nproc) all-gcc
make -j$(nproc) all-target-libgcc
make -j$(nproc) all-target-libstdc++-v3
make install-gcc
make install-target-libgcc
make install-target-libstdc++-v3