limine/bootstrap

45 lines
1.7 KiB
Bash
Executable File

#! /bin/sh
set -ex
srcdir="$(dirname "$0")"
test -z "$srcdir" && srcdir=.
cd "$srcdir"
if [ -z "$BOOTSTRAP_NO_SHALLOW_CLONES" ]; then
SHALLOW_CLONE_FLAG="--depth=1"
fi
[ -d common/flanterm ] || git clone https://github.com/mintsuki/flanterm.git common/flanterm $SHALLOW_CLONE_FLAG
[ -f common/stb/stb_image.h ] || (
set -e
curl -Lo common/stb/stb_image.h https://github.com/nothings/stb/raw/master/stb_image.h
patch -p0 < common/stb_image.patch
rm -f common/stb/stb_image.h.orig
)
[ -d decompressor/tinf ] || (
set -e
mkdir -p decompressor/tinf
curl -Lo decompressor/tinf/tinf.h https://github.com/jibsen/tinf/raw/master/src/tinf.h
curl -Lo decompressor/tinf/tinflate.c https://github.com/jibsen/tinf/raw/master/src/tinflate.c
curl -Lo decompressor/tinf/tinfgzip.c https://github.com/jibsen/tinf/raw/master/src/tinfgzip.c
patch -p0 < decompressor/tinf.patch
)
[ -f freestanding-toolchain ] || ( curl -Lo freestanding-toolchain https://github.com/mintsuki/freestanding-toolchain/raw/trunk/freestanding-toolchain && chmod +x freestanding-toolchain )
[ -d freestanding-headers ] || git clone https://github.com/mintsuki/freestanding-headers.git $SHALLOW_CLONE_FLAG
[ -d limine-efi ] || git clone https://github.com/limine-bootloader/limine-efi.git $SHALLOW_CLONE_FLAG
[ -d libgcc-binaries ] || git clone https://github.com/mintsuki/libgcc-binaries.git $SHALLOW_CLONE_FLAG
autoreconf -fvi -Wall
# Older versions of autoreconf have a bug where they do not
# install auxiliary files, sometimes... Check if that is the
# case and work around...
for auxfile in config.guess config.sub install-sh; do
if ! [ -f build-aux/$auxfile ]; then
mkdir -p build-aux
cp -v "$(automake --print-libdir)/$auxfile" build-aux/
fi
done