Improve target selection
This commit is contained in:
parent
2d3041ac84
commit
2097a50b76
2 changed files with 52 additions and 15 deletions
59
build.sh
59
build.sh
|
|
@ -39,24 +39,22 @@ fi
|
|||
|
||||
export BASE_DIR=$(pwd)
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
echo "You must set a target architecture among supported ones:"
|
||||
if [ -z "$KERNEL_ARCH" ]; then
|
||||
echo "You must set a kernel target architecture among supported ones:"
|
||||
echo "i386"
|
||||
echo "x86_64"
|
||||
echo "armv5"
|
||||
echo "arm"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$LFS_TGT" ]; then
|
||||
if [ -z "$GNUEABI" ]; then
|
||||
export GNUEABI="gnu"
|
||||
fi
|
||||
|
||||
export LFS_TGT="$ARCH-lfs-linux-$GNUEABI"
|
||||
echo "Target triplet set to '$LFS_TGT'. You can specify another one with the LFS_TGT env var."
|
||||
if [ -z "$TARGET_TRIPLET_ARCH" ] || [ -z "$TARGET_TRIPLET_VENDOR" ] || [ -z "$TARGET_TRIPLET_OS" ] || [ -z "$TARGET_TRIPLET_GNUEABI" ]; then
|
||||
echo "You MUST define TARGET_TRIPLET_ARCH, TARGET_TRIPLET_VENDOR, TARGET_TRIPLET_OS and TARGET_TRIPLET_GNUEABI"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export LFS_TGT="$TARGET_TRIPLET_ARCH-$TARGET_TRIPLET_VENDOR-$TARGET_TRIPLET_OS-$TARGET_TRIPLET_GNUEABI"
|
||||
|
||||
if [ ! -d "$LFS_TGT" ]; then
|
||||
export LFS="$(pwd)/out/$LFS_TGT/rootfs"
|
||||
|
||||
|
|
@ -181,7 +179,7 @@ if [ ! -f "$STEPS_DIR/linux-headers" ]; then
|
|||
fi
|
||||
cd "$LFS_BUILD/linux"
|
||||
make mrproper
|
||||
make headers_install ARCH="$ARCH" INSTALL_HDR_PATH="$LFS/usr"
|
||||
make headers_install ARCH="$KERNEL_ARCH" INSTALL_HDR_PATH="$LFS/usr"
|
||||
cd "$BASE_DIR"
|
||||
#rm -rf "$LFS_BUILD/linux"
|
||||
touch "$STEPS_DIR/linux-headers"
|
||||
|
|
@ -227,7 +225,7 @@ if [ ! -f "$STEPS_DIR/gcc-step1" ]; then
|
|||
--enable-languages=c
|
||||
make -j 32 all-gcc # if build fails add --disable-libsanitizer
|
||||
make -j 32 install-gcc
|
||||
make check-gcc RUNTESTFLAGS=--target_board=$ARCH-sim
|
||||
make check-gcc RUNTESTFLAGS=--target_board=${TARGET_TRIPLET_ARCH}-sim
|
||||
cd "$BASE_DIR"
|
||||
rm -rf "$LFS_BUILD/gcc/build" # Do not remove the whole gcc directory: we need it for libstdc++
|
||||
touch "$STEPS_DIR/gcc-step1"
|
||||
|
|
@ -1235,11 +1233,12 @@ if [ ! -f "$STEPS_DIR/pcre2" ]; then
|
|||
CFLAGS+=" -ffat-lto-objects"
|
||||
CXXFLAGS+=" -ffat-lto-objects"
|
||||
|
||||
# WARNING: using prefix with LFS is a VERY BIG WORKAROUND!!!
|
||||
"../configure" \
|
||||
--with-sysroot=${LFS} \
|
||||
--host=${LFS_TGT} \
|
||||
--build=${BUILD_MACHINE_TRIPLET} \
|
||||
--prefix=/usr \
|
||||
--prefix=${LFS}/usr \
|
||||
--enable-shared \
|
||||
--enable-jit \
|
||||
--enable-pcre2-16 \
|
||||
|
|
@ -1247,16 +1246,46 @@ if [ ! -f "$STEPS_DIR/pcre2" ]; then
|
|||
--enable-pcre2grep-libbz2 \
|
||||
--enable-pcre2grep-libz \
|
||||
--enable-pcre2test-libreadline \
|
||||
--prefix=/usr \
|
||||
--cache-file=config.cache
|
||||
|
||||
make -j 32
|
||||
make -j 32 DESTDIR=$LFS install
|
||||
make -j 32 install
|
||||
|
||||
export CFLAGS="$CFLAGS_old"
|
||||
export CXXFLAGS="$CXXFLAGS_old"
|
||||
|
||||
cd "$BASE_DIR"
|
||||
rm -rf "$LFS_BUILD/pcre2"
|
||||
touch "$STEPS_DIR/pcre2"
|
||||
fi
|
||||
exit 0
|
||||
# build swig
|
||||
if [ ! -f "$STEPS_DIR/swig" ]; then
|
||||
if [ ! -d "$LFS_BUILD/swig" ]; then
|
||||
tar -xf "$BASE_DIR/sources/swig-4.3.0.tar.gz"
|
||||
mv "swig-4.3.0" "$LFS_BUILD/swig"
|
||||
fi
|
||||
cd "$LFS_BUILD/swig"
|
||||
|
||||
"./autogen.sh"
|
||||
|
||||
mkdir -vp build-$LFS_TGT
|
||||
cd build-$LFS_TGT
|
||||
|
||||
"../configure" \
|
||||
--with-sysroot=${LFS} \
|
||||
--host=${LFS_TGT} \
|
||||
--build=${BUILD_MACHINE_TRIPLET} \
|
||||
--prefix=/usr \
|
||||
--cache-file=config.cache
|
||||
|
||||
make -j 32
|
||||
make -j 32 DESTDIR="$LFS" install
|
||||
|
||||
cd "$BASE_DIR"
|
||||
rm -rf "$LFS_BUILD/swig"
|
||||
touch "$STEPS_DIR/swig"
|
||||
fi
|
||||
|
||||
# build libcap-ng (needs swig)
|
||||
if [ ! -f "$STEPS_DIR/libcap-ng" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue