فهرست منبع

Toolchain+Ports: Consolidate version information for QEMU

This consolidates version information, archive's download location,
filename and SHA256 checksum into version.sh. This file is then sourced
from the port script and toolchain build script.

The version.sh script contains the following variables:
- QEMU_VERSION           - Version number
- QEMU_ARCHIVE           - Filename
- QEMU_ARCHIVE_URL       - Full url to download location
- QEMU_ARCHIVE_SHA256SUM - The SHA256 checksum
Kenneth Myhra 2 سال پیش
والد
کامیت
1cc095c5ab
3فایلهای تغییر یافته به همراه21 افزوده شده و 16 حذف شده
  1. 5 2
      Ports/qemu/package.sh
  2. 4 0
      Ports/qemu/version.sh
  3. 12 14
      Toolchain/BuildQemu.sh

+ 5 - 2
Ports/qemu/package.sh

@@ -1,6 +1,9 @@
 #!/usr/bin/env -S bash ../.port_include.sh
 #!/usr/bin/env -S bash ../.port_include.sh
+
+source version.sh
+
 port='qemu'
 port='qemu'
-version='7.2.0'
+version="${QEMU_VERSION}"
 useconfigure='true'
 useconfigure='true'
 configopts=(
 configopts=(
     '--target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu'
     '--target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu'
@@ -20,8 +23,8 @@ depends=(
   'pixman'
   'pixman'
   'SDL2'
   'SDL2'
 )
 )
-files="https://download.qemu.org/qemu-${version}.tar.xz qemu-${version}.tar.xz 5b49ce2687744dad494ae90a898c52204a3406e84d072482a1e1be854eeb2157"
 auth_type='sha256'
 auth_type='sha256'
+files="${QEMU_ARCHIVE_URL} ${QEMU_ARCHIVE} ${QEMU_ARCHIVE_SHA256SUM}"
 
 
 pre_patch() {
 pre_patch() {
     # Disable tests (those need way more stuff than QEMU itself) by clearing the respective meson file.
     # Disable tests (those need way more stuff than QEMU itself) by clearing the respective meson file.

+ 4 - 0
Ports/qemu/version.sh

@@ -0,0 +1,4 @@
+QEMU_VERSION="7.2.0"
+QEMU_ARCHIVE="qemu-${QEMU_VERSION}.tar.xz"
+QEMU_ARCHIVE_URL="https://download.qemu.org/${QEMU_ARCHIVE}"
+QEMU_ARCHIVE_SHA256SUM="5b49ce2687744dad494ae90a898c52204a3406e84d072482a1e1be854eeb2157"

+ 12 - 14
Toolchain/BuildQemu.sh

@@ -11,8 +11,8 @@ PREFIX="$DIR/Local/qemu"
 BUILD=$(realpath "$DIR/../Build")
 BUILD=$(realpath "$DIR/../Build")
 SYSROOT="$BUILD/Root"
 SYSROOT="$BUILD/Root"
 
 
-QEMU_VERSION=${QEMU_VERSION:="qemu-7.1.0"}
-QEMU_MD5SUM=${QEMU_MD5SUM:="3be5458a9171b4ec5220c65d5d52bdcf"}
+# shellcheck source=/dev/null
+source "${DIR}/../Ports/qemu/version.sh"
 
 
 echo PREFIX is "$PREFIX"
 echo PREFIX is "$PREFIX"
 echo SYSROOT is "$SYSROOT"
 echo SYSROOT is "$SYSROOT"
@@ -20,24 +20,21 @@ echo SYSROOT is "$SYSROOT"
 mkdir -p "$DIR/Tarballs"
 mkdir -p "$DIR/Tarballs"
 
 
 pushd "$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"
+    if [ ! -e "${QEMU_ARCHIVE}" ]; then
+        curl -C - -O "${QEMU_ARCHIVE_URL}"
     else
     else
-        echo "Skipped downloading $QEMU_VERSION"
+        echo "Skipped downloading ${QEMU_ARCHIVE}"
     fi
     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
+    if ! sha256sum --status -c <(echo "${QEMU_ARCHIVE_SHA256SUM}" "${QEMU_ARCHIVE}"); then
+        echo "qemu sha256 sum mismatching, please run script again."
+        rm -f "${QEMU_ARCHIVE}"
         exit 1
         exit 1
     fi
     fi
 
 
     if [ ! -d "$QEMU_VERSION" ]; then
     if [ ! -d "$QEMU_VERSION" ]; then
         echo "Extracting qemu..."
         echo "Extracting qemu..."
-        tar -xf "$QEMU_VERSION.tar.xz"
+        tar -xf "${QEMU_ARCHIVE}"
     else
     else
         echo "Skipped extracting qemu"
         echo "Skipped extracting qemu"
     fi
     fi
@@ -61,9 +58,10 @@ fi
 echo Using $UI_LIB based UI
 echo Using $UI_LIB based UI
 
 
 pushd "$DIR/Build/qemu"
 pushd "$DIR/Build/qemu"
-    "$DIR"/Tarballs/$QEMU_VERSION/configure --prefix="$PREFIX" \
+    "$DIR"/Tarballs/qemu-"${QEMU_VERSION}"/configure --prefix="$PREFIX" \
                                             --target-list=aarch64-softmmu,x86_64-softmmu \
                                             --target-list=aarch64-softmmu,x86_64-softmmu \
-                                            --enable-$UI_LIB || exit 1
+                                            --enable-$UI_LIB \
+                                            --enable-slirp || exit 1
     make -j "$MAKEJOBS" || exit 1
     make -j "$MAKEJOBS" || exit 1
     make install || exit 1
     make install || exit 1
 popd
 popd