limine/bootstrap

103 lines
3.4 KiB
Bash
Executable File

#! /bin/sh
set -ex
srcdir="$(dirname "$0")"
test -z "$srcdir" && srcdir=.
cd "$srcdir"
STB_COMMIT_HASH=f4a71b13373436a2866c5d68f8f80ac6f0bc1ffe
STB_IMAGE_H_HASH=9053a86ea3fab378ad42c740bbc5003c7c2038a466da1446e1d9b943178d131c9add2d41fca23149cc55381a94ba32c4d29f5ce09d80e19809e067bac2ee7b92
FREESTANDING_TOOLCHAIN_COMMIT_HASH=2ab7a489652291d430a7b693430c97ea9cb7bcbf
FREESTANDING_TOOLCHAIN_HASH=558c0a1f4e10aeb32e1331e0139a571cde648fe281b85a2163e1f4b5fe639cec1ba87906d24dcfe52b62540290beac71a2ba3e3c20686933c969b60f122826a5
FLANTERM_COMMIT_HASH=545ab1faa8ba7493ae7a43064d520e402ad308b5
FREESTANDING_HEADERS_COMMIT_HASH=dd3abd2d7147efc4170dff478d3b7730bed14147
LIBGCC_BINARIES_COMMIT_HASH=7e1775311640070f3157a332c6ad5bce1c47ad56
LIMINE_EFI_COMMIT_HASH=c7d42cae902fc7e3f0b20b428186e8d9b1e9f5b5
TINF_COMMIT_HASH=57ffa1f1d5e3dde19011b2127bd26d01689b694b
clone_repo_commit() {
[ -d $2 ] && (
set -e
if [ -f $2/.git ]; then
git -C $2 checkout $3 || (
set -e
rm -rf $2
)
fi
)
[ -d $2 ] || (
set -e
git clone $1 $2
git -C $2 checkout $3
)
}
clone_repo_commit https://github.com/mintsuki/flanterm.git common/flanterm $FLANTERM_COMMIT_HASH
clone_repo_commit https://github.com/mintsuki/freestanding-headers.git freestanding-headers $FREESTANDING_HEADERS_COMMIT_HASH
clone_repo_commit https://github.com/mintsuki/libgcc-binaries.git libgcc-binaries $LIBGCC_BINARIES_COMMIT_HASH
clone_repo_commit https://github.com/limine-bootloader/limine-efi.git limine-efi $LIMINE_EFI_COMMIT_HASH
clone_repo_commit https://github.com/jibsen/tinf.git tinf $TINF_COMMIT_HASH
########################################################
########################################################
[ -f common/stb/stb_image.h ] && (
set -e
b2sum common/stb/stb_image.h | grep $STB_IMAGE_H_HASH >/dev/null 2>&1 || (
set -e
rm -f common/stb/stb_image.h
)
)
[ -f common/stb/stb_image.h ] || (
set -e
curl -Lo common/stb/stb_image.h https://github.com/nothings/stb/raw/$STB_COMMIT_HASH/stb_image.h
patch -p0 < common/stb_image.patch
rm -f common/stb/stb_image.h.orig
)
########################################################
########################################################
mkdir -p decompressor/tinf
cp tinf/src/tinf.h tinf/src/tinflate.c tinf/src/tinfgzip.c decompressor/tinf/
patch -p0 < decompressor/tinf.patch
########################################################
########################################################
[ -f freestanding-toolchain ] && (
set -e
b2sum freestanding-toolchain | grep $FREESTANDING_TOOLCHAIN_HASH >/dev/null 2>&1 || (
set -e
rm -f freestanding-toolchain
)
)
[ -f freestanding-toolchain ] || (
set -e
curl -Lo freestanding-toolchain https://github.com/mintsuki/freestanding-toolchain/raw/$FREESTANDING_TOOLCHAIN_COMMIT_HASH/freestanding-toolchain
chmod +x freestanding-toolchain
)
########################################################
########################################################
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