ladybird/Toolchain/BuildQemu.sh
Emanuel Sprung 3042c942d8 Toolchain: Add QEMU build script and improve documentation
Added a script to build QEMU from source as part of the Toolchain.
The script content could be in BuildIt.sh but has been put in
a seperate file to make the build optional.

Added PATH=$PATH to sudo calls to hand over the Toolchain's PATH
setup by UseIt.sh. This enabled the script's to use the QEMU
contained in the SerenityOS toolchain.

Deleted old documentation in Meta and replaced it by a new
documentation in the Toolchain folder.
2019-11-11 21:29:56 +01:00

67 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
# This file will need to be run in bash, for now.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "$DIR"
TARGET=i686-pc-serenity
PREFIX="$DIR/Local"
SYSROOT="$DIR/../Root"
QEMU300_MD5SUM="6a5c8df583406ea24ef25b239c3243e0"
QEMU410_MD5SUM="cdf2b5ca52b9abac9bacb5842fa420f8"
QEMU_VERSION="qemu-4.1.0"
QEMU_MD5SUM="${QEMU410_MD5SUM}"
echo PREFIX is "$PREFIX"
echo SYSROOT is "$SYSROOT"
mkdir -p "$DIR/Tarballs"
source "$DIR/UseIt.sh"
pushd "$DIR/Tarballs"
md5="$(md5sum $QEMU_VERSION.tar.xz | cut -f1 -d' ')"
echo "qemu md5='$md5'"
if [ ! -e "$QEMU_VERSION.tar.xz" ] || [ "$md5" != "$QEMU_MD5SUM" ] ; then
rm -f qemu-3.0.0.tar.xz
curl -O "https://download.qemu.org/$QEMU_VERSION.tar.xz"
if [ "$md5" != "$QEMU_MD5SUM" ] ; then
echo "qemu md5 sum mismatching, please run script again."
exit 1
fi
else
echo "Skipped downloading $QEMU_VERSION"
fi
if [ ! -d "$QEMU_VERSION" ]; then
echo "Extracting qemu..."
tar -xf "$QEMU_VERSION.tar.xz"
else
echo "Skipped extracting qemu"
fi
popd
mkdir -p "$PREFIX"
mkdir -p "$DIR/Build/qemu"
if [ -z "$MAKEJOBS" ]; then
MAKEJOBS=$(nproc)
fi
pushd "$DIR/Build/"
pushd qemu
"$DIR"/Tarballs/$QEMU_VERSION/configure --prefix="$PREFIX" \
--target-list=i386-softmmu \
--enable-gtk || exit 1
make -j "$MAKEJOBS" || exit 1
make install || exit 1
popd
popd