summaryrefslogtreecommitdiff
path: root/create.sh
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2018-03-29 23:33:02 +0200
committerAndreas Grapentin <andreas@grapentin.org>2018-03-29 23:33:02 +0200
commitc1fced40c2f37f844eb810216eb0a1da1a436aa8 (patch)
tree205d4971dd3e2498d8c78b42ff1320f3603957e5 /create.sh
parent0cdff36d43aea7dc5415e6a4d58d1e10c68e2965 (diff)
major restructure, builds ok up to end of stage2
Diffstat (limited to 'create.sh')
-rwxr-xr-xcreate.sh60
1 files changed, 33 insertions, 27 deletions
diff --git a/create.sh b/create.sh
index 8ab271a..92c7728 100755
--- a/create.sh
+++ b/create.sh
@@ -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."