From 6051ca386f9ff98995fe426d1402721f9fd5f38a Mon Sep 17 00:00:00 2001 From: phanes Date: Sun, 19 Feb 2023 17:25:49 -0500 Subject: [PATCH] moving to stage 2 for temp tool cross-compilation up to 6.3 --- Makefile | 4 + make.project/build_stage2.sh | 19 ++ make.project/clean.sh | 5 +- make.project/purge_artifacts.sh | 9 +- .../components/{ => stage1}/binutils.bash | 0 .../{ => stage1}/check_dependencies.bash | 0 .../{ => stage1}/create_sysroot_dirs.bash | 0 .../x86_64/components/{ => stage1}/gcc.bash | 5 +- .../x86_64/components/{ => stage1}/glibc.bash | 0 .../x86_64/components/{ => stage1}/linux.bash | 0 .../components/{ => stage1}/welcome.bash | 0 rex.project/x86_64/components/stage2/m4.bash | 216 +++++++++++++++ .../x86_64/components/stage2/ncurses.bash | 260 ++++++++++++++++++ .../x86_64/components/stage2/welcome.bash | 48 ++++ .../x86_64/environments/stage2.env.bash | 71 +++++ rex.project/x86_64/plans/stage1.plan | 11 +- rex.project/x86_64/plans/stage2.plan | 20 ++ rex.project/x86_64/units/stage1.units | 36 ++- rex.project/x86_64/units/stage2.units | 58 ++++ 19 files changed, 745 insertions(+), 17 deletions(-) create mode 100755 make.project/build_stage2.sh rename rex.project/x86_64/components/{ => stage1}/binutils.bash (100%) rename rex.project/x86_64/components/{ => stage1}/check_dependencies.bash (100%) rename rex.project/x86_64/components/{ => stage1}/create_sysroot_dirs.bash (100%) rename rex.project/x86_64/components/{ => stage1}/gcc.bash (99%) rename rex.project/x86_64/components/{ => stage1}/glibc.bash (100%) rename rex.project/x86_64/components/{ => stage1}/linux.bash (100%) rename rex.project/x86_64/components/{ => stage1}/welcome.bash (100%) create mode 100755 rex.project/x86_64/components/stage2/m4.bash create mode 100755 rex.project/x86_64/components/stage2/ncurses.bash create mode 100755 rex.project/x86_64/components/stage2/welcome.bash create mode 100755 rex.project/x86_64/environments/stage2.env.bash create mode 100644 rex.project/x86_64/plans/stage2.plan create mode 100644 rex.project/x86_64/units/stage2.units diff --git a/Makefile b/Makefile index 379ab58..f34ee00 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,10 @@ download_patches: build_stage1: sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage1.sh" +# kicks off rex +build_stage2: + sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage2.sh" + # example: # make dirs # make install_rex diff --git a/make.project/build_stage2.sh b/make.project/build_stage2.sh new file mode 100755 index 0000000..e1ff5d5 --- /dev/null +++ b/make.project/build_stage2.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# closely aligns with LFS Ch 5, 6 + +# fix an issue with open files limit on some hosts +ulimit -l unlimited + +#ulimit -n 10240 +ulimit -c unlimited + +echo "Bootstrapping from MAKE to REX..." + +# Executes rex from within the shell. + +${dir_localtools}/rex -v \ + -c ${dir_rex}/x86_64/rex.config \ + -p ${dir_rex}/x86_64/plans/stage2.plan + +retVal=$? diff --git a/make.project/clean.sh b/make.project/clean.sh index cee5d2a..57ad5ea 100755 --- a/make.project/clean.sh +++ b/make.project/clean.sh @@ -1,8 +1,9 @@ # clean the slate echo echo "Deleting ${dir_stage}" -rm -Rfv ${dir_stage} +rm -Rf ${dir_stage} echo echo "Deleting ${dir_stage}" -rm -Rfv ${dir_logs} +rm -Rf ${dir_logs} +echo diff --git a/make.project/purge_artifacts.sh b/make.project/purge_artifacts.sh index c3d7d7b..a457a0f 100755 --- a/make.project/purge_artifacts.sh +++ b/make.project/purge_artifacts.sh @@ -1,4 +1,9 @@ -rm -Rfv ${dir_artifacts} -rm -Rfv ${dir_sysroot} +echo +echo "Recreating ${dir_artifacts}" +rm -Rf ${dir_artifacts} mkdir -p ${dir_artifacts} + +echo +echo "Recreating ${dir_sysroot}" +rm -Rf ${dir_sysroot} mkdir -p ${dir_sysroot} diff --git a/rex.project/x86_64/components/binutils.bash b/rex.project/x86_64/components/stage1/binutils.bash similarity index 100% rename from rex.project/x86_64/components/binutils.bash rename to rex.project/x86_64/components/stage1/binutils.bash diff --git a/rex.project/x86_64/components/check_dependencies.bash b/rex.project/x86_64/components/stage1/check_dependencies.bash similarity index 100% rename from rex.project/x86_64/components/check_dependencies.bash rename to rex.project/x86_64/components/stage1/check_dependencies.bash diff --git a/rex.project/x86_64/components/create_sysroot_dirs.bash b/rex.project/x86_64/components/stage1/create_sysroot_dirs.bash similarity index 100% rename from rex.project/x86_64/components/create_sysroot_dirs.bash rename to rex.project/x86_64/components/stage1/create_sysroot_dirs.bash diff --git a/rex.project/x86_64/components/gcc.bash b/rex.project/x86_64/components/stage1/gcc.bash similarity index 99% rename from rex.project/x86_64/components/gcc.bash rename to rex.project/x86_64/components/stage1/gcc.bash index b2f67bf..fab3866 100755 --- a/rex.project/x86_64/components/gcc.bash +++ b/rex.project/x86_64/components/stage1/gcc.bash @@ -236,7 +236,7 @@ mode_build_libstdcxx_pass1() { --disable-multilib \ --disable-nls \ --disable-libstdcxx-pch \ - --with-gxx-include-dir=/$(basename ${CROSSTOOLS_DIR})/${T_TRIPLET}/include/c++/10.2.0 + --with-gxx-include-dir=/$(basename ${CROSSTOOLS_DIR})/${T_TRIPLET}/include/c++/12.2.0 assert_zero $? logprint "Compiling..." @@ -291,6 +291,9 @@ mode_install_libstdcxx_pass1() { make DESTDIR=${T_SYSROOT} install assert_zero $? + logprint "Cleaning up libtool archive files..." + rm -v ${T_SYSROOT}/usr/lib/lib{stdc++,stdc++fs,supc++}.la + logprint "Install of libstdcxx complete." } diff --git a/rex.project/x86_64/components/glibc.bash b/rex.project/x86_64/components/stage1/glibc.bash similarity index 100% rename from rex.project/x86_64/components/glibc.bash rename to rex.project/x86_64/components/stage1/glibc.bash diff --git a/rex.project/x86_64/components/linux.bash b/rex.project/x86_64/components/stage1/linux.bash similarity index 100% rename from rex.project/x86_64/components/linux.bash rename to rex.project/x86_64/components/stage1/linux.bash diff --git a/rex.project/x86_64/components/welcome.bash b/rex.project/x86_64/components/stage1/welcome.bash similarity index 100% rename from rex.project/x86_64/components/welcome.bash rename to rex.project/x86_64/components/stage1/welcome.bash diff --git a/rex.project/x86_64/components/stage2/m4.bash b/rex.project/x86_64/components/stage2/m4.bash new file mode 100755 index 0000000..242e5ba --- /dev/null +++ b/rex.project/x86_64/components/stage2/m4.bash @@ -0,0 +1,216 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="m4" + +# the version of this application +VERSION="1.4.19" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build_temp" + "install_temp" + "all_temp" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD_TEMP=false +MODE_INSTALL_TEMP=false +MODE_ALL_TEMP=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build_temp) + MODE_BUILD_TEMP=true + shift 1 + ;; + --install_temp) + MODE_INSTALL_TEMP=true + shift 1 + ;; + --all_temp) + MODE_ALL_TEMP=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build_temp() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering build dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + # patches + #logprint "Applying patches..." + #patch -p1 < "${PATCHES_DIR}/m4-1.4.18_to_glibc-2.28_compat.patch" + #assert_zero $? + + #patch -p1 < "${PATCHES_DIR}/m4-1.4.18_to_glibc-2.28_compat2.patch" + #assert_zero $? + + logprint "Configuring ${APPNAME}..." + ./configure \ + --prefix=/usr \ + --host=${T_TRIPLET} \ + --build=$(build-aux/config.guess) + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + logprint "Build operation complete." +} + +mode_install_temp() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make DESTDIR=${T_SYSROOT} install + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 0 +} + +if [ "$MODE_ALL_TEMP" = "true" ]; then + MODE_STAGE=true + MODE_BUILD_TEMP=true + MODE_INSTALL_TEMP=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD_TEMP" != "true" ] && \ + [ "$MODE_INSTALL_TEMP" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD_TEMP" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build_temp + assert_zero $? +fi + +if [ "$MODE_INSTALL_TEMP" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install_temp + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage2/ncurses.bash b/rex.project/x86_64/components/stage2/ncurses.bash new file mode 100755 index 0000000..4edc566 --- /dev/null +++ b/rex.project/x86_64/components/stage2/ncurses.bash @@ -0,0 +1,260 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="ncurses" + +# the version of this application +VERSION="6.4" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build_temp" + "install_temp" + "all_temp" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD_TEMP=false +MODE_INSTALL_TEMP=false +MODE_ALL_TEMP=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build_temp) + MODE_BUILD_TEMP=true + shift 1 + ;; + --install_temp) + MODE_INSTALL_TEMP=true + shift 1 + ;; + --all_temp) + MODE_ALL_TEMP=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build_temp() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering stage dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + # patches + logprint "Applying patches..." + patch -p1 < "${PATCHES_DIR}/ncurses-6.4_ensure-gawk-over-mawk.patch" + assert_zero $? + + logprint "Entering temporary build subdirectory..." + mkdir -p build + pushd build + assert_zero $? + + logprint "Building the tic progam..." + ../configure + assert_zero $? + + logprint "Building includes..." + make -C include + assert_zero $? + + logprint "Building tic" + make -C progs tic + assert_zero $? + + logprint "Exiting temp build subdir" + popd + assert_zero $? + + logprint "Configuring ${APPNAME}..." + ./configure \ + --prefix=/usr \ + --host=${T_TRIPLET} \ + --build=$(./config.guess) \ + --mandir=/usr/share/man \ + --with-manpage-format=normal \ + --with-shared \ + --without-normal \ + --with-cxx-shared \ + --without-debug \ + --without-ada \ + --disable-stripping \ + --enable-widec + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + logprint "Build operation complete." +} + +mode_install_temp() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make DESTDIR=${T_SYSROOT} TIC_PATH=$(pwd)/build/progs/tic install + assert_zero $? + + logprint "HACK: INPUT(-lncursesw)" + echo "INPUT(-lncursesw)" > ${T_SYSROOT}/usr/lib/libncurses.so + assert_zero $? + + # from SURRO + #logprint "Cleaning up installation..." + #logprint "Moving ncursesw shared objects from /usr/lib to /lib in T_SYSROOT." + #mv -v ${T_SYSROOT}/usr/lib/libncursesw.so.6* ${T_SYSROOT}/lib + #assert_zero $? + + # from SURRO + #logprint "Cleaning up symlinks broken by previous." + #ln -sfv ../../lib/$(readlink ${T_SYSROOT}/usr/lib/libncursesw.so) ${T_SYSROOT}/usr/lib/libncursesw.so + #assert_zero $? + + + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 0 +} + +if [ "$MODE_ALL_TEMP" = "true" ]; then + MODE_STAGE=true + MODE_BUILD_TEMP=true + MODE_INSTALL_TEMP=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD_TEMP" != "true" ] && \ + [ "$MODE_INSTALL_TEMP" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD_TEMP" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build_temp + assert_zero $? +fi + +if [ "$MODE_INSTALL_TEMP" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install_temp + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage2/welcome.bash b/rex.project/x86_64/components/stage2/welcome.bash new file mode 100755 index 0000000..f79b6cf --- /dev/null +++ b/rex.project/x86_64/components/stage2/welcome.bash @@ -0,0 +1,48 @@ +HORSE=$(cat <<'EOH' +⠀⠀⠀⠀⠀⠀⢀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠘⣦⡀⠘⣆⠈⠛⠻⣗⠶⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠈⣿⠀⠈⠳⠄⠀⠈⠙⠶⣍⡻⢿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⣰⣿⣧⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⡹⣿⣿⣷⣦⣄⣀⠀⠀⢀⣸⠃⠀⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⢠⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⢿⣿⣿⣿⣿⣿⣿⣿⠟⠀⢰⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⢀⣾⣿⠀⠀⠀⠀⠀⠀⠀⣷⠀⢷⠀⠀⠀⠙⢷⣿⣿⣿⣿⣟⣋⣀⣤⣴⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⢀⣼⢿⣿⡀⠀⠀⢀⣀⣴⣾⡟⠀⠈⣇⠀⠀⠀⠈⢻⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⣼⡏⠸⣿⣿⣶⣾⣿⡿⠟⠋⠀⠀⠀⢹⡆⠀⠀⠀⠀⠹⡽⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⣰⣿⠀⠀⠀⣀⡿⠛⠉⠀⠀⢿⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠑⢹⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⣿⣿⣷⣶⣾⠏⠀⠀⠀⠀⠀⠘⣇⠀⠀⠀⢻⡇⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⡿⠃⠀⣠⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠈⠙⠿⠿⠋⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⢸⣷⠀⠀⠀⠀⠀⢀⠀⠹⣿⣿⣿⣿⣷⣶⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⠀⠀⢸⣿⠀⠀⠀⠀⢀⡞⠀⠀⠈⠛⠻⠿⠿⠯⠥⠤⢄⣀⣀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠀⠀⠀⢸⡇⠀⠀⠀⢀⡼⠃⠀⠀⠀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠈⠙⠂⠙⠳⢤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠇⠀⠀⠀⡾⠁⠀⠀⣠⡿⠃⠀⠀⠀⠀⠀⠀⠸⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠀⠀⠀⡸⠃⠀⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⣶⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠇⠀⠀⠀⠃⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠏⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀ ⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⠙⠻⣿⣿⣿⣿⣿⣿⣦⡀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⢀⡖⢰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠀⠀⠀⢸⣿⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡇⠀⠀⣼⠁⠼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⣼⡇⠀⠀⣠⣾⣿⣿⣿⣿⠟⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠘⣇⠀⠀⢻⡄⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⡴⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠁⠀⠀⠀⢀⣼⠏⠀⣠⣾⣿⣿⡿⣿⡿⠁⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⠁⠀⠘⠂⠀⠀⢳⠀⢳⡀⠀⠀⠀⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣾⣿⠃⠀⠀⠀⠀⣠⣾⠃⣠⣾⣿⣿⠿⠋⢰⡟⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⢀⣀⡴⠞⠙⠲⣷⡄⠀⠀⠀⠀⢠⡾⠁⠀⠀⠀⢀⣀⣠⣤⣶⠿⠟⠋⠀⡾⠀⠀⠀⢀⣴⠟⠁⢠⡟⢱⡿⠃⠀⠀⠸⣇⡀⠀⠀⠀ +⠀⠀⠀⠀⠀⢀⡴⠟⠁⠀⣀⡤⠖⠋⠁⠀⠀⠀⠀⣸⠇⠀⠀⠀⣤⠟⠑⠋⠉⣿⠋⠉⠉⠉⠁⣠⠞⠀⠀⠀⡇⠀⠀⢠⡿⠋⠀⠀⠈⠁⡿⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀ +⠀⠀⠀⢀⣾⣏⣤⣶⡾⠛⠉⠀⠀⠀⠀⠀⠀⢀⡼⠃⠀⠀⣠⠞⠁⠀⠀⠀⠀⣿⠀⠀⠀⢀⡼⠃⠀⠀⠀⢸⠇⠀⣰⠟⠀⠀⠀⠀⠀⠐⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⢀⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣴⠏⠀⠀⣠⠞⠁⠀⠀⠀⠀⠀⠀⣿⠀⠀⢀⡾⠃⠀⠀⠀⢀⡞⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⣼⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣶⣶⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⣾⠇⠀⠀⠀⢀⣾⣣⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⢠⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⢠⡟⠀⠀⠀⢀⣾⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡄⢀⣀⡀⠀⠀⠀⠀⠀⠀⢸⡇⠀⣾⠇⠀⠀⣰⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⣾⠀⣰⠟⠀⢀⣼⣿⣿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢸⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠿⠿⠿⠃⠀⠀⠀⢸⣿⣶⠏⢀⣴⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢸⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⠃⢠⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⢃⣴⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠈⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣧⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⡟⢸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⠁⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +EOH +) + +echo +echo +echo -e "\e[31m$HORSE\e[0m" +echo +echo "Welcome to Pyrois, the build system for Dark Horse Linux." +echo +echo "Stage 2, Temporary Toolchains" +echo diff --git a/rex.project/x86_64/environments/stage2.env.bash b/rex.project/x86_64/environments/stage2.env.bash new file mode 100755 index 0000000..77aaaee --- /dev/null +++ b/rex.project/x86_64/environments/stage2.env.bash @@ -0,0 +1,71 @@ +set -a + +source ./project_config.sh + +TERM=xterm-256color +COLORTERM=truecolor +LC_ALL=C + +function echofail() { + echo + echo "FAILED: $1" + echo + exit 1 +} + +# keeps talking about T_SYSROOT as $LFS +# wants $LFS path to be a mount +# needs to be set for any user including root + +#2.6 +# sourced from project_config +T_SYSROOT=${dir_sysroot} +LFS=${T_SYSROOT} + +# 4.3 we skip user and group creation, it's expected to be done before +# you start if you want a different user than you're running as +# == after that, configure the rex unit for dir creation to use that user + +if [ "$(id -u)" -ne 0 ]; then + echo "Not running as root." +fi + +# 4.4 + +# The set +h command turns off bash's hash function, which affects caching of paths for executables +set +h + +# ensures newly created files and directories are only writable by their owner, but are readable and executable by anyone +umask 022 + +# sets a comptabile machine name description for use when building crosstools that isn't going to be what the host system is using +# $LFS_TGT is what LFS uses for this +T_TRIPLET=x86_64-dhl-linux-gnu + + +# prevents some configure scripts from looking in the wrong place for config.site +CONFIG_SITE=${T_SYSROOT}/usr/share/config.site + +# 4.5 +MAKEFLAGS="-j$(nproc)" + +# where the cross-compiler gets installed ($LFS/tools) +CROSSTOOLS_DIR=${T_SYSROOT}/xtools +TEMP_STAGE_DIR=${T_SYSROOT}/source_stage +# from project_config +SOURCES_DIR=${dir_sources} +PATCHES_DIR=${dir_patches} +LOGS_ROOT=${dir_logs} + +# fail the unit in the event of a non-zero value passed +# used primarily to check exit codes on previous commands +# also a great convenient place to add in a "press any key to continue" +assert_zero() { + if [[ "$1" -eq 0 ]]; then + return + else + exit $1 + fi +} + +PATH=${CROSSTOOLS_DIR}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin diff --git a/rex.project/x86_64/plans/stage1.plan b/rex.project/x86_64/plans/stage1.plan index 349ebc4..1c714db 100644 --- a/rex.project/x86_64/plans/stage1.plan +++ b/rex.project/x86_64/plans/stage1.plan @@ -27,14 +27,19 @@ "comment": "LFS 11.3-systemd-rc1 Ch. 5.3" }, { - "name": "linux api headers", + "name": "linux api headers pass 1", "dependencies": [ null ], - "comment": "LFS 11.3-systemd-rc1 Ch. 5.4.1" + "comment": "LFS 11.3-systemd-rc1 Ch. 5.4" }, { - "name": "glibc", + "name": "glibc pass 1", "dependencies": [ null ], "comment": "LFS 11.3-systemd-rc1 Ch. 5.5" + }, + { + "name": "libstdc++ pass 1", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 5.6" } ] } diff --git a/rex.project/x86_64/plans/stage2.plan b/rex.project/x86_64/plans/stage2.plan new file mode 100644 index 0000000..4d47d56 --- /dev/null +++ b/rex.project/x86_64/plans/stage2.plan @@ -0,0 +1,20 @@ +{ + "plan": + [ + { + "name": "welcome", + "dependencies": [ null ], + "comment": "greet the user" + }, + { + "name": "m4 pass 1", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 6.2 (temp tools)" + }, + { + "name": "ncurses pass 1", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 6.2 (temp tools)" + } + ] +} diff --git a/rex.project/x86_64/units/stage1.units b/rex.project/x86_64/units/stage1.units index 303927d..ceb652d 100644 --- a/rex.project/x86_64/units/stage1.units +++ b/rex.project/x86_64/units/stage1.units @@ -2,7 +2,7 @@ "units": [ { "name": "welcome", - "target": "components/welcome.bash", + "target": "components/stage1/welcome.bash", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, @@ -20,7 +20,7 @@ }, { "name": "check dependencies", - "target": "components/check_dependencies.bash", + "target": "components/stage1/check_dependencies.bash", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, @@ -38,7 +38,7 @@ }, { "name": "creating T_SYSROOT dirs", - "target": "components/create_sysroot_dirs.bash", + "target": "components/stage1/create_sysroot_dirs.bash", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, @@ -56,7 +56,7 @@ }, { "name": "binutils pass 1", - "target": "components/binutils.bash --pass1", + "target": "components/stage1/binutils.bash --pass1", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, @@ -74,7 +74,7 @@ }, { "name": "gcc pass 1", - "target": "components/gcc.bash --gcc_pass1", + "target": "components/stage1/gcc.bash --gcc_pass1", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, @@ -91,8 +91,8 @@ "environment": "environments/stage1.env.bash" }, { - "name": "linux api headers", - "target": "components/linux.bash --pass1", + "name": "linux api headers pass 1", + "target": "components/stage1/linux.bash --pass1", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, @@ -109,8 +109,26 @@ "environment": "environments/stage1.env.bash" }, { - "name": "glibc", - "target": "components/glibc.bash --pass1", + "name": "glibc pass 1", + "target": "components/stage1/glibc.bash --pass1", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "phanes", + "group": "phanes", + "supply_environment": true, + "environment": "environments/stage1.env.bash" + }, + { + "name": "libstdc++ pass 1", + "target": "components/stage1/gcc.bash --libstdcxx_pass1", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, diff --git a/rex.project/x86_64/units/stage2.units b/rex.project/x86_64/units/stage2.units new file mode 100644 index 0000000..273fad0 --- /dev/null +++ b/rex.project/x86_64/units/stage2.units @@ -0,0 +1,58 @@ +{ + "units": [ + { + "name": "welcome", + "target": "components/stage2/welcome.bash", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "phanes", + "group": "phanes", + "supply_environment": true, + "environment": "environments/stage2.env.bash" + }, + { + "name": "m4 pass 1", + "target": "components/stage2/m4.bash --all_temp", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "phanes", + "group": "phanes", + "supply_environment": true, + "environment": "environments/stage2.env.bash" + }, + { + "name": "ncurses pass 1", + "target": "components/stage2/ncurses.bash --all_temp", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "phanes", + "group": "phanes", + "supply_environment": true, + "environment": "environments/stage2.env.bash" + } + ] +}