2019-11-11 12:58:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# This file will need to be run in bash, for now.
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
echo "$DIR"
|
|
|
|
|
2020-12-29 03:38:52 +00:00
|
|
|
ARCH=${ARCH:-"i686"}
|
|
|
|
TARGET="$ARCH-pc-serenity"
|
|
|
|
PREFIX="$DIR/Local/$ARCH"
|
|
|
|
BUILD=$(realpath "$DIR/../Build")
|
|
|
|
SYSROOT="$BUILD/Root"
|
2019-11-11 12:58:18 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
pushd "$DIR/Tarballs"
|
2020-01-24 18:59:45 +00:00
|
|
|
if [ ! -e "$QEMU_VERSION.tar.xz" ]; then
|
2019-11-11 12:58:18 +00:00
|
|
|
curl -O "https://download.qemu.org/$QEMU_VERSION.tar.xz"
|
|
|
|
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."
|
|
|
|
rm $$QEMU_VERSION.tar.xz
|
|
|
|
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
|
|
|
|
popd
|
|
|
|
|
|
|
|
mkdir -p "$PREFIX"
|
2020-12-29 03:38:52 +00:00
|
|
|
mkdir -p "$DIR/Build/$ARCH/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
|
|
|
|
|
2020-12-29 03:38:52 +00:00
|
|
|
pushd "$DIR/Build/$ARCH"
|
2019-11-11 12:58:18 +00:00
|
|
|
pushd qemu
|
|
|
|
"$DIR"/Tarballs/$QEMU_VERSION/configure --prefix="$PREFIX" \
|
|
|
|
--target-list=i386-softmmu \
|
2020-04-06 23:55:25 +00:00
|
|
|
--enable-$UI_LIB || exit 1
|
2019-11-11 12:58:18 +00:00
|
|
|
make -j "$MAKEJOBS" || exit 1
|
|
|
|
make install || exit 1
|
|
|
|
popd
|
|
|
|
popd
|