2021-01-22 16:44:05 +00:00
|
|
|
#!/usr/bin/env bash
|
2019-11-11 12:58:18 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# This file will need to be run in bash, for now.
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
echo "$DIR"
|
|
|
|
|
2021-07-03 08:43:13 +00:00
|
|
|
PREFIX="$DIR/Local/qemu"
|
2020-12-29 03:38:52 +00:00
|
|
|
BUILD=$(realpath "$DIR/../Build")
|
|
|
|
SYSROOT="$BUILD/Root"
|
2019-11-11 12:58:18 +00:00
|
|
|
|
2022-10-26 20:22:19 +00:00
|
|
|
QEMU_VERSION=${QEMU_VERSION:="qemu-7.1.0"}
|
|
|
|
QEMU_MD5SUM=${QEMU_MD5SUM:="3be5458a9171b4ec5220c65d5d52bdcf"}
|
2019-11-11 12:58:18 +00:00
|
|
|
|
|
|
|
echo PREFIX is "$PREFIX"
|
|
|
|
echo SYSROOT is "$SYSROOT"
|
|
|
|
|
|
|
|
mkdir -p "$DIR/Tarballs"
|
|
|
|
|
|
|
|
pushd "$DIR/Tarballs"
|
2022-04-26 10:09:49 +00:00
|
|
|
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"
|
2019-11-11 12:58:18 +00:00
|
|
|
else
|
|
|
|
echo "Skipped downloading $QEMU_VERSION"
|
|
|
|
fi
|
|
|
|
|
2020-01-24 18:59:45 +00:00
|
|
|
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."
|
2021-07-10 08:25:31 +00:00
|
|
|
rm -f $QEMU_VERSION.tar.xz
|
2020-01-24 18:59:45 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-11-11 12:58:18 +00:00
|
|
|
if [ ! -d "$QEMU_VERSION" ]; then
|
|
|
|
echo "Extracting qemu..."
|
|
|
|
tar -xf "$QEMU_VERSION.tar.xz"
|
|
|
|
else
|
|
|
|
echo "Skipped extracting qemu"
|
|
|
|
fi
|
2022-02-12 15:07:31 +00:00
|
|
|
|
2019-11-11 12:58:18 +00:00
|
|
|
popd
|
|
|
|
|
|
|
|
mkdir -p "$PREFIX"
|
2021-07-03 08:43:13 +00:00
|
|
|
mkdir -p "$DIR/Build/qemu"
|
2019-11-11 12:58:18 +00:00
|
|
|
|
|
|
|
if [ -z "$MAKEJOBS" ]; then
|
|
|
|
MAKEJOBS=$(nproc)
|
|
|
|
fi
|
|
|
|
|
2020-04-06 23:55:25 +00:00
|
|
|
if [[ $(uname) == "Darwin" ]]
|
|
|
|
then
|
|
|
|
UI_LIB=cocoa
|
|
|
|
else
|
|
|
|
UI_LIB=gtk
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo Using $UI_LIB based UI
|
|
|
|
|
2021-07-03 08:43:13 +00:00
|
|
|
pushd "$DIR/Build/qemu"
|
|
|
|
"$DIR"/Tarballs/$QEMU_VERSION/configure --prefix="$PREFIX" \
|
2021-08-28 16:56:14 +00:00
|
|
|
--target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu \
|
2021-07-03 08:43:13 +00:00
|
|
|
--enable-$UI_LIB || exit 1
|
|
|
|
make -j "$MAKEJOBS" || exit 1
|
|
|
|
make install || exit 1
|
2019-11-11 12:58:18 +00:00
|
|
|
popd
|