Compare commits

...

10 Commits

Author SHA1 Message Date
ag-tsotetsi
c69f878094 moved everything to different stages 2026-03-29 12:35:06 +02:00
ag-tsotetsi
abcc7eca2a trying to disable gettext deps 2026-03-25 16:26:52 +02:00
ag-tsotetsi
d7cd49e447 commit changes 2026-03-25 14:54:35 +02:00
ag-tsotetsi
409517b49f re-edit 2026-03-22 21:30:15 +02:00
ag-tsotetsi
1b605aaef1 refactor
- extract patch to version file
- added silent to bootstrap configure functions & glibc patch section
- renamed build.sh to build.bash
- moved flags, utilities and version to their own files
- extract glibc patch url to version file
2026-02-27 20:13:22 +02:00
ag-tsotetsi
59608f2d64 added utilities function for directories & files 2026-02-25 10:09:16 +02:00
ag-tsotetsi
ceda19fb62 removed old style of building file 2026-02-20 15:01:59 +02:00
ag-tsotetsi
8a8492129d updated gitignore 2026-02-20 15:01:25 +02:00
ag-tsotetsi
9d239743e5 deleted config folder 2026-02-20 15:00:58 +02:00
ag-tsotetsi
1b8d8766ca deleted build folder 2026-02-20 15:00:30 +02:00
89 changed files with 1109 additions and 1939 deletions

1
.gitignore vendored
View File

@@ -1,2 +1 @@
/sources/
/sysroot/

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env bash
umask 022
if [[ -v DEBUG ]]; then
set -euxo pipefail
else
set -euo pipefail
fi
. config/global.env
. config/utilities.bash
if [ ! -d "$SYSROOT" ]; then
create_sysroot
fi
STAGE=$1
PKG=$2
. build/$PKG/build.bash $STAGE

679
build.sh
View File

@@ -1,637 +1,74 @@
#!/usr/bin/env bash
if [[ -v DEBUG ]]; then
set -euox pipefail
else
set -euo pipefail
fi
umask 022
export LC_ALL="POSIX"
. version.bash
. flags.bash
. utilities.bash
export TARGET="x86_64-axe-linux-gnu"
create_sysroot
export MAKEFLAGS="-j$(nproc)"
export SYSROOT="$PWD/sysroot"
export PROJDIR="$PWD"
export SOURCES="$SYSROOT/sources"
export CROSS="$SYSROOT/cross"
export PATH="$CROSS/bin:/usr/bin:/usr/sbin"
export CONFIG_SITE="$SYSROOT/usr/share/config.site"
BINUTILS_VERSION=2.45.1
BINUTILS_URL=https://mirror.ufs.ac.za/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz
GCC_VERSION=15.2.0
GCC_URL=https://mirror.ufs.ac.za/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
GMP_VERSION=6.3.0
GMP_URL=https://mirror.ufs.ac.za/gnu/gmp/gmp-$GMP_VERSION.tar.xz
MPC_VERSION=1.3.1
MPC_URL=https://mirror.ufs.ac.za/gnu/mpc/mpc-$MPC_VERSION.tar.gz
MPFR_VERSION=4.2.2
MPFR_URL=https://mirror.ufs.ac.za/gnu/mpfr/mpfr-$MPFR_VERSION.tar.xz
ISL_VERSION=0.27
ISL_URL=https://libisl.sourceforge.io/isl-$ISL_VERSION.tar.xz
GLIBC_VERSION=2.43
GLIBC_URL=https://mirror.ufs.ac.za/gnu/glibc/glibc-$GLIBC_VERSION.tar.xz
LINUX_VERSION=6.18.7
IFS='.' read -r LINUX_VERSION_MAJOR LINUX_VERSION_MINOR LINUX_VERSION_PATCH <<< $LINUX_VERSION
LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v$LINUX_VERSION_MAJOR.x/linux-$LINUX_VERSION.tar.xz
M4_VERSION=1.4.20
M4_URL=https://mirror.ufs.ac.za/gnu/m4/m4-$M4_VERSION.tar.xz
NCURSES_VERSION=6.6
NCURSES_URL=https://mirror.ufs.ac.za/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz
BASH_VERSION=5.3
BASH_URL=https://mirror.ufs.ac.za/gnu/bash/bash-$BASH_VERSION.tar.gz
COREUTILS_VERSION=9.9
COREUTILS_URL=https://mirror.ufs.ac.za/gnu/coreutils/coreutils-$COREUTILS_VERSION.tar.xz
DIFFUTILS_VERSION=3.12
DIFFUTILS_URL=https://mirror.ufs.ac.za/gnu/diffutils/diffutils-$DIFFUTILS_VERSION.tar.xz
FILE_VERSION=5.46
FILE_URL=https://astron.com/pub/file/file-$FILE_VERSION.tar.gz
FINDUTILS_VERSION=4.10.0
FINDUTILS_URL=https://mirror.ufs.ac.za/gnu/findutils/findutils-$FINDUTILS_VERSION.tar.xz
GAWK_VERSION=5.3.2
GAWK_URL=https://mirror.ufs.ac.za/gnu/gawk/gawk-$GAWK_VERSION.tar.xz
GREP_VERSION=3.12
GREP_URL=https://mirror.ufs.ac.za/gnu/grep/grep-$GREP_VERSION.tar.xz
GZIP_VERSION=1.14
GZIP_URL=https://mirror.ufs.ac.za/gnu/gzip/gzip-$GZIP_VERSION.tar.xz
MAKE_VERSION=4.4.1
MAKE_URL=https://mirror.ufs.ac.za/gnu/make/make-$MAKE_VERSION.tar.gz
PATCH_VERSION=2.8
PATCH_URL=https://mirror.ufs.ac.za/gnu/patch/patch-$PATCH_VERSION.tar.xz
SED_VERSION=4.9
SED_URL=https://mirror.ufs.ac.za/gnu/sed/sed-$SED_VERSION.tar.xz
TAR_VERSION=1.35
TAR_URL=https://mirror.ufs.ac.za/gnu/tar/tar-$TAR_VERSION.tar.xz
XZ_VERSION=5.8.2
XZ_URL=https://github.com//tukaani-project/xz/releases/download/v$XZ_VERSION/xz-$XZ_VERSION.tar.xz
create_sysroot() {
if [ ! -d "$SYSROOT" ]; then
mkdir -p "$SYSROOT"/{etc,cross,sources,usr,dev,proc,sys,run}
mkdir -p "$SYSROOT"/usr/{bin,sbin,lib,include}
for directory in bin sbin lib; do
ln -fs "usr/$directory" "$SYSROOT/$directory"
bootstrap_builds() {
for build in binutils gcc linux glibc libstdc++; do
. "stage/bootstrap/${build}.bash"
cd "$PROJDIR"
done
ln -s usr/lib "$SYSROOT"/lib64
fi
}
change_owner() {
sudo chown -R root:root "$SYSROOT"/{etc,cross,usr,dev,proc,sys,run,var}
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
}
do_mount() {
if ! mountpoint -q "$SYSROOT/dev"; then
sudo mount --bind /dev "$SYSROOT"/dev
sudo mount -t devpts devpts -o gid=5,mode=0620 "$SYSROOT"/dev/pts
sudo mount -t proc proc "$SYSROOT"/proc
sudo mount -t sysfs sysfs "$SYSROOT"/sys
sudo mount -t tmpfs tmpfs "$SYSROOT"/run
if [ -h "$SYSROOT"/dev/shm ]; then
sudo install -d -m 1777 "$SYSROOT"$(realpath /dev/shm)
prechroot_builds() {
for build in setup bison perl python util_linux cleanup; do
. "stage/prechroot/${build}.bash"
cd "$PROJDIR"
done
}
usage() {
echo "usage: build.bash <stage> <package>"
exit 1
}
check_in_run() {
if [[ $# -ge 1 && $# -le 2 ]]; then
case $1 in
bootstap|toolchain)
if [ $# -eq 1 ]; then
"${1}_builds"
else
sudo mount -t tmpfs -o nosuid,nodev tmpfs "$SYSROOT"/dev/shm
. "stage/$1/$2.bash"
fi
fi
}
do_unmount() {
sudo umount -R "$SYSROOT/"
}
fetch() {
wget -N -c --show-progress -q -P "$SOURCES" $1
}
bootstrap_binutils() {
fetch $BINUTILS_URL
cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION
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
make && make install
cd "$SOURCES"
rm -rf binutils-$BINUTILS_VERSION
}
bootstap_gcc() {
fetch $GCC_URL
fetch $GMP_URL
fetch $ISL_URL
fetch $MPC_URL
fetch $MPFR_URL
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
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++
make && make install
cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > "`dirname $($TARGET-gcc -print-libgcc-file-name)`/include/limits.h"
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION
}
bootstap_linux() {
fetch $LINUX_URL
cd "$SOURCES" && tar xf linux-$LINUX_VERSION.tar.xz && cd linux-$LINUX_VERSION
make mrproper
make headers
find usr/include -type f ! -name '*.h' -delete
cp -r usr/include "$SYSROOT"/usr
cd "$SOURCES" && rm -rf linux-$LINUX_VERSION
}
bootstap_glibc() {
fetch $GLIBC_URL
fetch https://www.linuxfromscratch.org/patches/lfs/development/glibc-fhs-1.patch
cd "$SOURCES" && tar xf glibc-$GLIBC_VERSION.tar.xz && cd glibc-$GLIBC_VERSION
ln -sf ld-linux-x86-64.so.2 "$SYSROOT"/lib/ld-lsb-x86-64.so.3
patch -Np1 -i "$SOURCES"/glibc-fhs-1.patch
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
make && make DESTDIR="$SYSROOT" install
sed '/RTLDLIST=/s@/usr@@g' -i "$SYSROOT"/usr/bin/ldd
cd "$SOURCES" && rm -rf gcc-$GLIBC_VERSION
}
bootstap_libstdcpp() {
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
make && make DESTDIR="$SYSROOT" install
rm -rf "$SYSROOT"/usr/lib/lib{stdc++{,exp,fs},supc++}.la
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION
}
toolchain_m4() {
fetch $M4_URL
cd "$SOURCES" && tar xf m4-$M4_VERSION.tar.xz && cd m4-$M4_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)
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf m4-$M4_VERSION
}
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
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
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
make && make DESTDIR="$SYSROOT" install
ln -sv 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
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)
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
make
popd
./configure \
--prefix=/usr \
--host="$TARGET" \
--build=$(./config.guess)
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)
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)
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)
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
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)
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)
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)
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)
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
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
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"
make && make DESTDIR="$SYSROOT" install
ln -s gcc "$SYSROOT"/usr/bin/cc
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION
}
#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
;;
prechroot|hroot)
if [ $# -eq 1 ]; then
do_mount
"${1}_builds"
do_unmount
else
do_mount
. "stage/$1/$2.bash"
do_unmount
fi
;;
*)
usage
;;
esac
else
usage
fi
}
check_in_run "$@"

View File

@@ -1,48 +0,0 @@
. "$PROJECTDIR/build/bash/package.env"
fetch $BASH_URL
cd "$SOURCES" && tar xf bash-$BASH_VERSION.tar.gz && cd bash-$BASH_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--build=$(sh support/config.guess) \
--host=$TARGET \
--without-bash-malloc > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
ln -sv bash "$SYSROOT/bin/sh"
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/bash-$BASH_VERSION"

View File

@@ -1,7 +0,0 @@
export BASH_VERSION=5.3
IFS='.' read -r BASH_VERSION_MAJOR BASH_VERSION_MINOR <<< $BASH_VERSION
export BASH_VERSION_MAJOR BASH_VERSION_MINOR
export BASH_URL=https://mirror.ufs.ac.za/gnu/bash/bash-$BASH_VERSION.tar.gz

View File

@@ -1,70 +0,0 @@
. "$PROJECTDIR/build/binutils/package.env"
fetch $BINUTILS_URL
cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION
bootstrap() {
mkdir -p build && cd build
../configure \
--prefix="$SYSROOT/cross" \
--with-sysroot="$SYSROOT" \
--target=$TARGET \
--disable-nls \
--enable-gprofng=no \
--disable-werror \
--enable-new-dtags \
--enable-default-hash-style=gnu > /dev/null
make > /dev/null && make install > /dev/null
}
toolchain() {
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 > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
rm "$SYSROOT"/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la}
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/binutils-$BINUTILS_VERSION"

View File

@@ -1,7 +0,0 @@
export BINUTILS_VERSION=2.45.1
IFS='.' read -r BINUTILS_VERSION_MAJOR BINUTILS_VERSION_MINOR BINUTILS_VERSION_PATCH <<< $BINUTILS_VERSION
export BINUTILS_VERSION_MAJOR BINUTILS_VERSION_MINOR BINUTILS_VERSION_PATCH
export BINUTILS_URL=https://mirror.ufs.ac.za/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz

View File

@@ -1,52 +0,0 @@
. "$PROJECTDIR/build/coreutils/package.env"
fetch $COREUTILS_URL
cd "$SOURCES" && tar xf coreutils-$COREUTILS_VERSION.tar.xz && cd coreutils-$COREUTILS_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
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 > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
mv "$SYSROOT/usr/bin/chroot" "$SYSROOT/usr/sbin"
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/coreutils-$COREUTILS_VERSION"

View File

@@ -1,7 +0,0 @@
export COREUTILS_VERSION=9.9
IFS='.' read -r COREUTILS_VERSION_MAJOR COREUTILS_VERSION_MINOR <<< $COREUTILS_VERSION
export COREUTILS_VERSION_MAJOR COREUTILS_VERSION_MINOR
export COREUTILS_URL=https://mirror.ufs.ac.za/gnu/coreutils/coreutils-$COREUTILS_VERSION.tar.xz

View File

@@ -1,47 +0,0 @@
. "$PROJECTDIR/build/diffutils/package.env"
fetch $DIFFUTILS_URL
cd "$SOURCES" && tar xf diffutils-$DIFFUTILS_VERSION.tar.xz && cd diffutils-$DIFFUTILS_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
gl_cv_func_strcasecmp_works=y \
--build=$(./build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/diffutils-$DIFFUTILS_VERSION"

View File

@@ -1,7 +0,0 @@
export DIFFUTILS_VERSION=3.12
IFS='.' read -r DIFFUTILS_VERSION_MAJOR DIFFUTILS_VERSION_MINOR <<< $DIFFUTILS_VERSION
export DIFFUTILS_VERSION_MAJOR DIFFUTILS_VERSION_MINOR
export DIFFUTILS_URL=https://mirror.ufs.ac.za/gnu/diffutils/diffutils-$DIFFUTILS_VERSION.tar.xz

View File

@@ -1,58 +0,0 @@
. "$PROJECTDIR/build/file/package.env"
fetch $FILE_URL
cd "$SOURCES" && tar xf file-$FILE_VERSION.tar.gz && cd file-$FILE_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
mkdir -p build
pushd build
../configure \
--disable-bzlib \
--disable-libseccomp \
--disable-xzlib \
--disable-zlib > /dev/null
make > /dev/null
popd
./configure \
--prefix=/usr \
--host="$TARGET" \
--build=$(./config.guess) > /dev/null
make FILE_COMPILE="$(pwd)/build/src/file" > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
rm "$SYSROOT/usr/lib/libmagic.la"
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/file-$FILE_VERSION"

View File

@@ -1,7 +0,0 @@
export FILE_VERSION=5.46
IFS='.' read -r FILE_VERSION_MAJOR FILE_VERSION_MINOR <<< $FILE_VERSION
export FILE_VERSION_MAJOR FILE_VERSION_MINOR
export FILE_URL=https://astron.com/pub/file/file-$FILE_VERSION.tar.gz

View File

@@ -1,48 +0,0 @@
. "$PROJECTDIR/build/findutils/package.env"
fetch $FINDUTILS_URL
cd "$SOURCES" && tar xf findutils-$FINDUTILS_VERSION.tar.xz && cd findutils-$FINDUTILS_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--localstatedir=/var/lib/locate \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/findutils-$FINDUTILS_VERSION"

View File

@@ -1,7 +0,0 @@
export FINDUTILS_VERSION=4.10.0
IFS='.' read -r FINDUTILS_VERSION_MAJOR FINDUTILS_VERSION_MINOR FINDUTILS_VERSION_PATCH <<< $FINDUTILS_VERSION
export FINDUTILS_VERSION_MAJOR FINDUTILS_VERSION_MINOR FINDUTILS_VERSION_PATCH
export FINDUTILS_URL=https://mirror.ufs.ac.za/gnu/findutils/findutils-$FINDUTILS_VERSION.tar.xz

View File

@@ -1,49 +0,0 @@
. "$PROJECTDIR/build/gawk/package.env"
fetch $GAWK_URL
cd "$SOURCES" && tar xf gawk-$GAWK_VERSION.tar.xz && cd gawk-$GAWK_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
sed -i 's/extras//' Makefile.in
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/gawk-$GAWK_VERSION"

View File

@@ -1,7 +0,0 @@
export GAWK_VERSION=5.3.2
IFS='.' read -r GAWK_VERSION_MAJOR GAWK_VERSION_MINOR GAWK_VERSION_PATCH <<< $GAWK_VERSION
export GAWK_VERSION_MAJOR GAWK_VERSION_MINOR GAWK_VERSION_PATCH
export GAWK_URL=https://mirror.ufs.ac.za/gnu/gawk/gawk-$GAWK_VERSION.tar.xz

View File

@@ -1,114 +0,0 @@
. "$PROJECTDIR/build/gcc/package.env"
. "$PROJECTDIR/build/gmp/package.env"
. "$PROJECTDIR/build/isl/package.env"
. "$PROJECTDIR/build/mpc/package.env"
. "$PROJECTDIR/build/mpfr/package.env"
fetch $GCC_URL
fetch $GMP_URL
fetch $ISL_URL
fetch $MPC_URL
fetch $MPFR_URL
cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION
bootstrap() {
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
mkdir -p build && cd build
../configure \
--target=$TARGET \
--prefix="$SYSROOT/cross" \
--with-glibc-version=2.43 \
--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++ > /dev/null
make > /dev/null && make install > /dev/null
cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > "`dirname $($TARGET-gcc -print-libgcc-file-name)`/include/limits.h"
}
toolchain() {
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" > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
ln -s gcc "$SYSROOT/usr/bin/cc"
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/gcc-$GCC_VERSION"

View File

@@ -1,7 +0,0 @@
export GCC_VERSION=15.2.0
IFS='.' read -r GCC_VERSION_MAJOR GCC_VERSION_MINOR GCC_VERSION_PATCH <<< $GCC_VERSION
export GCC_VERSION_MAJOR GCC_VERSION_MINOR GCC_VERSION_PATCH
export GCC_URL=https://mirror.ufs.ac.za/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz

View File

@@ -1,61 +0,0 @@
. "$PROJECTDIR/build/glibc/package.env"
fetch $GLIBC_URL
fetch https://www.linuxfromscratch.org/patches/lfs/development/glibc-fhs-1.patch
cd "$SOURCES" && tar xf glibc-$GLIBC_VERSION.tar.xz && cd glibc-$GLIBC_VERSION
bootstrap() {
ln -sf ld-linux-x86-64.so.2 "$SYSROOT/lib/ld-lsb-x86-64.so.3"
patch -Np1 -i "$SOURCES/glibc-fhs-1.patch"
mkdir -p build && cd build
echo "rootsbindir=/usr/sbin" > configparms
../configure \
--prefix=/usr \
--host=$TARGET \
--build=$(../scripts/config.guess) \
--disable-nscd \
libc_cv_slibdir=/usr/lib \
--enable-kernel=6.18 > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
sed '/RTLDLIST=/s@/usr@@g' -i "$SYSROOT/usr/bin/ldd"
}
toolchain() {
echo toolchain
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/glibc-$GLIBC_VERSION"

View File

@@ -1,8 +0,0 @@
export GLIBC_VERSION=2.43
IFS='.' read -r GLIBC_VERSION_MAJOR GLIBC_VERSION_MINOR <<< $GLIBC_VERSION
export GLIBC_VERSION_MAJOR GLIBC_VERSION_MINOR
export GLIBC_URL=https://mirror.ufs.ac.za/gnu/glibc/glibc-$GLIBC_VERSION.tar.xz
6.0

View File

@@ -1,7 +0,0 @@
export GMP_VERSION=6.3.0
IFS='.' read -r GMP_VERSION_MAJOR GMP_VERSION_MINOR GMP_VERSION_PATCH <<< $GMP_VERSION
export GMP_VERSION_MAJOR GMP_VERSION_MINOR GMP_VERSION_PATCH
export GMP_URL=https://mirror.ufs.ac.za/gnu/gmp/gmp-$GMP_VERSION.tar.xz

View File

@@ -1,42 +0,0 @@
. "$PROJECTDIR/build/grep/package.env"
fetch $GREP_URL
cd "$SOURCES" && tar xf grep-$GREP_VERSION.tar.xz && cd grep-$GREP_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/grep-$GREP_VERSION"

View File

@@ -1,7 +0,0 @@
export GREP_VERSION=3.12
IFS='.' read -r GREP_VERSION_MAJOR GREP_VERSION_MINOR <<< $GREP_VERSION
export GREP_VERSION_MAJOR GREP_VERSION_MINOR
export GREP_URL=https://mirror.ufs.ac.za/gnu/grep/grep-$GREP_VERSION.tar.xz

View File

@@ -1,42 +0,0 @@
. "$PROJECTDIR/build/gzip/package.env"
fetch $GZIP_URL
cd "$SOURCES" && tar xf gzip-$GZIP_VERSION.tar.xz && cd gzip-$GZIP_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/gzip-$GZIP_VERSION"

View File

@@ -1,7 +0,0 @@
export GZIP_VERSION=1.14
IFS='.' read -r GZIP_VERSION_MAJOR GZIP_VERSION_MINOR <<< $GZIP_VERSION
export GZIP_VERSION_MAJOR GZIP_VERSION_MINOR
export GZIP_URL=https://mirror.ufs.ac.za/gnu/gzip/gzip-$GZIP_VERSION.tar.xz

View File

@@ -1,7 +0,0 @@
export ISL_VERSION=0.27
IFS='.' read -r ISL_VERSION_MAJOR ISL_VERSION_MINOR <<< $ISL_VERSION
export ISL_VERSION_MAJOR ISL_VERSION_MINOR
export ISL_URL=https://libisl.sourceforge.io/isl-$ISL_VERSION.tar.xz

View File

@@ -1,52 +0,0 @@
. "$PROJECTDIR/build/gcc/package.env"
fetch $GCC_URL
cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION
bootstrap() {
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 > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
rm "$SYSROOT"/usr/lib/lib{stdc++{,exp,fs},supc++}.la
}
toolchain() {
echo toolchain
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/gcc-$GCC_VERSION"

View File

@@ -1,7 +0,0 @@
export GCC_VERSION=15.2.0
IFS='.' read -r GCC_VERSION_MAJOR GCC_VERSION_MINOR GCC_VERSION_PATCH <<< $GCC_VERSION
export GCC_VERSION_MAJOR GCC_VERSION_MINOR GCC_VERSION_PATCH
export GCC_URL=https://mirror.ufs.ac.za/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz

View File

@@ -1,43 +0,0 @@
. "$PROJECTDIR/build/linux/package.env"
fetch $LINUX_URL
cd "$SOURCES" && tar xf linux-$LINUX_VERSION.tar.xz && cd linux-$LINUX_VERSION
make mrproper
bootstrap() {
make headers
find usr/include -type f ! -name '*.h' -delete
cp -r usr/include "$SYSROOT/usr"
}
toolchain() {
echo toolchain
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/linux-$LINUX_VERSION"

View File

@@ -1,7 +0,0 @@
export LINUX_VERSION=6.18.7
IFS='.' read -r LINUX_VERSION_MAJOR LINUX_VERSION_MINOR LINUX_VERSION_PATCH <<< $LINUX_VERSION
export LINUX_VERSION_MAJOR LINUX_VERSION_MINOR LINUX_VERSION_PATCH
export LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v$LINUX_VERSION_MAJOR.x/linux-$LINUX_VERSION.tar.xz

View File

@@ -1,48 +0,0 @@
. "$PROJECTDIR/build/m4/package.env"
fetch $M4_URL
cd "$SOURCES" && tar xf m4-$M4_VERSION.tar.xz && cd m4-$M4_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
sed -r '/_GL_EXTERN_C/s/w?memchr|bsearch/(&)/' -i $(find -name \*.in.h)
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/m4-$M4_VERSION"

View File

@@ -1,7 +0,0 @@
export M4_VERSION=1.4.20
IFS='.' read -r M4_VERSION_MAJOR M4_VERSION_MINOR <<< $M4_VERSION
export M4_VERSION_MAJOR M4_VERSION_MINOR
export M4_URL=https://mirror.ufs.ac.za/gnu/m4/m4-$M4_VERSION.tar.xz

View File

@@ -1,47 +0,0 @@
. "$PROJECTDIR/build/make/package.env"
fetch $MAKE_URL
cd "$SOURCES" && tar xf make-$MAKE_VERSION.tar.gz && cd make-$MAKE_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/make-$MAKE_VERSION"

View File

@@ -1,7 +0,0 @@
export MAKE_VERSION=4.4.1
IFS='.' read -r MAKE_VERSION_MAJOR MAKE_VERSION_MINOR MAKE_VERSION_PATCH <<< $MAKE_VERSION
export MAKE_VERSION_MAJOR MAKE_VERSION_MINOR MAKE_VERSION_PATCH
export MAKE_URL=https://mirror.ufs.ac.za/gnu/make/make-$MAKE_VERSION.tar.gz

View File

@@ -1,7 +0,0 @@
export MPC_VERSION=1.3.1
IFS='.' read -r MPC_VERSION_MAJOR MPC_VERSION_MINOR MPC_VERSION_PATCH <<< $MPC_VERSION
export MPC_VERSION_MAJOR MPC_VERSION_MINOR MPC_VERSION_PATCH
export MPC_URL=https://mirror.ufs.ac.za/gnu/mpc/mpc-$MPC_VERSION.tar.gz

View File

@@ -1,7 +0,0 @@
export MPFR_VERSION=4.2.2
IFS='.' read -r MPFR_VERSION_MAJOR MPFR_VERSION_MINOR MPFR_VERSION_PATCH <<< $MPFR_VERSION
export MPFR_VERSION_MAJOR MPFR_VERSION_MINOR MPFR_VERSION_PATCH
export MPFR_URL=https://mirror.ufs.ac.za/gnu/mpfr/mpfr-$MPFR_VERSION.tar.xz

View File

@@ -1,65 +0,0 @@
. "$PROJECTDIR/build/ncurses/package.env"
fetch $NCURSES_URL
cd "$SOURCES" && tar xf ncurses-$NCURSES_VERSION.tar.gz && cd ncurses-$NCURSES_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
mkdir -p build
pushd build
../configure --prefix="$SYSROOT/cross" AWK=gawk > /dev/null
make -C include > /dev/null
make -C progs tic > /dev/null
install progs/tic "$SYSROOT/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 > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
ln -s libncursesw.so "$SYSROOT/usr/lib/libncurses.so"
sed -e 's/^#if.*XOPEN.*$/#if 1/' -i "$SYSROOT/usr/include/curses.h"
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/ncurses-$NCURSES_VERSION"

View File

@@ -1,7 +0,0 @@
export NCURSES_VERSION=6.6
IFS='.' read -r NCURSES_VERSION_MAJOR NCURSES_VERSION_MINOR NCURSES_VERSION_PATCH <<< $NCURSES_VERSION
export NCURSES_VERSION_MAJOR NCURSES_VERSION_MINOR NCURSES_VERSION_PATCH
export NCURSES_URL=https://mirror.ufs.ac.za/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz

View File

@@ -1,48 +0,0 @@
`. "$PROJECTDIR/build/patch/package.env"
fetch $PATCH_URL
cd "$SOURCES" && tar xf patch-$PATCH_VERSION.tar.xz && cd patch-$PATCH_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/patch-$PATCH_VERSION"
`

View File

@@ -1,7 +0,0 @@
export PATCH_VERSION=2.8
IFS='.' read -r PATCH_VERSION_MAJOR PATCH_VERSION_MINOR <<< $PATCH_VERSION
export PATCH_VERSION_MAJOR PATCH_VERSION_MINOR
export PATCH_URL=https://mirror.ufs.ac.za/gnu/patch/patch-$PATCH_VERSION.tar.xz

View File

@@ -1,47 +0,0 @@
. "$PROJECTDIR/build/sed/package.env"
fetch $SED_URL
cd "$SOURCES" && tar xf sed-$SED_VERSION.tar.xz && cd sed-$SED_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/sed-$SED_VERSION"

View File

@@ -1,7 +0,0 @@
export SED_VERSION=4.9
IFS='.' read -r SED_VERSION_MAJOR SED_VERSION_MINOR <<< $SED_VERSION
export SED_VERSION_MAJOR SED_VERSION_MINOR
export SED_URL=https://mirror.ufs.ac.za/gnu/sed/sed-$SED_VERSION.tar.xz

View File

@@ -1,47 +0,0 @@
. "$PROJECTDIR/build/tar/package.env"
fetch $TAR_URL
cd "$SOURCES" && tar xf tar-$TAR_VERSION.tar.xz && cd tar-$TAR_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/tar-$TAR_VERSION"

View File

@@ -1,7 +0,0 @@
export TAR_VERSION=1.35
IFS='.' read -r TAR_VERSION_MAJOR TAR_VERSION_MINOR <<< $TAR_VERSION
export TAR_VERSION_MAJOR TAR_VERSION_MINOR
export TAR_URL=https://mirror.ufs.ac.za/gnu/tar/tar-$TAR_VERSION.tar.xz

View File

@@ -1,50 +0,0 @@
. "$PROJECTDIR/build/xz/package.env"
fetch $XZ_URL
cd "$SOURCES" && tar xf xz-$XZ_VERSION.tar.xz && cd xz-$XZ_VERSION
bootstrap() {
echo bootstrap
}
toolchain() {
./configure \
--prefix=/usr \
--host=$TARGET \
--build=$(build-aux/config.guess) \
--disable-static > /dev/null
make > /dev/null && make DESTDIR="$SYSROOT" install > /dev/null
rm "$SYSROOT/usr/lib/liblzma.la"
}
setup() {
echo setup
}
final() {
echo final
}
case $1 in
bootstrap)
bootstrap
;;
toolchain)
toolchain
;;
setup)
setup
;;
final)
final
;;
esac
rm -rf "$SOURCES/xz-$XZ_VERSION"

View File

@@ -1,7 +0,0 @@
export XZ_VERSION=5.8.2
IFS='.' read -r XZ_VERSION_MAJOR XZ_VERSION_MINOR XZ_VERSION_PATCH <<< $XZ_VERSION
export XZ_VERSION_MAJOR XZ_VERSION_MINOR XZ_VERSION_PATCH
export XZ_URL=https://github.com//tukaani-project/xz/releases/download/v$XZ_VERSION/xz-$XZ_VERSION.tar.xz

View File

@@ -1,9 +0,0 @@
export SYSROOT="$PWD/sysroot"
export MAKEFLAGS=-j$(nproc)
export LC_ALL=POSIX
export TARGET=x86_64-axe-linux-gnu
export SOURCES="$PWD/sources"
export PATH="$SYSROOT/cross/bin:/usr/bin:/usr/sbin"
export CONFIG_SITE="$SYSROOT/usr/share/config.site"
export PROJECTDIR="$PWD"

View File

@@ -1,36 +0,0 @@
fetch() {
wget -N -c --show-progress -q -P "$SOURCES" $1
}
create_sysroot() {
mkdir -p "$SYSROOT"/{etc,cross,usr}
mkdir -p "$SYSROOT"/usr/{bin,sbin,lib,include}
for directory in bin sbin lib; do
ln -fs "usr/$directory" "$SYSROOT/$directory"
done
ln -fs lib "$SYSROOT/usr/lib64"
ln -fs usr/lib64 "$SYSROOT/lib64"
}
discard_out() {
"$@" > /dev/null
}
redirect_out() {
local path=$1; shift
"$@" > "$path"
}
discard_all() {
"$@" > /dev/null 2>&1
}
redirect_all() {
local path=$1; shift
"$@" > "$path" 2>&1
}

19
flags.bash Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
export LC_ALL="POSIX"
export TARGET="x86_64-axe-linux-gnu"
export MAKEFLAGS="-j$(nproc) --no-print-directory --silent"
export SYSROOT="$PWD/sysroot"
export PROJDIR="$PWD"
export SOURCES="$SYSROOT/sources"
export CROSS="$SYSROOT/cross"
export PATH="$CROSS/bin:/usr/bin:/usr/sbin"
export CONFIG_SITE="$SYSROOT/usr/share/config.site"

View File

@@ -0,0 +1,22 @@
fetch $BINUTILS_URL
cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION
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
make && make install
cd "$SOURCES" && rm -rf binutils-$BINUTILS_VERSION

46
stage/bootstrap/gcc.bash Normal file
View File

@@ -0,0 +1,46 @@
fetch $GCC_URL
fetch $GMP_URL
fetch $ISL_URL
fetch $MPC_URL
fetch $MPFR_URL
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
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
make && make install
cd .. && cat gcc/limitx.h gcc/glimits.h gcc/limity.h > "`dirname $($TARGET-gcc -print-libgcc-file-name)`/include/limits.h"
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION

View File

@@ -0,0 +1,31 @@
fetch $GLIBC_URL
fetch $GLIBC_PATCH_URL
cd "$SOURCES" && tar xf glibc-$GLIBC_VERSION.tar.xz && cd glibc-$GLIBC_VERSION
ln -fs ld-linux-x86-64.so.2 "$SYSROOT"/lib/ld-lsb-x86-64.so.3
patch -sNp1 -i "$SOURCES"/glibc-fhs-1.patch
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
make && make DESTDIR="$SYSROOT" install
sed '/RTLDLIST=/s@/usr@@g' -i "$SYSROOT"/usr/bin/ldd
cd "$SOURCES" && rm -rf glibc-$GLIBC_VERSION

View File

@@ -0,0 +1,22 @@
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
make && make DESTDIR="$SYSROOT" install
rm -rf "$SYSROOT"/usr/lib/lib{stdc++{,exp,fs},supc++}.la
cd "$SOURCES" && rm -rf gcc-$GCC_VERSION

View File

@@ -0,0 +1,12 @@
fetch $LINUX_URL
cd "$SOURCES" && tar xf linux-$LINUX_VERSION.tar.xz && cd linux-$LINUX_VERSION
make mrproper && make headers
find usr/include -type f ! -name '*.h' -delete
cp -r usr/include "$SYSROOT"/usr
cd "$SOURCES" && rm -rf linux-$LINUX_VERSION

31
stage/chroot/bzip2.bash Normal file
View File

@@ -0,0 +1,31 @@
fetch $BZIP2_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources BZIP2_VERSION=$BZIP2_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf bzip2-$BZIP2_VERSION.tar.gz && cd bzip2-$BZIP2_VERSION
sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
make -f Makefile-libbz2_so
make clean
make && make PREFIX=/usr install
cp -a libbz2.so.* /usr/lib
ln -sf libbz2.so.1.0.8 /usr/lib/libbz2.so
ln -sf libbz2.so.1.0.8 /usr/lib/libbz2.so.1
cp bzip2-shared /usr/bin/bzip2
for i in /usr/bin/{bzcat,bunzip2}; do
ln -sf bzip2 $i
done
rm -f /usr/lib/libbz2.a
cd "$SOURCES" && rm -rf bzip2-$BZIP2_VERSION
EOF

12
stage/chroot/file.bash Normal file
View File

@@ -0,0 +1,12 @@
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources FILE_VERSION=$FILE_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf file-$FILE_VERSION.tar.gz && cd file-$FILE_VERSION
./configure \
--prefix=/usr
make && make install
cd "$SOURCES" && rm -rf file-$FILE_VERSION
EOF

74
stage/chroot/glibc.bash Normal file
View File

@@ -0,0 +1,74 @@
fetch $TZDATA_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources GLIBC_VERSION=$GLIBC_VERSION LINUX_VERSION=$LINUX_VERSION TZDATA_VERSION=$TZDATA_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf glibc-$GLIBC_VERSION.tar.xz && cd glibc-$GLIBC_VERSION
patch -Np1 -i "$SOURCES/glibc-fhs-1.patch"
mkdir -p build && cd build
echo "rootsbindir=/usr/sbin" > configparms
../configure \
--prefix=/usr \
--disable-werror \
--disable-nscd \
libc_cv_slibdir=/usr/lib \
--enable-stack-protector=strong \
--enable-kernel= \
--disable-nls \
--enable-kernel=$LINUX_VERSION \
--silent \
--quiet
make && make install
touch /etc/ld.so.conf
sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd
cat > /etc/nsswitch.conf <<- "END_OF_FILE"
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
END_OF_FILE
tar xf $SOURCES/tzdata$TZDATA_VERSION.tar.gz
ZONEINFO=/usr/share/zoneinfo
mkdir -p $ZONEINFO/{posix,right}
for tz in etcetera southamerica northamerica europe africa antarctica asia australasia backward; do
zic -L /dev/null -d $ZONEINFO ${tz}
zic -L /dev/null -d $ZONEINFO/posix ${tz}
zic -L leapseconds -d $ZONEINFO/right ${tz}
done
cp zone.tab zone1970.tab iso3166.tab $ZONEINFO
zic -d $ZONEINFO -p Africa/Johannesburg
unset ZONEINFO tz
ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
cat > /etc/ld.so.conf <<- "END_OF_FILE"
/usr/local/lib
/opt/lib
include /etc/ld.so.conf.d/*.conf
END_OF_FILE
mkdir -p /etc/ld.so.conf.d
cd "$SOURCES" && rm -rf glibc-$GLIBC_VERSION
EOF

View File

@@ -0,0 +1,12 @@
fetch $IANA_ETC_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources IANA_ETC_VERSION=$IANA_ETC_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf iana-etc-$IANA_ETC_VERSION.tar.gz && cd iana-etc-$IANA_ETC_VERSION
cp services protocols /etc
cd "$SOURCES" && rm -rf iana-etc-$IANA_ETC_VERSION
EOF

22
stage/chroot/pcre2.bash Normal file
View File

@@ -0,0 +1,22 @@
fetch $PCRE2_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources PCRE2_VERSION=$PCRE2_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf pcre2-$PCRE2_VERSION.tar.gz && cd pcre2-$PCRE2_VERSION
./configure \
--prefix=/usr \
--enable-unicode \
--enable-jit \
--enable-pcre2-16 \
--enable-pcre2-32 \
--enable-pcre2grep-libz \
--enable-pcre2grep-libbz2 \
--enable-pcre2test-libreadline \
--disable-static
make && make install
cd "$SOURCES" && rm -rf pcre2-$PCRE2_VERSION
EOF

View File

@@ -0,0 +1,28 @@
fetch $READLINE_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources READLINE_VERSION=$READLINE_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf readline-$READLINE_VERSION.tar.gz && cd readline-$READLINE_VERSION
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install
sed -i 's/-Wl,-rpath,[^ ]*//' support/shobj-conf
sed -e '270a\
else\
chars_avail = 1;' \
-e '288i\ result = -1;' \
-i.orig input.c
./configure \
--prefix=/usr \
--disable-static \
--with-curses
make SHLIB_LIBS="-lncursesw" && make install
cd "$SOURCES" && rm -rf readline-$READLINE_VERSION
EOF

13
stage/chroot/xz.bash Normal file
View File

@@ -0,0 +1,13 @@
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources XZ_VERSION=$XZ_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf xz-$XZ_VERSION.tar.xz && cd xz-$XZ_VERSION
./configure \
--prefix=/usr \
--disable-static
make && make install
cd "$SOURCES" && rm -rf xz-$XZ_VERSION
EOF

17
stage/chroot/zlib.bash Normal file
View File

@@ -0,0 +1,17 @@
fetch $ZLIB_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources ZLIB_VERSION=$ZLIB_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf zlib-$ZLIB_VERSION.tar.gz && cd zlib-$ZLIB_VERSION
./configure \
--prefix=/usr
make && make install
rm -f /usr/lib/libz.a
cd "$SOURCES" && rm -rf zlib-$ZLIB_VERSION
EOF

15
stage/chroot/zstd.bash Normal file
View File

@@ -0,0 +1,15 @@
fetch $ZSTD_URL
sudo chroot "$SYSROOT" /usr/bin/env -i MAKEFLAGS="$MAKEFLAGS" PATH=/usr/bin:/usr/sbin SOURCES=/sources ZSTD_VERSION=$ZSTD_VERSION /usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf zstd-$ZSTD_VERSION.tar.gz && cd zstd-$ZSTD_VERSION
make prefix=/usr
make prefix=/usr install
rm /usr/lib/libzstd.a
cd "$SOURCES" && rm -rf zstd-$ZSTD_VERSION
EOF

View File

@@ -0,0 +1,22 @@
fetch $BISON_URL
sudo chroot "$SYSROOT" /usr/bin/env -i \
MAKEFLAGS="$MAKEFLAGS" \
PATH=/usr/bin:/usr/sbin \
SOURCES=/sources \
BISON_VERSION=$BISON_VERSION \
/usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf bison-$BISON_VERSION.tar.xz && cd bison-$BISON_VERSION
./configure \
--prefix=/usr \
--silent \
--quiet
make && make install
cd "$SOURCES" && rm -rf bison-$BISON_VERSION
EOF

View File

@@ -0,0 +1,10 @@
sudo chroot "$SYSROOT" /usr/bin/env -i \
/usr/bin/bash <<- "EOF"
rm -rf /usr/share/{info,man,doc}/*
find /usr/{lib,libexec} -name \*.la -delete
rm -rf /cross
EOF

28
stage/prechroot/perl.bash Normal file
View File

@@ -0,0 +1,28 @@
fetch $PERL_URL
sudo chroot "$SYSROOT" /usr/bin/env -i \
MAKEFLAGS="$MAKEFLAGS" \
PATH=/usr/bin:/usr/sbin \
SOURCES=/sources \
PERL_VERSION=$PERL_VERSION \
/usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf perl-$PERL_VERSION.tar.gz && cd perl-$PERL_VERSION
sh Configure -des \
-D prefix=/usr \
-D vendorprefix=/usr \
-D useshrplib \
-D privlib=/usr/lib/perl5/$PERL_VERSION/core_perl \
-D archlib=/usr/lib/perl5/$PERL_VERSION/core_perl \
-D sitelib=/usr/lib/perl5/$PERL_VERSION/site_perl \
-D sitearch=/usr/lib/perl5/$PERL_VERSION/site_perl \
-D vendorlib=/usr/lib/perl5/$PERL_VERSION/vendor_perl \
-D vendorarch=/usr/lib/perl5/$PERL_VERSION/vendor_perl
make && make install
cd "$SOURCES" && rm -rf perl-$PERL_VERSION
EOF

View File

@@ -0,0 +1,28 @@
fetch $PYTHON_URL
sudo chroot "$SYSROOT" /usr/bin/env -i \
MAKEFLAGS="$MAKEFLAGS" \
PATH=/usr/bin:/usr/sbin \
SOURCES=/sources \
PYTHON_VERSION=$PYTHON_VERSION \
/usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf Python-$PYTHON_VERSION.tar.xz && cd Python-$PYTHON_VERSION
./configure \
--prefix=/usr \
--enable-shared \
--without-static-libpython \
--disable-test-modules \
--without-ensurepip \
--silent \
--quiet
make && make install
rm -rf /usr/lib/python$PYTHON_VERSION/test
cd "$SOURCES" && rm -rf Python-$PYTHON_VERSION
EOF

View File

@@ -0,0 +1,35 @@
sudo chroot "$SYSROOT" /usr/bin/env -i /usr/bin/bash <<- "EOF"
ln -s /run /var/run
ln -sfv /run/lock /var/lock
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
ln -s proc/self/mounts /etc/mtab
cat > /etc/hosts <<- "END_OF_FILE"
127.0.0.1 localhost axe
::1 localhost
END_OF_FILE
cat > /etc/passwd <<- "END_OF_FILE"
root:x:0:0:root:/root:/usr/bin/bash
uuidd:x:6:6::/dev/null:/usr/bin/nologin
messagebus:x:7:7::/run/dbus:/usr/bin/nologin
nobody:x:65534:65534::/dev/null:/usr/bin/nologin
END_OF_FILE
cat > /etc/group <<- "END_OF_FILE"
root:x:0:
tty:x:1:
audio:x:2:
video:x:3:
input:x:4:
wheel:x:5:
uuidd:x:6:
messagebus:x:7:
users:x:999:
nogroup:x:65534:
END_OF_FILE
EOF

View File

@@ -0,0 +1,35 @@
fetch $UTIL_LINUX_URL
sudo chroot "$SYSROOT" /usr/bin/env -i \
MAKEFLAGS="$MAKEFLAGS" \
PATH=/usr/bin:/usr/sbin \
SOURCES=/sources \
UTIL_LINUX_VERSION=$UTIL_LINUX_VERSION \
/usr/bin/bash <<- "EOF"
set -euo pipefail
cd "$SOURCES" && tar xf util-linux-$UTIL_LINUX_VERSION.tar.xz && cd util-linux-$UTIL_LINUX_VERSION
mkdir -p /var/lib/hwclock
./configure --libdir=/usr/lib \
--runstatedir=/run \
--disable-chfn-chsh \
--disable-login \
--disable-nologin \
--disable-su \
--disable-setpriv \
--disable-runuser \
--disable-pylibmount \
--disable-static \
--disable-liblastlog2 \
--without-python \
ADJTIME_PATH=/var/lib/hwclock/adjtime \
--silent \
--quiet
make && make install
cd "$SOURCES" && rm -rf util-linux-$UTIL_LINUX_VERSION
EOF

19
stage/toolchain/bash.bash Normal file
View File

@@ -0,0 +1,19 @@
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 \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
ln -s bash "$SYSROOT"/bin/sh
cd "$SOURCES" && rm -rf bash-$BASH_VERSION

View File

@@ -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

View File

@@ -0,0 +1,22 @@
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 \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
mv "$SYSROOT"/usr/bin/chroot "$SYSROOT"/usr/sbin
cd "$SOURCES" && rm -rf coreutils-$COREUTILS_VERSION

View File

@@ -0,0 +1,17 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf diffutils-$DIFFUTILS_VERSION

30
stage/toolchain/file.bash Normal file
View File

@@ -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

View File

@@ -0,0 +1,17 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf findutils-$FINDUTILS_VERSION

18
stage/toolchain/gawk.bash Normal file
View File

@@ -0,0 +1,18 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf gawk-$GAWK_VERSION

40
stage/toolchain/gcc.bash Normal file
View File

@@ -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

16
stage/toolchain/grep.bash Normal file
View File

@@ -0,0 +1,16 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf grep-$GREP_VERSION

14
stage/toolchain/gzip.bash Normal file
View File

@@ -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

18
stage/toolchain/m4.bash Normal file
View File

@@ -0,0 +1,18 @@
fetch $M4_URL
cd "$SOURCES" && tar xf m4-$M4_VERSION.tar.xz && cd m4-$M4_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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf m4-$M4_VERSION

16
stage/toolchain/make.bash Normal file
View File

@@ -0,0 +1,16 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf make-$MAKE_VERSION

View File

@@ -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

View File

@@ -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

16
stage/toolchain/sed.bash Normal file
View File

@@ -0,0 +1,16 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf sed-$SED_VERSION

16
stage/toolchain/tar.bash Normal file
View File

@@ -0,0 +1,16 @@
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) \
--disable-nls \
--silent \
--quiet
make && make DESTDIR="$SYSROOT" install
cd "$SOURCES" && rm -rf tar-$TAR_VERSION

19
stage/toolchain/xz.bash Normal file
View File

@@ -0,0 +1,19 @@
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 \
--disable-nls \
--quiet
make && make DESTDIR="$SYSROOT" install
rm "$SYSROOT"/usr/lib/liblzma.la
cd "$SOURCES" && rm -rf xz-$XZ_VERSION

46
utilities.bash Normal file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
create_sysroot() {
if [ ! -d "$SYSROOT" ]; then
mkdir -p "$SYSROOT"/{etc,cross,sources,usr,dev,proc,sys,run}
mkdir -p "$SYSROOT"/usr/{bin,sbin,lib,include}
mkdir -p "$SYSROOT"/var/{cache,lib,run}
for directory in bin sbin lib; do
ln -fs usr/$directory "$SYSROOT"/$directory
done
ln -fs usr/lib "$SYSROOT"/lib64
fi
}
change_owner() {
sudo chown -R root:root "$SYSROOT"/{bin,cross,dev,etc,lib,lib64,proc,sys,run,sbin,sys,usr,var}
}
do_mount() {
if ! mountpoint -q "$SYSROOT/dev"; then
sudo mount --bind /dev "$SYSROOT"/dev
sudo mount -t devpts devpts -o gid=1,mode=0620 "$SYSROOT"/dev/pts
sudo mount -t proc proc "$SYSROOT"/proc
sudo mount -t sysfs sysfs "$SYSROOT"/sys
sudo mount -t tmpfs tmpfs "$SYSROOT"/run
if [ -h "$SYSROOT"/dev/shm ]; then
sudo install -d -m 1777 "$SYSROOT"$(realpath /dev/shm)
else
sudo mount -t tmpfs -o nosuid,nodev tmpfs "$SYSROOT"/dev/shm
fi
fi
}
do_unmount() {
sudo mountpoint -q "$SYSROOT"/dev/shm
sudo umount "$SYSROOT"/dev/shm
sudo umount "$SYSROOT"/dev/pts
sudo umount "$SYSROOT"/{sys,proc,run,dev}
}
fetch() {
wget -N -c --show-progress -q -P "$SOURCES" $1
}

110
version.bash Normal file
View File

@@ -0,0 +1,110 @@
#!/usr/bin/env bash
export BINUTILS_VERSION=2.45.1
export BINUTILS_URL=https://mirror.ufs.ac.za/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz
export GCC_VERSION=15.2.0
export GCC_URL=https://mirror.ufs.ac.za/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
export GMP_VERSION=6.3.0
export GMP_URL=https://mirror.ufs.ac.za/gnu/gmp/gmp-$GMP_VERSION.tar.xz
export MPC_VERSION=1.3.1
export MPC_URL=https://mirror.ufs.ac.za/gnu/mpc/mpc-$MPC_VERSION.tar.gz
export MPFR_VERSION=4.2.2
export MPFR_URL=https://mirror.ufs.ac.za/gnu/mpfr/mpfr-$MPFR_VERSION.tar.xz
export ISL_VERSION=0.27
export ISL_URL=https://libisl.sourceforge.io/isl-$ISL_VERSION.tar.xz
export GLIBC_VERSION=2.43
export GLIBC_URL=https://mirror.ufs.ac.za/gnu/glibc/glibc-$GLIBC_VERSION.tar.xz
export GLIBC_PATCH_URL=https://www.linuxfromscratch.org/patches/lfs/development/glibc-fhs-1.patch
export LINUX_VERSION=6.18.7
IFS='.' read -r LINUX_VERSION_MAJOR LINUX_VERSION_MINOR LINUX_VERSION_PATCH <<< $LINUX_VERSION
export LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v$LINUX_VERSION_MAJOR.x/linux-$LINUX_VERSION.tar.xz
export M4_VERSION=1.4.20
export M4_URL=https://mirror.ufs.ac.za/gnu/m4/m4-$M4_VERSION.tar.xz
export NCURSES_VERSION=6.6
export NCURSES_URL=https://mirror.ufs.ac.za/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz
export BASH_VERSION=5.3
export BASH_URL=https://mirror.ufs.ac.za/gnu/bash/bash-$BASH_VERSION.tar.gz
export COREUTILS_VERSION=9.9
export COREUTILS_URL=https://mirror.ufs.ac.za/gnu/coreutils/coreutils-$COREUTILS_VERSION.tar.xz
export DIFFUTILS_VERSION=3.12
export DIFFUTILS_URL=https://mirror.ufs.ac.za/gnu/diffutils/diffutils-$DIFFUTILS_VERSION.tar.xz
export FILE_VERSION=5.46
export FILE_URL=https://astron.com/pub/file/file-$FILE_VERSION.tar.gz
export FINDUTILS_VERSION=4.10.0
export FINDUTILS_URL=https://mirror.ufs.ac.za/gnu/findutils/findutils-$FINDUTILS_VERSION.tar.xz
export GAWK_VERSION=5.3.2
export GAWK_URL=https://mirror.ufs.ac.za/gnu/gawk/gawk-$GAWK_VERSION.tar.xz
export GREP_VERSION=3.12
export GREP_URL=https://mirror.ufs.ac.za/gnu/grep/grep-$GREP_VERSION.tar.xz
export GZIP_VERSION=1.14
export GZIP_URL=https://mirror.ufs.ac.za/gnu/gzip/gzip-$GZIP_VERSION.tar.xz
export MAKE_VERSION=4.4.1
export MAKE_URL=https://mirror.ufs.ac.za/gnu/make/make-$MAKE_VERSION.tar.gz
export PATCH_VERSION=2.8
export PATCH_URL=https://mirror.ufs.ac.za/gnu/patch/patch-$PATCH_VERSION.tar.xz
export SED_VERSION=4.9
export SED_URL=https://mirror.ufs.ac.za/gnu/sed/sed-$SED_VERSION.tar.xz
export TAR_VERSION=1.35
export TAR_URL=https://mirror.ufs.ac.za/gnu/tar/tar-$TAR_VERSION.tar.xz
export XZ_VERSION=5.8.2
export XZ_URL=https://github.com//tukaani-project/xz/releases/download/v$XZ_VERSION/xz-$XZ_VERSION.tar.xz
export GETTEXT_VERSION=1.0
export GETTEXT_URL=https://mirror.ufs.ac.za/gnu/gettext/gettext-$GETTEXT_VERSION.tar.xz
export BISON_VERSION=3.8.2
export BISON_URL=https://mirror.ufs.ac.za/gnu/bison/bison-$BISON_VERSION.tar.xz
export PERL_VERSION=5.42.0
export PERL_URL=https://www.cpan.org/src/5.0/perl-$PERL_VERSION.tar.gz
export PYTHON_VERSION=3.14.3
export PYTHON_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz
export UTIL_LINUX_VERSION=2.41.3
export UTIL_LINUX_URL=https://www.kernel.org/pub/linux/utils/util-linux/v2.41/util-linux-$UTIL_LINUX_VERSION.tar.xz
export IANA_ETC_VERSION=20260202
export IANA_ETC_URL=https://github.com/Mic92/iana-etc/releases/download/$IANA_ETC_VERSION/iana-etc-$IANA_ETC_VERSION.tar.gz
export TZDATA_VERSION=2025c
export TZDATA_URL=https://www.iana.org/time-zones/repository/releases/tzdata$TZDATA_VERSION.tar.gz
export ZLIB_VERSION=1.3.2
export ZLIB_URL=https://zlib.net/fossils/zlib-$ZLIB_VERSION.tar.gz
export BZIP2_VERSION=1.0.8
export BZIP2_URL=https://www.sourceware.org/pub/bzip2/bzip2-$BZIP2_VERSION.tar.gz
export ZSTD_VERSION=1.5.7
export ZSTD_URL=https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz
export READLINE_VERSION=8.3
export READLINE_URL=https://mirror.ufs.ac.za/gnu/readline/readline-$READLINE_VERSION.tar.gz
export PCRE2_VERSION=10.47
export PCRE2_URL=https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz