mirror of
https://git.planet-casio.com/Lephenixnoir/sh-elf-gcc.git
synced 2024-12-28 04:23:39 +01:00
6cbd8270ca
* Try to check dependencies with pacman or apt * Download and extract archives (supporting gzip and xz) * Configure and build GCC and binutils (redirecting output to file, hoping that everything goes well) * Clean up uneeded files after building * Check for conflicting builds of sh-elf-gcc in the PATH * Offer to update the profile to set the PATH at login
63 lines
1.4 KiB
Bash
Executable file
63 lines
1.4 KiB
Bash
Executable file
#! /usr/bin/env bash
|
|
|
|
binutils_version=$1
|
|
gcc_version=$2
|
|
tag="<sh-elf-gcc>"
|
|
root=$(pwd)
|
|
|
|
run_with_guard() {
|
|
out="$1"
|
|
shift 1
|
|
"$@" >$out 2>&1
|
|
if [[ "$?" != 0 ]]; then
|
|
echo "$tag error: build failed, please check $(pwd)/$out o(x_x)o"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Configure binutils
|
|
|
|
echo "$tag Configuring binutils..."
|
|
cd build-binutils
|
|
|
|
run_with_guard fxsdk-configure.log \
|
|
../binutils-$binutils_version/configure --prefix="$root" --target=sh3eb-elf --with-multilib-list=m3,m4-nofpu --program-prefix=sh-elf- --enable-libssp --enable-lto
|
|
|
|
# Build binutils
|
|
|
|
echo "$tag Compiling binutils (can take a couple of minutes)..."
|
|
|
|
run_with_guard fxsdk-build.log \
|
|
make -j$(nproc)
|
|
|
|
run_with_guard fxsdk-install.log \
|
|
make install
|
|
|
|
cd ..
|
|
|
|
# Configure GCC
|
|
|
|
echo "$tag Configuring gcc..."
|
|
cd build-gcc
|
|
|
|
run_with_guard fxsdk-configure.log \
|
|
../gcc-$gcc_version/configure --prefix="$root" --target=sh3eb-elf --with-multilib-list=m3,m4-nofpu --enable-languages=c,c++ --without-headers --with-newlib --program-prefix=sh-elf- --enable-libssp --enable-lto
|
|
|
|
# Build GCC
|
|
|
|
echo "$tag Compiling gcc (often takes 10-20 minutes)..."
|
|
|
|
run_with_guard fxsdk-build.log \
|
|
make -j$(nproc) all-gcc all-target-libgcc
|
|
|
|
run_with_guard fxsdk-install.log \
|
|
make install-gcc install-target-libgcc
|
|
|
|
cd ..
|
|
|
|
# Cleaning up everything
|
|
|
|
echo "$tag Cleaning up..."
|
|
|
|
rm -rf binutils-$binutils_version/ build-binutils/
|
|
rm -rf gcc-$gcc_version/ build-gcc
|