Skip to content

Commit

Permalink
Finished install function
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicStar7213 committed Dec 6, 2022
1 parent 34007ac commit 3454dcc
Showing 1 changed file with 86 additions and 8 deletions.
94 changes: 86 additions & 8 deletions gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ toolinstall() {
bin=2.39
linux=6.0.9
libc=2.36
PREFIX=/usr/local

echo -e "${BOLD}GCC Toolchain Manager Script${CN}"
echo
Expand Down Expand Up @@ -104,21 +105,21 @@ toolinstall() {
make menuconfig || die "${CPURP}linux-headers${CN}: \033[0;31mConfiguring failed"
echo -e "${CPURP}linux-headers${CN}: Configuring done"
echo -e "${CPURP}linux-headers${CN}: Building and installing..."
make headers_install || die "${CPURP}linux-headers${CN}: \033[0;31mBuilding failed"
make ARCH=$MACHTYPE INSTALL_HDR_PATH=$PREFIX headers_install || die "${CPURP}linux-headers${CN}: \033[0;31mBuilding failed"
echo -e "${CPURP}linux-headers${CN}: Building and installing done"
cd ..
duration=$(( SECONDS - start))
echo -e "${CPURP}linux-headers${CN}: Done in $duration"
echo -e "${CPURP}linux-headers${CN}: Done in ${duration}s"
echo -e "${CG}gcc${CN}: Starting..."
start=$SECONDS
mkdir -p build-gcc
cd build-gcc
echo -e "${CG}gcc:${CN} Configuring..."
../gcc-$version/configure --enable-languages=c,c++ --disable-multilib || die "${CNOTE}gcc:${CN} \033[0;31mConfiguring failed"
echo -e "${CG}gcc${CN}: Configuring done"
echo -e "${CG}gcc${CN}: Building..."
echo -e "${CG}gcc${CN}: Building compiler..."
if [ $(nproc) -le 4 ]; then
make all-gcc || die "${CG}gcc:${CN} ${CERR}Building failed${CN}"
make all-gcc || die "${CG}gcc${CN}: ${CERR}Building failed${CN}"
else
if [ $(nproc) -le 6 ]; then
make all-gcc -j2 || die "${CG}gcc${CN}: ${CERR}Building failed${CN}"
Expand All @@ -129,13 +130,90 @@ toolinstall() {
fi
fi
echo -e "${CG}gcc${CN}: Building done"
echo -e "${CG}gcc${CN}: Installing..."
echo -e "${CG}gcc${CN}: Installing compiler..."
make install-gcc || die "${CG}gcc${CN}: ${CERR}Installing failed${CN}"
echo -e "${CG}gcc${CN}: Installing done"
duration=$(( SECONDS - start))
echo -e "${CG}gcc${CN}: Done in $duration"
echo -e "${CWARN}glibc${CN}: Starting..."
duration=$(( SECONDS - start ))
echo -e "${CG}gcc${CN}: Done in ${duration}s"
echo -e "${CERR}${BOLD}glibc${CN}: Starting..."
start=$SECONDS
mkdir -p build-glibc
cd build-glibc
echo -e "${CERR}${BOLD}glibc${CN}: Configuring..."
../glibc-2.36/configure --disable-multilib libc_cv_forced_unwind=yes
echo -e "${CERR}${BOLD}glibc${CN}: Building and installing headers..."
make install-bootstrap-headers=yes install-headers || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building and installing failed"
echo -e "${CERR}${BOLD}glibc${CN}: Installing done"
echo -e "${CERR}${BOLD}glibc${CN}: Building startup files..."
if [ $(nproc) -le 4 ]; then
make csu/subdir_lib || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed${CN}"
else
if [ $(nproc) -le 6 ]; then
make csu/subdir_lib -j2 || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed${CN}"
elif [ $(nproc) -le 10 ]; then
make csu/subdir_lib -j4 || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed${CN}"
else
make csu/subdir_lib -j$(($(nproc) / 2)) || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed"
fi
fi
echo -e "${CERR}${BOLD}glibc${CN}: Building startup files done"
echo -e "${CERR}${BOLD}glibc${CN}: Installing startup files..."
install csu/crt1.o csu/crti.o csu/crtn.o $PREFIX/lib || die "${CERROR}${BOLD}glibc${CN}: ${CERROR}Installing failed"
echo -e "${CERR}${BOLD}glibc${CN}: Installing done"
echo -e "${CERR}${BOLD}glibc${CN}: Building extra files..."
gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $PREFIX/lib/libc.so || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed"
touch $PREFIX/include/gnu/stubs.h || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed"
echo -e "${CERR}${BOLD}glibc${CN}: Building extra files done"
cd ..
duration=$(( SECONDS - start ))
echo -e "${CERR}${BOLD}glibc${CN}: Done in ${duration}s"
echo -e "${CG}gcc${CN}: Libraries"
start=$SECONDS
cd build-gcc
echo -e "${CG}gcc${CN}: Building libraries..."
if [ $(nproc) -le 4 ]; then
make all-target-libgcc || die "${CG}gcc${CN}: ${CERR}Building failed${CN}"
else
if [ $(nproc) -le 6 ]; then
make all-target-libgcc -j2 || die "${CG}gcc${CN}: ${CERR}Building failed${CN}"
elif [ $(nproc) -le 10 ]; then
make all-target-libgcc -j4 || die "${CG}gcc${CN}: ${CERR}Building failed${CN}"
else
make all-target-libgcc -j$(($(nproc) / 2)) || die "${CG}gcc${CN}: ${CERR}Building failed"
fi
fi
echo -e "${CG}gcc${CN}: Building libraries done"
echo -e "${CG}gcc${CN}: Installing libraries.."
make install-target-libgcc || die "${CG}gcc${CN}: ${CERR}Installing failed"
echo -e "${CG}gcc${CN}: Installing done"
duration=$(( SECONDS - start ))
echo -e "${CG}gcc${CN}: Done in ${duration}s"
cd ..
echo -e "${CERR}${BOLD}glibc${CN}: Standard C Library"
start=$SECONDS
cd build-glibc
echo -e "${CERR}${BOLD}glibc${CN}: Building C Library..."
if [ $(nproc) -le 4 ]; then
make || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed"
else
if [ $(nproc) -le 6 ]; then
make -j2 || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed"
elif [ $(nproc) -le 10 ]; then
make -j4 || die "${CERR}${BOLD}glibc${CN}: ${CERR}Building failed"
else
make -j$(($(nproc) / 2)) || die "${CERR}${BOLD}glibc${CN}: ${CERROR}Building failed"
fi
fi
echo -e "${CERR}${BOLD}glibc${CN}: Building C Library done"
echo -e "${CERR}${BOLD}glibc${CN}: Installing C Library..."
make install || die "${CERR}${BOLD}glibc${CN}: Installing failed"
echo -e "${CERR}${BOLD}glibc${CN}: Installing C Library done"
duration=$(( SECONDS - start ))
echo -e "${CERR}${BOLD}glibc${CN}: Done in ${duration}s"
cd ..
duration1=$(( SECONDS - start1 ))
echo -e "${BOLD}Done in ${duration1}s${CN}"
echo -e "${BOLD} Complete GCC Toolchain installed${CN}"
fi
}

Expand Down

0 comments on commit 3454dcc

Please sign in to comment.