diff options
Diffstat (limited to 'create.sh')
-rwxr-xr-x | create.sh | 60 |
1 files changed, 33 insertions, 27 deletions
@@ -18,9 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -set -euo pipefail - -# target options +# target platform export CARCH=riscv64 export CHOST=riscv64-unknown-linux-gnu export LINUX_ARCH=riscv @@ -30,37 +28,45 @@ export GCC_MABI=lp64d #export GCC32_MARCH=rv32gc #export GCC32_MABI=ilp32d #export CARCH32=riscv32 -#export CHOST32=riscv32-linux-gnu -export REGEN_CONFIG_FRAGMENTS=yes +#export CHOST32=riscv32-pc-linux-gnu # common directories -export startdir="$(pwd)" -export topbuilddir="$startdir"/build -export topsrcdir="$startdir"/src +startdir="$(pwd)" +export TOPBUILDDIR="$startdir"/build +export TOPSRCDIR="$startdir"/src +export SRCDEST="$TOPBUILDDIR"/sources +mkdir -p "$TOPBUILDDIR" "$SRCDEST" +chown "$SUDO_USER" "$TOPBUILDDIR" # options export KEEP_GOING=${KEEP_GOING:-no} +export REGEN_CONFIG_FRAGMENTS=${REGEN_CONFIG_FRAGMENTS:-yes} -. "$topsrcdir"/shared/feedback.sh -. "$topsrcdir"/shared/common.sh - -[ $(id -u) -ne 0 ] && die "must be root" -[ -z "${SUDO_USER:-}" ] && die "SUDO_USER must be set in environment" - -mkdir -p "$topbuilddir" -chown $SUDO_USER "$topbuilddir" - -# Stage 1: prepare cross toolchain -. "$topsrcdir"/stage1/stage1.sh +# shellcheck source=src/shared/common.sh +. "$TOPSRCDIR"/shared/common.sh -# Stage 2: cross-compile base-devel -. "$topsrcdir"/stage2/stage2.sh +# sanity checks +if [ "$(id -u)" -ne 0 ]; then + die -e "$ERROR_INVOCATION" "must be root" +fi +if [ -z "${SUDO_USER:-}" ]; then + die -e "$ERROR_INVOCATION" "SUDO_USER must be set in environment" +fi -# Stage 3: libremakepkg native base-devel -. "$topsrcdir"/stage3/stage3.sh +# import stages +# shellcheck source=src/stage1/stage1.sh +. "$TOPSRCDIR"/stage1/stage1.sh +# shellcheck source=src/stage2/stage2.sh +. "$TOPSRCDIR"/stage2/stage2.sh +# shellcheck source=src/stage3/stage3.sh +. "$TOPSRCDIR"/stage3/stage3.sh +# shellcheck source=src/stage4/stage4.sh +#. "$TOPSRCDIR"/stage4/stage4.sh -# Stage 4: libremakepkg full native base & base-devel -. "$topsrcdir"/stage4/stage4.sh +# run stages +stage1 || die -e "$ERROR_BUILDFAIL" "Stage 1 failed. Exiting..." +stage2 || die -e "$ERROR_BUILDFAIL" "Stage 2 failed. Exiting..." +stage3 || die -e "$ERROR_BUILDFAIL" "Stage 3 failed. Exiting..." +#stage4 -msg "all done." -notify "*Bootstrap Finished*" +msg -n "all done." |