diff --git a/danio_gcc.sh b/danio_gcc.sh index a8ca3ed..af7f942 100644 --- a/danio_gcc.sh +++ b/danio_gcc.sh @@ -5,6 +5,7 @@ export OUT="`pwd`/out" #### JEŚLI BĘDĄ NOWE WERSJE BINUTILS'A i GCC PROSZĘ ZMIENIĆ NUMER!!! export binutils_version="2.31" #TU ZMIENIAMY! +export newlib_version="3.0.0" #TU ZMIENIAMY! export version="LATEST-9" #TU ZMIENIAMY! export nproc=$(( `grep -c "processor" /proc/cpuinfo` * 2 )) export binutils_ext="tar.xz" #TU POD ŻADNYM POZOREM NIE ZMIENIAJ TYPU!!!!! @@ -17,24 +18,21 @@ if ! command -v lftp >/dev/null; then fi if [ "${REMOVE}" == "1" ]; then - rm -rf binutils-* build-* ${version} gcc-* */* zen-kernel-* + rm -rf binutils-* build-* ${gcc_version} gcc-* */* newlib-* fi ( if [ ! -e binutils-${binutils_version}${binutils_ext} ]; then - wget -c http://ftp.gnu.org/gnu/binutils/binutils-${binutils_version}.${binutils_ext} + wget -c "http://ftp.gnu.org/gnu/binutils/binutils-${binutils_version}.${binutils_ext}" fi if [ ! -d binutils-${binutils_version} ]; then tar -xf binutils-*.* fi ) || exit 1 -mkdir -pv build-binutils -cd build-binutils -../binutils-*/configure --target="${TARGET}" --prefix="${PREFIX}" --disable-nls --disable-werror --with-sysroot="${PREFIX}" --enable-obsolete -cd .. - if ! ( + mkdir -pv build-binutils + (cd build-binutils; ../binutils-*/configure --target="${TARGET}" --prefix="${PREFIX}" --disable-nls --disable-werror --enable-obsolete) make -C build-binutils -j${nproc} make -C build-binutils -j${nproc} install ) @@ -44,21 +42,26 @@ fi ( if [ ! -e */gcc-*.* ]; then - lftp -c "open ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots ; mirror ${version}" + lftp -c "open ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots ; mirror ${gcc_version}" fi if [ ! -d gcc-* ]; then tar -xf */gcc-*.* fi ) || exit 1 -(cd gcc-*; contrib/download_prerequisites) - -mkdir -pv build-gcc +( + if [ ! -e newlib-*.tar.gz ]; then + wget -c "ftp://sources.redhat.com/pub/newlib/newlib-${newlib_version}.tar.gz" + fi + if [ ! -d newlib-* ]; then + tar -xf newlib-*.tar.gz + fi +) || exit 1 if ! ( - cd build-gcc - ../gcc-*/configure --target=${TARGET} --prefix=${PREFIX} --disable-lto --disable-nls --disable-werror --enable-languages=all --enable-multilib --enable-multiarch --with-pkgversion="*DANiO* T00LCHAIN" --with-system-zlib --enable-obsolete --with-sysroot="${PREFIX}" - cd .. + (cd gcc-*; contrib/download_prerequisites) + mkdir -pv build-gcc + (cd build-gcc; ../gcc-*/configure --target="${TARGET}" --prefix="${PREFIX}" --disable-lto --disable-nls --disable-werror --enable-languages=all --enable-multilib --enable-multiarch --with-pkgversion="*DANiO* T00LCHAIN" --with-system-zlib --enable-obsolete --with-newlib --with-headers="../newlib-*/newlib/libc/include") ) then exit 1 @@ -72,15 +75,20 @@ maybe_try_this() make -C build-gcc install-target-libgcc -j${nproc} || return 1 } -if ( - if [ ! -d zen-kernel-testing ]; then - wget -c http://github.com/zen-kernel/zen-kernel/archive/testing.tar.gz -O - | tar -xzvf - - fi - mkdir -pv "${PREFIX}/usr" - make -C zen-kernel-testing headers_install ARCH=`echo ${TARGET} | cut -f1 -d"-" | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/s390x/s390/ -e s/parisc64/parisc/ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ -e s/riscv.*/riscv/` INSTALL_HDR_PATH="${PREFIX}/usr" +if ! ( make -C build-gcc -j${nproc} || maybe_try_this make -C build-gcc install -j${nproc} || maybe_try_this ) +then + exit 1 +fi + +if ( + mkdir -pv build-newlib + (cd build-newlib; ../newlib-*/configure --target="${TARGET}" --prefix="${PREFIX}") + make -C build-newlib -j${nproc} + make -C build-newlib -j${nproc} install +) then find ${PREFIX} | xargs file | grep "ELF" | grep "executable" | cut -f 1 -d ":" | xargs strip -S 2>/dev/null mkdir -pv out