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
|
|
|
|
2023-04-15 21:14:11 +00:00
|
|
|
# shellcheck source=/dev/null
|
|
|
|
source "${DIR}/../Ports/qemu/version.sh"
|
2019-11-11 12:58:18 +00:00
|
|
|
|
|
|
|
echo PREFIX is "$PREFIX"
|
|
|
|
echo SYSROOT is "$SYSROOT"
|
|
|
|
|
|
|
|
mkdir -p "$DIR/Tarballs"
|
|
|
|
|
|
|
|
pushd "$DIR/Tarballs"
|
2023-04-15 21:14:11 +00:00
|
|
|
if [ ! -e "${QEMU_ARCHIVE}" ]; then
|
|
|
|
curl -C - -O "${QEMU_ARCHIVE_URL}"
|
2019-11-11 12:58:18 +00:00
|
|
|
else
|
2023-04-15 21:14:11 +00:00
|
|
|
echo "Skipped downloading ${QEMU_ARCHIVE}"
|
2019-11-11 12:58:18 +00:00
|
|
|
fi
|
|
|
|
|
2023-04-15 21:14:11 +00:00
|
|
|
if ! sha256sum --status -c <(echo "${QEMU_ARCHIVE_SHA256SUM}" "${QEMU_ARCHIVE}"); then
|
|
|
|
echo "qemu sha256 sum mismatching, please run script again."
|
|
|
|
rm -f "${QEMU_ARCHIVE}"
|
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..."
|
2023-04-15 21:14:11 +00:00
|
|
|
tar -xf "${QEMU_ARCHIVE}"
|
2019-11-11 12:58:18 +00:00
|
|
|
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"
|
2023-04-15 21:14:11 +00:00
|
|
|
"$DIR"/Tarballs/qemu-"${QEMU_VERSION}"/configure --prefix="$PREFIX" \
|
2023-04-08 20:04:11 +00:00
|
|
|
--target-list=aarch64-softmmu,x86_64-softmmu \
|
2023-04-15 21:14:11 +00:00
|
|
|
--enable-$UI_LIB \
|
|
|
|
--enable-slirp || exit 1
|
2021-07-03 08:43:13 +00:00
|
|
|
make -j "$MAKEJOBS" || exit 1
|
|
|
|
make install || exit 1
|
2019-11-11 12:58:18 +00:00
|
|
|
popd
|