serenity/Toolchain/BuildQemu.sh
Kenneth Myhra e152a28737 Toolchain: Update BuildQemu.sh to qemu-7.1
QEMU 7.1 was released on August 30th.
Release Notes: https://wiki.qemu.org/ChangeLog/7.1

The patch 'Toolchain/Patches/qemu-cf-protection-none.patch' (or similar)
has been upstreamed so it can be safely removed.
2022-10-27 13:29:40 +02:00

69 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
# This file will need to be run in bash, for now.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "$DIR"
PREFIX="$DIR/Local/qemu"
BUILD=$(realpath "$DIR/../Build")
SYSROOT="$BUILD/Root"
QEMU_VERSION=${QEMU_VERSION:="qemu-7.1.0"}
QEMU_MD5SUM=${QEMU_MD5SUM:="3be5458a9171b4ec5220c65d5d52bdcf"}
echo PREFIX is "$PREFIX"
echo SYSROOT is "$SYSROOT"
mkdir -p "$DIR/Tarballs"
pushd "$DIR/Tarballs"
md5="$(md5sum $QEMU_VERSION.tar.xz | cut -f1 -d' ')"
if [ ! -e "$QEMU_VERSION.tar.xz" ] || [ "$md5" != "$QEMU_MD5SUM" ]; then
curl -C - -O "https://download.qemu.org/$QEMU_VERSION.tar.xz"
else
echo "Skipped downloading $QEMU_VERSION"
fi
md5="$(md5sum $QEMU_VERSION.tar.xz | cut -f1 -d' ')"
echo "qemu md5='$md5'"
if [ "$md5" != "$QEMU_MD5SUM" ] ; then
echo "qemu md5 sum mismatching, please run script again."
rm -f $QEMU_VERSION.tar.xz
exit 1
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
if [[ $(uname) == "Darwin" ]]
then
UI_LIB=cocoa
else
UI_LIB=gtk
fi
echo Using $UI_LIB based UI
pushd "$DIR/Build/qemu"
"$DIR"/Tarballs/$QEMU_VERSION/configure --prefix="$PREFIX" \
--target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu \
--enable-$UI_LIB || exit 1
make -j "$MAKEJOBS" || exit 1
make install || exit 1
popd