emulators/86Box: add helper script to allow user to easily download ROMs

To run 86Box, users need to install the necessary ROMs. This commit
provides a helper script called 86Box-install-roms.sh that automates
this process.

PR:	280664
This commit is contained in:
gatekeeper
2024-08-07 03:12:33 +03:00
committed by Vladimir Druzenko
parent 3b5336de74
commit d2c76bc40a
4 changed files with 87 additions and 1 deletions
+8 -1
View File
@@ -1,6 +1,7 @@
PORTNAME= 86Box
DISTVERSIONPREFIX= v
DISTVERSION= 4.2
PORTREVISION= 1
CATEGORIES= emulators
MAINTAINER= tiago.gasiba@gmail.com
@@ -36,7 +37,8 @@ USE_XORG= x11 xcb xext xi
.if ${FLAVOR} == qt5
USES+= qt:5
USE_QT= core gui network opengl widgets buildtools:build linguisttools:build
USE_QT= core gui network opengl widgets buildtools:build \
linguisttools:build
.else
BUILD_DEPENDS+= vulkan-headers>0:graphics/vulkan-headers
USES+= gl qt:6
@@ -46,6 +48,10 @@ CMAKE_ON= USE_QT6
CXXFLAGS+= -I${LOCALBASE}/include/qt6/QtGui/`pkg-config --modversion Qt6Gui`/QtGui
.endif
SUB_FILES= 86Box-install-roms.sh
SUB_LIST= DISTVERSION=${DISTVERSION} \
DISTVERSIONPREFIX=${DISTVERSIONPREFIX}
OPTIONS_DEFINE= NLS WAYLAND
OPTIONS_DEFAULT= WAYLAND
@@ -61,6 +67,7 @@ ICON_RESOLUTIONS= 128x128 192x192 256x256 48x48 512x512 64x64 72x72 96x96
do-install:
${INSTALL_PROGRAM} ${WRKDIR}/.build/src/86Box ${STAGEDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKDIR}/86Box-install-roms.sh ${STAGEDIR}${PREFIX}/bin
${REINPLACE_CMD} -e 's|Exec=86Box|Exec=/bin/sh -c "${PREFIX}/bin/86Box -C $${HOME}/86box.cfg"|' \
${WRKSRC}/src/unix/assets/net.86box.86Box.desktop
${INSTALL_DATA} ${WRKSRC}/src/unix/assets/net.86box.86Box.desktop \
@@ -0,0 +1,69 @@
#!/bin/sh
URL="https://github.com/86Box/roms/archive/refs/tags/%%DISTVERSIONPREFIX%%%%DISTVERSION%%.zip"
DEFAULT_TARGET_DIR="$HOME/.local/share/86Box/"
TARGET_DIR=${TARGET_DIR:-$DEFAULT_TARGET_DIR}
install_roms() {
if [ -d "$TARGET_DIR" ] && [ "$(ls -A $TARGET_DIR)" ]; then
echo "ROMs already installed in $TARGET_DIR"
echo "To (re)install, please first remove ROMs with -r parameter"
exit 1
fi
TMP_DIR=$(mktemp -d)
TMP_FILE="$TMP_DIR/86Box-ROMs.zip"
echo "Fetching ROMs..."
fetch -qo "$TMP_FILE" "$URL"
if [ $? -ne 0 ]; then
echo "Failed to download the file from $URL"
exit 1
fi
echo "Extracting ROMs..."
mkdir -p "$TARGET_DIR"
unzip -q "$TMP_FILE" -d "$TARGET_DIR"
if [ $? -ne 0 ]; then
echo "Failed to decompress the file"
rm "$TMP_FILE"
exit 1
fi
mv "$TARGET_DIR/roms-"* "$TARGET_DIR/roms"
rm -rf "$TMP_DIR"
echo "ROMs installed successfully in $TARGET_DIR"
}
remove_roms() {
if [ -d "$TARGET_DIR/roms" ]; then
rm -rf "$TARGET_DIR/roms"
echo "ROMs removed successfully from $TARGET_DIR"
else
echo "No ROMs directory found in $TARGET_DIR"
fi
}
help() {
echo ""
echo "$0 [-h|-i|-r]"
echo " -h : this help"
echo " -i : install ROMs (this parameter can be omitted)"
echo " -r : remove the ROMs"
echo ""
}
case "$1" in
-h)
help
;;
-r)
remove_roms
;;
-i|*)
install_roms
;;
esac
exit 0
+9
View File
@@ -0,0 +1,9 @@
[
{ type: install
message: <<EOM
86Box requires you to manually install ROMS to be able to run.
To do this, you can type in the following command:
86Box-install-roms.sh -i
EOM
}
]
+1
View File
@@ -1,4 +1,5 @@
bin/86Box
bin/86Box-install-roms.sh
share/applications/net.86box.86Box.desktop
share/icons/hicolor/128x128/apps/net.86box.86Box.png
share/icons/hicolor/192x192/apps/net.86box.86Box.png