Initial AeroOS source

This commit is contained in:
Joe committed 2026-06-19 10:02:12 -04:00
commit b27732ad89
42 files changed
+3775

No files matched your search

+108
View File
@@ -0,0 +1,108 @@
#!/usr/bin/env bash
# scripts/02-temp-tools.sh — temporary tools in $AEROS_ROOT (LFS ch. 6).
# Cross-compiled against the stage-01 toolchain; gives us enough to chroot.
source "$(dirname "${BASH_SOURCE[0]}")/lib/common.sh"
deny_root
export LFS="$AEROS_ROOT"
export LC_ALL=POSIX
export AEROS_TGT="$AEROS_TARGET_TRIPLET"
export PATH="$AEROS_TOOLS/bin:/usr/bin:/bin"
export CONFIG_SITE="$LFS/usr/share/config.site"
WORK="$AEROS_SOURCES/work-temp"
mkdir -p "$WORK"
# generic cross autotools temp-tool: _xtool <pkg> <configure-args...>
_xtool() {
local pkg="$1"; shift
local d; d="$(cd "$WORK" && unpack "$pkg")"; cd "$WORK/$d"
[[ -x ./configure ]] || die "$pkg: no configure script"
./configure --prefix=/usr --host="$AEROS_TGT" --build="$(build-aux/config.guess 2>/dev/null || ./config.guess 2>/dev/null || echo x86_64-pc-linux-gnu)" "$@"
make
make DESTDIR="$LFS" install
}
t_m4() { _xtool m4; }
t_ncurses() { local d; d="$(cd "$WORK" && unpack ncurses)"; cd "$WORK/$d"
mkdir build; pushd build; ../configure AWK=gawk >/dev/null; make -C include; make -C progs tic; popd
./configure --prefix=/usr --host="$AEROS_TGT" --build="$(./config.guess)" \
--mandir=/usr/share/man --with-manpage-format=normal \
--with-shared --without-normal --without-cxx-binding \
--without-debug --without-ada --disable-stripping AWK=gawk
make
make DESTDIR="$LFS" TIC_PATH="$(pwd)/build/progs/tic" install
ln -sv libncursesw.so "$LFS/usr/lib/libncurses.so"
sed -e 's/^#if.*XOPEN.*$/#if 1/' -i "$LFS/usr/include/curses.h"; }
t_bash() { _xtool bash --without-bash-malloc bash_cv_strtold_broken=no
ln -sv bash "$LFS/bin/sh"; }
t_coreutils() { _xtool coreutils --enable-install-program=hostname \
--enable-no-install-program=kill,uptime gl_cv_macro_MB_CUR_MAX_good=y
mkdir -pv "$LFS/usr/sbin"; }
t_diffutils() { _xtool diffutils gl_cv_func_strcasecmp_works=y; }
t_file() { local d; d="$(cd "$WORK" && unpack file)"; cd "$WORK/$d"
mkdir build; pushd build
../configure --disable-bzlib --disable-libseccomp \
--disable-xzlib --disable-zlib; make; popd
./configure --prefix=/usr --host="$AEROS_TGT" --build="$(./config.guess)"
make FILE_COMPILE="$(pwd)/build/src/file"
make DESTDIR="$LFS" install; rm -v "$LFS/usr/lib/libmagic.la"; }
t_findutils() { _xtool findutils --localstatedir=/var/lib/locate; }
t_gawk() { local d; d="$(cd "$WORK" && unpack gawk)"; cd "$WORK/$d"
sed -i 's/extras//' Makefile.in; _xtool_done=1
./configure --prefix=/usr --host="$AEROS_TGT" --build="$(./config.guess)"
make; make DESTDIR="$LFS" install; }
t_grep() { _xtool grep; }
t_gzip() { _xtool gzip; }
t_make() { _xtool make; }
t_patch() { _xtool patch; }
t_sed() { _xtool sed; }
t_tar() { _xtool tar; }
t_xz() { _xtool xz; rm -v "$LFS"/usr/lib/liblzma.la; }
t_binutils2() { local d; d="$(cd "$WORK" && unpack binutils)"; cd "$WORK/$d"
sed '6031s/$add_dir//' -i ltmain.sh
mkdir build; cd build
../configure --prefix=/usr --build="$(../config.guess)" \
--host="$AEROS_TGT" --disable-nls --enable-shared \
--enable-gprofng=no --disable-werror \
--enable-64-bit-bfd --enable-new-dtags \
--enable-default-hash-style=gnu
make; make DESTDIR="$LFS" install
rm -v "$LFS"/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} 2>/dev/null || true; }
t_gcc2() { local d; d="$(cd "$WORK" && unpack gcc)"; cd "$WORK/$d"
tar -xf "$AEROS_SOURCES/$(pkg_tarball mpfr)"; mv "$(pkg_srcdir mpfr)" mpfr
tar -xf "$AEROS_SOURCES/$(pkg_tarball gmp)"; mv "$(pkg_srcdir gmp)" gmp
tar -xf "$AEROS_SOURCES/$(pkg_tarball mpc)"; mv "$(pkg_srcdir mpc)" mpc
case "$AEROS_ARCH" in x86_64) sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64;; esac
sed '/thread_header =/s/@.*@/gthr-posix.h/' -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
mkdir build; cd build
../configure --build="$(../config.guess)" --host="$AEROS_TGT" \
--target="$AEROS_TGT" LDFLAGS_FOR_TARGET=-L$PWD/$AEROS_TGT/libgcc \
--prefix=/usr --with-build-sysroot="$LFS" --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++
make; make DESTDIR="$LFS" install
ln -sfv gcc "$LFS/usr/bin/cc"; }
step "Temporary tools (cross-compiled into $AEROS_ROOT)"
once tt-m4 t_m4
once tt-ncurses t_ncurses
once tt-bash t_bash
once tt-coreutils t_coreutils
once tt-diffutils t_diffutils
once tt-file t_file
once tt-findutils t_findutils
once tt-gawk t_gawk
once tt-grep t_grep
once tt-gzip t_gzip
once tt-make t_make
once tt-patch t_patch
once tt-sed t_sed
once tt-tar t_tar
once tt-xz t_xz
once tt-binutils2 t_binutils2
once tt-gcc2 t_gcc2
ok "temporary tools complete — system is now chroot-ready"