From 77098dd50c37aa06d58ff2448c2865ed1bcfe9ed Mon Sep 17 00:00:00 2001 From: Rafal Mielniczuk Date: Thu, 19 Oct 2023 13:40:33 +0100 Subject: [PATCH] Add coreutils port --- README.md | 1 + sysroot/build.sh | 33 +++++++++++++++++++++++++++++++++ sysroot/toolchain.sh | 3 +++ 3 files changed, 37 insertions(+) diff --git a/README.md b/README.md index 0cd70959..b76019fb 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ https://user-images.githubusercontent.com/3881998/183302450-65193783-b10f-4ddd-8 - [x] mlibc () ([upstream](https://github.com/managarm/mlibc)) - [x] binutils () - [x] gcc () +- [x] coreutils () - [x] nyancat () - [x] ncurses () - [x] bash () diff --git a/sysroot/build.sh b/sysroot/build.sh index c8235c19..fa8ba794 100755 --- a/sysroot/build.sh +++ b/sysroot/build.sh @@ -16,6 +16,7 @@ GMP_SRC_DIR=$SRC_DIR/gmp MPFR_SRC_DIR=$SRC_DIR/mpfr MPC_SRC_DIR=$SRC_DIR/mpc DOOM_SRC_DIR=$SRC_DIR/doomgeneric +COREUTILS_SRC_DIR=$SRC_DIR/coreutils BUILD_DIR=$CYKUSZ_DIR/sysroot/build BINUTILS_BUILD_DIR=$BUILD_DIR/binutils-gdb @@ -24,6 +25,7 @@ GCC_CYKUSZ_BUILD_DIR=$BUILD_DIR/cykusz-gcc NCURSES_CYKUSZ_BUILD_DIR=$BUILD_DIR/cykusz-ncurses NANO_CYKUSZ_BUILD_DIR=$BUILD_DIR/cykusz-nano BASH_CYKUSZ_BUILD_DIR=$BUILD_DIR/cykusz-bash +COREUTILS_CYKUSZ_BUILD_DIR=$BUILD_DIR/cykusz-coreutils GCC_BUILD_DIR=$BUILD_DIR/gcc MLIBC_BUILD_DIR=$BUILD_DIR/mlibc GMP_BUILD_DIR=$BUILD_DIR/gmp @@ -94,6 +96,20 @@ function _prepare_bash { fi } +function _prepare_coreutils { + if [ ! -d $COREUTILS_SRC_DIR ]; then + mkdir -p $SRC_DIR + git clone --depth 1 -b cykusz https://github.com/rafalmiel/coreutils.git $COREUTILS_SRC_DIR + + pushd . + cd $COREUTILS_SRC_DIR + ./bootstrap + rm build-aux/config.sub + mv config.sub.cykusz build-aux/config.sub + popd + fi +} + function _prepare_nano { if [ ! -d $NANO_SRC_DIR ]; then mkdir -p $SRC_DIR @@ -316,6 +332,23 @@ function _cykusz_nano { make -C $NANO_CYKUSZ_BUILD_DIR DESTDIR=$SYSROOT install } +function _cykusz_coreutils { + _prepare_coreutils + + mkdir -p $COREUTILS_CYKUSZ_BUILD_DIR + + pushd . + + cd $COREUTILS_CYKUSZ_BUILD_DIR + + CFLAGS="-DSLOW_BUT_NO_HACKS -Wno-error" $COREUTILS_SRC_DIR/configure --host=$TRIPLE --target=$TRIPLE --prefix=/usr + + popd + + make -C $COREUTILS_CYKUSZ_BUILD_DIR DESTDIR=$SYSROOT -j4 + make -C $COREUTILS_CYKUSZ_BUILD_DIR DESTDIR=$SYSROOT install +} + function _cykusz_bash { _prepare_bash diff --git a/sysroot/toolchain.sh b/sysroot/toolchain.sh index ebdab8f6..4e935cd9 100755 --- a/sysroot/toolchain.sh +++ b/sysroot/toolchain.sh @@ -37,6 +37,9 @@ $SPATH/build.sh cykusz_libgcc > $LOGDIR/cykusz_libgcc.log 2>&1 echo "Cross building libstdc++..." $SPATH/build.sh cykusz_libstd > $LOGDIR/cykusz_libstd.log 2>&1 +echo "Cross building coreutils..." +$SPATH/build.sh cykusz_coreutils > $LOGDIR/cykusz_coreutils.log 2>&1 + echo "Cross building nyancat..." $SPATH/build.sh cykusz_nyancat > $LOGDIR/cykusz_nyancat.log 2>&1