summaryrefslogtreecommitdiff
path: root/src/tools/bootstrap
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-13 14:53:43 -0400
committerIan Moffett <ian@osmora.org>2025-09-13 14:53:43 -0400
commite698061ebaf0cf1a10c11c51a6c6cd46a331959c (patch)
tree19faff0de74be4661e55478ee7d31a8427c067c6 /src/tools/bootstrap
initial commit
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/tools/bootstrap')
-rwxr-xr-xsrc/tools/bootstrap61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tools/bootstrap b/src/tools/bootstrap
new file mode 100755
index 0000000..66664fa
--- /dev/null
+++ b/src/tools/bootstrap
@@ -0,0 +1,61 @@
+#!/bin/bash
+set -e
+
+SYSTEM_NAME="$(uname -s)"
+MAKE="make"
+GIT="git"
+GCC="gcc"
+CLANG="clang"
+
+if [ "$SYSTEM_NAME" = "OpenBSD" ]
+then
+ MAKE="$(which gmake)"
+fi
+
+# arg0: Output path.
+# arg1: Command for downloading
+try_fetch() {
+ if [[ -d $2 ]]
+ then
+ echo "try_fetch: Skipping $2: already exists"
+ else
+ ${@:1}
+ fi
+}
+
+fetch() {
+ mkdir -p cc/
+ try_fetch "git clone https://github.com/limine-bootloader/limine.git --branch=v9.3.0-binary --depth=1" "shim/limine"
+ try_fetch "git clone https://github.com/EthosZero/toolchain --depth=1" "cc/toolchain"
+}
+
+build_limine() {
+ $MAKE -C shim/limine/
+}
+
+build_omar() {
+ $MAKE -C tools/omar
+}
+
+build() {
+ build_limine
+ build_omar
+}
+
+echo "----------------------------------"
+echo
+echo " Fetching sources... "
+echo
+echo "----------------------------------"
+echo -e "\n"
+
+fetch # Fetch sources
+
+echo "----------------------------------"
+echo
+echo " Building sources... "
+echo
+echo "----------------------------------"
+echo -e "\n"
+
+build # Build sources