lfs/build-host-tools.sh
2024-12-12 13:41:56 +01:00

59 lines
1.5 KiB
Bash

#!/bin/bash
# build m4
if [ ! -f "$STEPS_DIR/m4-tool" ]; then
if [ ! -d "$LFS_BUILD/m4" ]; then
tar -xzf "$BASE_DIR/sources/m4-1.4.19.tar.gz"
mv "m4-1.4.19" "$LFS_BUILD/m4"
fi
cd "$LFS_BUILD/m4"
mkdir -vp build-$BUILD_MACHINE_TRIPLET
cd build-$BUILD_MACHINE_TRIPLET
echo "rootsbindir=/usr/sbin" > configparms
"../configure" \
--prefix=/usr \
--build=${BUILD_MACHINE_TRIPLET} \
--host=${BUILD_MACHINE_TRIPLET} \
--with-build-cc
make -j 32
make DESTDIR=$LFS_TOOLS install
"strip" --strip-unneeded $LFS_TOOLS/usr/bin/m4
cd "$BASE_DIR"
#rm -rf "$LFS_BUILD/m4" # leave the directory there for the following compilation
touch "$STEPS_DIR/m4-tool"
fi
# build bash
if [ ! -f "$STEPS_DIR/bash-tools" ]; then
if [ ! -d "$LFS_BUILD/bash" ]; then
tar -xzf "$BASE_DIR/sources/bash-5.2.tar.gz"
mv "bash-5.2" "$LFS_BUILD/bash"
fi
cd "$LFS_BUILD/bash"
mkdir -vp build-$BUILD_MACHINE_TRIPLET
cd build-$BUILD_MACHINE_TRIPLET
"../configure" \
--prefix=$LFS_TOOLS \
--host=${BUILD_MACHINE_TRIPLET} \
--build=${BUILD_MACHINE_TRIPLET} \
--without-bash-malloc \
--enable-threads \
--without-curses
make -j 32
make install
cd "$BASE_DIR"
#rm -rf "$LFS_BUILD/bash" # leave the directory there for the following compilation
touch "$STEPS_DIR/bash-tools"
fi