summaryrefslogtreecommitdiff
path: root/src/tools/bootstrap
blob: 66664fa970771a185aa7687f7d9f13d8699b5b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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