From d7cd49e447134ef2470f9a245b6a8de8f359f045 Mon Sep 17 00:00:00 2001 From: ag-tsotetsi Date: Wed, 25 Mar 2026 14:54:35 +0200 Subject: [PATCH] commit changes --- build.bash | 411 +-------------------------------- build.sh | 46 +++- stage/bootstrap/binutils.bash | 20 +- stage/bootstrap/gcc.bash | 42 ++-- stage/bootstrap/glibc.bash | 18 +- stage/bootstrap/libstdc++.bash | 18 +- stage/toolchain/bash.bash | 18 ++ stage/toolchain/binutils.bash | 26 +++ stage/toolchain/coreutils.bash | 21 ++ stage/toolchain/diffutils.bash | 16 ++ stage/toolchain/file.bash | 30 +++ stage/toolchain/findutils.bash | 16 ++ stage/toolchain/gawk.bash | 17 ++ stage/toolchain/gcc.bash | 40 ++++ stage/toolchain/grep.bash | 15 ++ stage/toolchain/gzip.bash | 14 ++ stage/toolchain/make.bash | 15 ++ stage/toolchain/ncurses.bash | 41 ++++ stage/toolchain/patch.bash | 15 ++ stage/toolchain/sed.bash | 15 ++ stage/toolchain/tar.bash | 15 ++ stage/toolchain/xz.bash | 18 ++ 22 files changed, 425 insertions(+), 462 deletions(-) mode change 100644 => 100755 build.sh create mode 100644 stage/toolchain/bash.bash create mode 100644 stage/toolchain/binutils.bash create mode 100644 stage/toolchain/coreutils.bash create mode 100644 stage/toolchain/diffutils.bash create mode 100644 stage/toolchain/file.bash create mode 100644 stage/toolchain/findutils.bash create mode 100644 stage/toolchain/gawk.bash create mode 100644 stage/toolchain/gcc.bash create mode 100644 stage/toolchain/grep.bash create mode 100644 stage/toolchain/gzip.bash create mode 100644 stage/toolchain/make.bash create mode 100644 stage/toolchain/ncurses.bash create mode 100644 stage/toolchain/patch.bash create mode 100644 stage/toolchain/sed.bash create mode 100644 stage/toolchain/tar.bash create mode 100644 stage/toolchain/xz.bash diff --git a/build.bash b/build.bash index a92d8c2..51dfafd 100755 --- a/build.bash +++ b/build.bash @@ -1,390 +1,4 @@ -#!/usr/bin/env bash -set -euo pipefail - -umask 022 - -. version.bash -. flags.bash -. utilities.bash - - - - - - - - - - - -toolchain_m4() { - -} - -toolchain_ncurses() { - fetch $NCURSES_URL - - cd "$SOURCES" && tar xf ncurses-$NCURSES_VERSION.tar.gz && cd ncurses-$NCURSES_VERSION - - mkdir -p build - - pushd build - ../configure \ - --prefix="$CROSS" \ - AWK=gawk \ - --silent \ - --quiet - make -C include - make -C progs tic - install progs/tic "$CROSS/bin" - popd - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(./config.guess) \ - --mandir=/usr/share/man \ - --with-manpage-format=normal \ - --with-shared \ - --without-normal \ - --with-cxx-shared \ - --without-debug \ - --without-ada \ - --disable-stripping \ - AWK=gawk \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - ln -s libncursesw.so "$SYSROOT"/usr/lib/libncurses.so - - sed -e 's/^#if.*XOPEN.*$/#if 1/' -i "$SYSROOT"/usr/include/curses.h - - cd "$SOURCES" && rm -rf ncurses-$NCURSES_VERSION -} - -toolchain_bash() { - fetch $BASH_URL - - cd "$SOURCES" && tar xf bash-$BASH_VERSION.tar.gz && cd bash-$BASH_VERSION - - ./configure \ - --prefix=/usr \ - --build=$(sh support/config.guess) \ - --host=$TARGET \ - --without-bash-malloc \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - ln -s bash "$SYSROOT"/bin/sh - - cd "$SOURCES" && rm -rf bash-$BASH_VERSION -} - -toolchain_coreutils() { - fetch $COREUTILS_URL - - cd "$SOURCES" && tar xf coreutils-$COREUTILS_VERSION.tar.xz && cd coreutils-$COREUTILS_VERSION - - sed -r '/_GL_EXTERN_C/s/w?memchr|bsearch/(&)/' -i $(find -name \*.in.h) - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --enable-install-program=hostname \ - --enable-no-install-program=kill,uptime \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - mv "$SYSROOT"/usr/bin/chroot "$SYSROOT"/usr/sbin - - cd "$SOURCES" && rm -rf coreutils-$COREUTILS_VERSION -} - -toolchain_diffutils() { - fetch $DIFFUTILS_URL - - cd "$SOURCES" && tar xf diffutils-$DIFFUTILS_VERSION.tar.xz && cd diffutils-$DIFFUTILS_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - gl_cv_func_strcasecmp_works=y \ - --build=$(./build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf diffutils-$DIFFUTILS_VERSION -} - -toolchain_file() { - fetch $FILE_URL - - cd "$SOURCES" && tar xf file-$FILE_VERSION.tar.gz && cd file-$FILE_VERSION - - mkdir -p build - - pushd build - ../configure \ - --disable-bzlib \ - --disable-libseccomp \ - --disable-xzlib \ - --disable-zlib \ - --silent \ - --quiet - make - popd - - ./configure \ - --prefix=/usr \ - --host="$TARGET" \ - --build=$(./config.guess) \ - --silent \ - --quiet - - make FILE_COMPILE="$(pwd)/build/src/file" && make DESTDIR="$SYSROOT" install - - rm "$SYSROOT"/usr/lib/libmagic.la - - cd "$SOURCES" && rm -rf file-$FILE_VERSION -} - -toolchain_findutils() { - fetch $FINDUTILS_URL - - cd "$SOURCES" && tar xf findutils-$FINDUTILS_VERSION.tar.xz && cd findutils-$FINDUTILS_VERSION - - ./configure \ - --prefix=/usr \ - --localstatedir=/var/lib/locate \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf findutils-$FINDUTILS_VERSION -} - -toolchain_gawk() { - fetch $GAWK_URL - - cd "$SOURCES" && tar xf gawk-$GAWK_VERSION.tar.xz && cd gawk-$GAWK_VERSION - - sed -i 's/extras//' Makefile.in - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf gawk-$GAWK_VERSION -} - -toolchain_grep() { - fetch $GREP_URL - - cd "$SOURCES" && tar xf grep-$GREP_VERSION.tar.xz && cd grep-$GREP_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf grep-$GREP_VERSION -} - -toolchain_gzip() { - fetch $GZIP_URL - - cd "$SOURCES" && tar xf gzip-$GZIP_VERSION.tar.xz && cd gzip-$GZIP_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf gzip-$GZIP_VERSION -} - -toolchain_make() { - fetch $MAKE_URL - - cd "$SOURCES" && tar xf make-$MAKE_VERSION.tar.gz && cd make-$MAKE_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf make-$MAKE_VERSION -} - -toolchain_patch() { - fetch $PATCH_URL - - cd "$SOURCES" && tar xf patch-$PATCH_VERSION.tar.xz && cd patch-$PATCH_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf patch-$PATCH_VERSION -} - -toolchain_sed() { - fetch $SED_URL - - cd "$SOURCES" && tar xf sed-$SED_VERSION.tar.xz && cd sed-$SED_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf sed-$SED_VERSION -} - -toolchain_tar() { - fetch $TAR_URL - - cd "$SOURCES" && tar xf tar-$TAR_VERSION.tar.xz && cd tar-$TAR_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - cd "$SOURCES" && rm -rf tar-$TAR_VERSION -} - -toolchain_xz() { - fetch $XZ_URL - - cd "$SOURCES" && tar xf xz-$XZ_VERSION.tar.xz && cd xz-$XZ_VERSION - - ./configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(build-aux/config.guess) \ - --disable-static \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - rm "$SYSROOT"/usr/lib/liblzma.la - - cd "$SOURCES" && rm -rf xz-$XZ_VERSION -} - -toolchain_binutils() { - cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION - - sed '6031s/$add_dir//' -i ltmain.sh - - mkdir -p build && cd build - - ../configure \ - --prefix=/usr \ - --build=$(../config.guess) \ - --host=$TARGET \ - --disable-nls \ - --enable-shared \ - --enable-gprofng=no \ - --disable-werror \ - --enable-64-bit-bfd \ - --enable-new-dtags \ - --enable-default-hash-style=gnu \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - rm "$SYSROOT"/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} - - cd "$SOURCES" && rm -rf binutils-$BINUTILS_VERSION -} - -toolchain_gcc() { - cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION - - tar xf ../gmp-$GMP_VERSION.tar.xz && mv gmp-$GMP_VERSION gmp - tar xf ../isl-$ISL_VERSION.tar.xz && mv isl-$ISL_VERSION isl - tar xf ../mpc-$MPC_VERSION.tar.gz && mv mpc-$MPC_VERSION mpc - tar xf ../mpfr-$MPFR_VERSION.tar.xz && mv mpfr-$MPFR_VERSION mpfr - - sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 - - sed '/thread_header =/s/@.*@/gthr-posix.h/' -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in - - mkdir -p build && cd build - - ../configure \ - --build=$(../config.guess) \ - --host=$TARGET \ - --target=$TARGET \ - --prefix=/usr \ - --with-build-sysroot="$SYSROOT" \ - --enable-default-pie \ - --enable-default-ssp \ - --disable-nls \ - --disable-multilib \ - --disable-libatomic \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libsanitizer \ - --disable-libssp \ - --disable-libvtv \ - --enable-languages=c,c++ \ - LDFLAGS_FOR_TARGET=-L"$PWD/$TARGET/libgcc" \ - --silent \ - --quiet - - make && make DESTDIR="$SYSROOT" install - - ln -s gcc "$SYSROOT"/usr/bin/cc - - cd "$SOURCES" && rm -rf gcc-$GCC_VERSION -} prechroot_gettext() { fetch $GETTEXT_URL @@ -832,29 +446,8 @@ chroot_pcre2() { EOF } -#create_sysroot -#bootstrap_binutils -#bootstap_gcc -#bootstap_linux -#bootstap_glibc -#bootstap_libstdcpp -#toolchain_m4 -#toolchain_ncurses -#toolchain_bash -#toolchain_coreutils -#toolchain_diffutils -#toolchain_file -#toolchain_findutils -#toolchain_gawk -#toolchain_grep -#toolchain_gzip -#toolchain_make -#toolchain_patch -#toolchain_sed -#toolchain_tar -#toolchain_xz -#toolchain_binutils -#toolchain_gcc + + #change_owner #do_mount #prechroot_gettext diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 0b9054e..da0e1c1 --- a/build.sh +++ b/build.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -set -euo pipefail +if [[ -v DEBUG ]]; then + set -euox pipefail +else + set -euo pipefail +fi umask 022 @@ -8,8 +12,42 @@ umask 022 . flags.bash . utilities.bash +create_sysroot -STAGE="$1" -PACKAGE="$2" +bootstrap_builds() { + for build in binutils gcc linux glibc libstc++; do + . "stage/bootstrap/${build}.bash" + cd "$PROJDIR" + done +} -. "stage/${MODE}/${PACKAGE}.bash" \ No newline at end of file +toolchain_builds() { + for build in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip make patch sed tar xz binutils gcc; do + . "stage/toolchain/${build}.bash" + cd "$PROJDIR" + done +} + +usage() { + echo "usage: build.bash " + exit 1 +} + +if [ $# -eq 1 ]; then + + case $1 in + bootstrap) + bootstrap_builds + ;; + toolchain) + toolchain_builds + ;; + *) + usage + ;; + esac +elif [ $# -eq 2 ]; then + . "stage/$1/$2.bash" +else + usage +fi diff --git a/stage/bootstrap/binutils.bash b/stage/bootstrap/binutils.bash index 0082164..d0fe18a 100644 --- a/stage/bootstrap/binutils.bash +++ b/stage/bootstrap/binutils.bash @@ -6,16 +6,16 @@ cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTI mkdir -p build && cd build ../configure \ - --prefix="$CROSS" \ - --with-sysroot="$SYSROOT" \ - --target=$TARGET \ - --disable-nls \ - --enable-gprofng=no \ - --disable-werror \ - --enable-new-dtags \ - --enable-default-hash-style=gnu \ - --silent \ - --quiet + --prefix="$CROSS" \ + --with-sysroot="$SYSROOT" \ + --target=$TARGET \ + --disable-nls \ + --enable-gprofng=no \ + --disable-werror \ + --enable-new-dtags \ + --enable-default-hash-style=gnu \ + --silent \ + --quiet make && make install diff --git a/stage/bootstrap/gcc.bash b/stage/bootstrap/gcc.bash index 0bc1df1..1bb56e5 100644 --- a/stage/bootstrap/gcc.bash +++ b/stage/bootstrap/gcc.bash @@ -17,27 +17,27 @@ sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 mkdir -p build && cd build ../configure \ - --target=$TARGET \ - --prefix="$CROSS" \ - --with-glibc-version=$GLIBC_VERSION \ - --with-sysroot="$SYSROOT" \ - --with-newlib \ - --without-headers \ - --enable-default-pie \ - --enable-default-ssp \ - --disable-nls \ - --disable-shared \ - --disable-multilib \ - --disable-threads \ - --disable-libatomic \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libssp \ - --disable-libvtv \ - --disable-libstdcxx \ - --enable-languages=c,c++ \ - --silent \ - --quiet + --target=$TARGET \ + --prefix="$CROSS" \ + --with-glibc-version=$GLIBC_VERSION \ + --with-sysroot="$SYSROOT" \ + --with-newlib \ + --without-headers \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-shared \ + --disable-multilib \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ \ + --silent \ + --quiet make && make install diff --git a/stage/bootstrap/glibc.bash b/stage/bootstrap/glibc.bash index 8ef2e22..cc5c714 100644 --- a/stage/bootstrap/glibc.bash +++ b/stage/bootstrap/glibc.bash @@ -13,15 +13,15 @@ mkdir -p build && cd build echo "rootsbindir=/usr/sbin" > configparms ../configure \ - --prefix=/usr \ - --host=$TARGET \ - --build=$(../scripts/config.guess) \ - --disable-nscd \ - --disable-nls \ - libc_cv_slibdir=/usr/lib \ - --enable-kernel=$LINUX_VERSION \ - --silent \ - --quiet + --prefix=/usr \ + --host=$TARGET \ + --build=$(../scripts/config.guess) \ + --disable-nscd \ + --disable-nls \ + libc_cv_slibdir=/usr/lib \ + --enable-kernel=$LINUX_VERSION \ + --silent \ + --quiet make && make DESTDIR="$SYSROOT" install diff --git a/stage/bootstrap/libstdc++.bash b/stage/bootstrap/libstdc++.bash index 60b750e..87715df 100644 --- a/stage/bootstrap/libstdc++.bash +++ b/stage/bootstrap/libstdc++.bash @@ -4,15 +4,15 @@ cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION mkdir -p build && cd build ../libstdc++-v3/configure \ - --host=$TARGET \ - --build=$(../config.guess) \ - --prefix=/usr \ - --disable-multilib \ - --disable-nls \ - --disable-libstdcxx-pch \ - --with-gxx-include-dir=/cross/$TARGET/include/c++/$GCC_VERSION \ - --silent \ - --quiet + --host=$TARGET \ + --build=$(../config.guess) \ + --prefix=/usr \ + --disable-multilib \ + --disable-nls \ + --disable-libstdcxx-pch \ + --with-gxx-include-dir=/cross/$TARGET/include/c++/$GCC_VERSION \ + --silent \ + --quiet make && make DESTDIR="$SYSROOT" install diff --git a/stage/toolchain/bash.bash b/stage/toolchain/bash.bash new file mode 100644 index 0000000..2dc7ad1 --- /dev/null +++ b/stage/toolchain/bash.bash @@ -0,0 +1,18 @@ + +fetch $BASH_URL + +cd "$SOURCES" && tar xf bash-$BASH_VERSION.tar.gz && cd bash-$BASH_VERSION + +./configure \ + --prefix=/usr \ + --build=$(sh support/config.guess) \ + --host=$TARGET \ + --without-bash-malloc \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +ln -s bash "$SYSROOT"/bin/sh + +cd "$SOURCES" && rm -rf bash-$BASH_VERSION \ No newline at end of file diff --git a/stage/toolchain/binutils.bash b/stage/toolchain/binutils.bash new file mode 100644 index 0000000..d5409ac --- /dev/null +++ b/stage/toolchain/binutils.bash @@ -0,0 +1,26 @@ + +cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION + +sed '6031s/$add_dir//' -i ltmain.sh + +mkdir -p build && cd build + +../configure \ + --prefix=/usr \ + --build=$(../config.guess) \ + --host=$TARGET \ + --disable-nls \ + --enable-shared \ + --enable-gprofng=no \ + --disable-werror \ + --enable-64-bit-bfd \ + --enable-new-dtags \ + --enable-default-hash-style=gnu \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +rm "$SYSROOT"/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} + +cd "$SOURCES" && rm -rf binutils-$BINUTILS_VERSION \ No newline at end of file diff --git a/stage/toolchain/coreutils.bash b/stage/toolchain/coreutils.bash new file mode 100644 index 0000000..ab55c56 --- /dev/null +++ b/stage/toolchain/coreutils.bash @@ -0,0 +1,21 @@ + +fetch $COREUTILS_URL + +cd "$SOURCES" && tar xf coreutils-$COREUTILS_VERSION.tar.xz && cd coreutils-$COREUTILS_VERSION + +sed -r '/_GL_EXTERN_C/s/w?memchr|bsearch/(&)/' -i $(find -name \*.in.h) + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --enable-install-program=hostname \ + --enable-no-install-program=kill,uptime \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +mv "$SYSROOT"/usr/bin/chroot "$SYSROOT"/usr/sbin + +cd "$SOURCES" && rm -rf coreutils-$COREUTILS_VERSION \ No newline at end of file diff --git a/stage/toolchain/diffutils.bash b/stage/toolchain/diffutils.bash new file mode 100644 index 0000000..89caaec --- /dev/null +++ b/stage/toolchain/diffutils.bash @@ -0,0 +1,16 @@ + +fetch $DIFFUTILS_URL + +cd "$SOURCES" && tar xf diffutils-$DIFFUTILS_VERSION.tar.xz && cd diffutils-$DIFFUTILS_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + gl_cv_func_strcasecmp_works=y \ + --build=$(./build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf diffutils-$DIFFUTILS_VERSION \ No newline at end of file diff --git a/stage/toolchain/file.bash b/stage/toolchain/file.bash new file mode 100644 index 0000000..8ad20f3 --- /dev/null +++ b/stage/toolchain/file.bash @@ -0,0 +1,30 @@ + +fetch $FILE_URL + +cd "$SOURCES" && tar xf file-$FILE_VERSION.tar.gz && cd file-$FILE_VERSION + +mkdir -p build + +pushd build + ../configure \ + --disable-bzlib \ + --disable-libseccomp \ + --disable-xzlib \ + --disable-zlib \ + --silent \ + --quiet + make +popd + +./configure \ + --prefix=/usr \ + --host="$TARGET" \ + --build=$(./config.guess) \ + --silent \ + --quiet + +make FILE_COMPILE="$(pwd)/build/src/file" && make DESTDIR="$SYSROOT" install + +rm "$SYSROOT"/usr/lib/libmagic.la + +cd "$SOURCES" && rm -rf file-$FILE_VERSION \ No newline at end of file diff --git a/stage/toolchain/findutils.bash b/stage/toolchain/findutils.bash new file mode 100644 index 0000000..9f30415 --- /dev/null +++ b/stage/toolchain/findutils.bash @@ -0,0 +1,16 @@ + +fetch $FINDUTILS_URL + +cd "$SOURCES" && tar xf findutils-$FINDUTILS_VERSION.tar.xz && cd findutils-$FINDUTILS_VERSION + +./configure \ + --prefix=/usr \ + --localstatedir=/var/lib/locate \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf findutils-$FINDUTILS_VERSION \ No newline at end of file diff --git a/stage/toolchain/gawk.bash b/stage/toolchain/gawk.bash new file mode 100644 index 0000000..98d1504 --- /dev/null +++ b/stage/toolchain/gawk.bash @@ -0,0 +1,17 @@ + +fetch $GAWK_URL + +cd "$SOURCES" && tar xf gawk-$GAWK_VERSION.tar.xz && cd gawk-$GAWK_VERSION + +sed -i 's/extras//' Makefile.in + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf gawk-$GAWK_VERSION \ No newline at end of file diff --git a/stage/toolchain/gcc.bash b/stage/toolchain/gcc.bash new file mode 100644 index 0000000..106cb21 --- /dev/null +++ b/stage/toolchain/gcc.bash @@ -0,0 +1,40 @@ + +cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION + +tar xf ../gmp-$GMP_VERSION.tar.xz && mv gmp-$GMP_VERSION gmp +tar xf ../isl-$ISL_VERSION.tar.xz && mv isl-$ISL_VERSION isl +tar xf ../mpc-$MPC_VERSION.tar.gz && mv mpc-$MPC_VERSION mpc +tar xf ../mpfr-$MPFR_VERSION.tar.xz && mv mpfr-$MPFR_VERSION mpfr + +sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 + +sed '/thread_header =/s/@.*@/gthr-posix.h/' -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in + +mkdir -p build && cd build + +../configure \ + --build=$(../config.guess) \ + --host=$TARGET \ + --target=$TARGET \ + --prefix=/usr \ + --with-build-sysroot="$SYSROOT" \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-multilib \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libsanitizer \ + --disable-libssp \ + --disable-libvtv \ + --enable-languages=c,c++ \ + LDFLAGS_FOR_TARGET=-L"$PWD/$TARGET/libgcc" \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +ln -s gcc "$SYSROOT"/usr/bin/cc + +cd "$SOURCES" && rm -rf gcc-$GCC_VERSION \ No newline at end of file diff --git a/stage/toolchain/grep.bash b/stage/toolchain/grep.bash new file mode 100644 index 0000000..bbdeaa2 --- /dev/null +++ b/stage/toolchain/grep.bash @@ -0,0 +1,15 @@ + +fetch $GREP_URL + +cd "$SOURCES" && tar xf grep-$GREP_VERSION.tar.xz && cd grep-$GREP_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf grep-$GREP_VERSION \ No newline at end of file diff --git a/stage/toolchain/gzip.bash b/stage/toolchain/gzip.bash new file mode 100644 index 0000000..d0779e2 --- /dev/null +++ b/stage/toolchain/gzip.bash @@ -0,0 +1,14 @@ + +fetch $GZIP_URL + +cd "$SOURCES" && tar xf gzip-$GZIP_VERSION.tar.xz && cd gzip-$GZIP_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf gzip-$GZIP_VERSION \ No newline at end of file diff --git a/stage/toolchain/make.bash b/stage/toolchain/make.bash new file mode 100644 index 0000000..ccbbb3a --- /dev/null +++ b/stage/toolchain/make.bash @@ -0,0 +1,15 @@ + +fetch $MAKE_URL + +cd "$SOURCES" && tar xf make-$MAKE_VERSION.tar.gz && cd make-$MAKE_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf make-$MAKE_VERSION \ No newline at end of file diff --git a/stage/toolchain/ncurses.bash b/stage/toolchain/ncurses.bash new file mode 100644 index 0000000..d795fa9 --- /dev/null +++ b/stage/toolchain/ncurses.bash @@ -0,0 +1,41 @@ + +fetch $NCURSES_URL + +cd "$SOURCES" && tar xf ncurses-$NCURSES_VERSION.tar.gz && cd ncurses-$NCURSES_VERSION + +mkdir -p build + +pushd build + ../configure \ + --prefix="$CROSS" \ + AWK=gawk \ + --silent \ + --quiet + + make -C include && make -C progs tic + install progs/tic "$CROSS/bin" +popd + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(./config.guess) \ + --mandir=/usr/share/man \ + --with-manpage-format=normal \ + --with-shared \ + --without-normal \ + --with-cxx-shared \ + --without-debug \ + --without-ada \ + --disable-stripping \ + AWK=gawk \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +ln -s libncursesw.so "$SYSROOT"/usr/lib/libncurses.so + +sed -e 's/^#if.*XOPEN.*$/#if 1/' -i "$SYSROOT"/usr/include/curses.h + +cd "$SOURCES" && rm -rf ncurses-$NCURSES_VERSION \ No newline at end of file diff --git a/stage/toolchain/patch.bash b/stage/toolchain/patch.bash new file mode 100644 index 0000000..0f111a5 --- /dev/null +++ b/stage/toolchain/patch.bash @@ -0,0 +1,15 @@ + +fetch $PATCH_URL + +cd "$SOURCES" && tar xf patch-$PATCH_VERSION.tar.xz && cd patch-$PATCH_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf patch-$PATCH_VERSION \ No newline at end of file diff --git a/stage/toolchain/sed.bash b/stage/toolchain/sed.bash new file mode 100644 index 0000000..5ad1aac --- /dev/null +++ b/stage/toolchain/sed.bash @@ -0,0 +1,15 @@ + +fetch $SED_URL + +cd "$SOURCES" && tar xf sed-$SED_VERSION.tar.xz && cd sed-$SED_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf sed-$SED_VERSION \ No newline at end of file diff --git a/stage/toolchain/tar.bash b/stage/toolchain/tar.bash new file mode 100644 index 0000000..8ea3eb5 --- /dev/null +++ b/stage/toolchain/tar.bash @@ -0,0 +1,15 @@ + +fetch $TAR_URL + +cd "$SOURCES" && tar xf tar-$TAR_VERSION.tar.xz && cd tar-$TAR_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +cd "$SOURCES" && rm -rf tar-$TAR_VERSION \ No newline at end of file diff --git a/stage/toolchain/xz.bash b/stage/toolchain/xz.bash new file mode 100644 index 0000000..b575756 --- /dev/null +++ b/stage/toolchain/xz.bash @@ -0,0 +1,18 @@ + +fetch $XZ_URL + +cd "$SOURCES" && tar xf xz-$XZ_VERSION.tar.xz && cd xz-$XZ_VERSION + +./configure \ + --prefix=/usr \ + --host=$TARGET \ + --build=$(build-aux/config.guess) \ + --disable-static \ + --silent \ + --quiet + +make && make DESTDIR="$SYSROOT" install + +rm "$SYSROOT"/usr/lib/liblzma.la + +cd "$SOURCES" && rm -rf xz-$XZ_VERSION \ No newline at end of file