From 293df5363828470e6dce9ee32edb5c1e060e0968 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Fri, 18 Oct 2024 21:24:03 +0100 Subject: [PATCH 01/14] Update attractmode.sh --- scriptmodules/supplementary/attractmode.sh | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 88d89c2..784edac 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -131,13 +131,13 @@ function _add_rom_attractmode() { function depends_attractmode() { local depends=( + 'cmake' 'curl' 'ffmpeg' 'fontconfig' 'gnu-free-fonts' 'libarchive' 'p7zip' - 'sfml' ) isPlatform "kms" && depends+=( 'glu' @@ -145,7 +145,7 @@ function depends_attractmode() { 'libglvnd' 'mesa' ) - isPlatform "x11" && depends+=('libxinerama') + isPlatform "x11" && depends+=('libxinerama' 'sfml') getDepends "${depends[@]}" } @@ -154,14 +154,28 @@ function sources_attractmode() { # Set Default Config Path(s) sed -e "s|/.attract|/ArchyPie/configs/${md_id}|g" -i "${md_build}/src/fe_settings.cpp" + + isPlatform "kms" && gitPullOrClone "${md_build}/sfml-pi" "https://github.com/mickelson/sfml-pi" } function build_attractmode() { - local params=('USE_SYSTEM_SFML=1') + if isPlatform "kms"; then + local params=() + cd sfml-pi + params="-DSFML_DRM=1" + #isPlatform "rpi" && params+=('-DSFML_OPENGL_ES=1') + cmake . -DCMAKE_INSTALL_PREFIX="${md_inst}/sfml" ${params} + make clean + make + cd .. + fi + + cd attract + local params=() - isPlatform "kms" && params+=('USE_DRM=1') + isPlatform "kms" && params+=('USE_DRM=1' 'EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib') isPlatform "rpi" && params+=('USE_MMAL=1') - isPlatform "x11" && params+=('FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') + isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') make clean make prefix="${md_inst}" "${params[@]}" @@ -173,6 +187,7 @@ function build_attractmode() { } function install_attractmode() { + make -C sfml-pi install make prefix="${md_inst}" install } @@ -210,7 +225,7 @@ if [[ -z "\${DISPLAY}" && -f "\${MODELIST}" && ! "\${1}" =~ build-romlist ]]; th [[ ! -z "\${default_mode}" ]] && export SFML_DRM_MODE="\${default_mode}" [[ ! -z "\${default_vrefresh}" ]] && export SFML_DRM_REFRESH="\${default_vrefresh}" fi -"${md_inst}/bin/attract" "\${@}" +LD_LIBRARY_PATH="${md_inst}/sfml/lib "${md_inst}/bin/attract" "\${@}" _EOF_ chmod +x "/usr/bin/attract" From 548651e35b4537c1a170918e0bd41678703d707f Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Fri, 18 Oct 2024 21:57:15 +0100 Subject: [PATCH 02/14] Minor fix --- scriptmodules/supplementary/attractmode.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 784edac..458c7bd 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -170,9 +170,7 @@ function build_attractmode() { cd .. fi - cd attract local params=() - isPlatform "kms" && params+=('USE_DRM=1' 'EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib') isPlatform "rpi" && params+=('USE_MMAL=1') isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') From 6a909899c663322b7e9fb705b5b74f8d20c646f6 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Fri, 18 Oct 2024 22:21:14 +0100 Subject: [PATCH 03/14] Build with clang --- scriptmodules/supplementary/attractmode.sh | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 458c7bd..a4bf1f4 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -159,24 +159,37 @@ function sources_attractmode() { } function build_attractmode() { + # Build 'sfml-pi' if isPlatform "kms"; then + echo "*** Building SFML-Pi ***" + cd "${md_build}/sfml-pi" || exit local params=() - cd sfml-pi - params="-DSFML_DRM=1" #isPlatform "rpi" && params+=('-DSFML_OPENGL_ES=1') - cmake . -DCMAKE_INSTALL_PREFIX="${md_inst}/sfml" ${params} - make clean - make - cd .. + cmake . \ + -B"build" \ + -G"Ninja" \ + -DCMAKE_BUILD_RPATH_USE_ORIGIN="ON" \ + -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_C_COMPILER="clang" \ + -DCMAKE_CXX_COMPILER="clang++" \ + -DCMAKE_INSTALL_PREFIX="${md_build}/sfml" \ + -DCMAKE_LINKER_TYPE="LLD" \ + -DSFML_DRM="ON" \ + -Wno-dev + ninja -C build clean + ninja -C build install fi + # Build 'attract-mode' + echo "*** Building Attract-Mode ***" + cd "${md_build}" || exit local params=() isPlatform "kms" && params+=('USE_DRM=1' 'EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib') isPlatform "rpi" && params+=('USE_MMAL=1') isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') make clean - make prefix="${md_inst}" "${params[@]}" + CC="clang" CXX="clang++" LDFLAGS+=" -fuse-ld=lld" make prefix="${md_inst}" "${params[@]}" # Remove Example Configs rm -rf "${md_build}/config/emulators/"* From fb732f972e674dff1a9ffbba0e0e22903f87c6d4 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Sat, 19 Oct 2024 00:20:23 +0100 Subject: [PATCH 04/14] Fix error --- scriptmodules/supplementary/attractmode.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index a4bf1f4..8b3e39d 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -137,6 +137,7 @@ function depends_attractmode() { 'fontconfig' 'gnu-free-fonts' 'libarchive' + 'openal' 'p7zip' ) isPlatform "kms" && depends+=( @@ -170,26 +171,23 @@ function build_attractmode() { -G"Ninja" \ -DCMAKE_BUILD_RPATH_USE_ORIGIN="ON" \ -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_C_COMPILER="clang" \ - -DCMAKE_CXX_COMPILER="clang++" \ -DCMAKE_INSTALL_PREFIX="${md_build}/sfml" \ - -DCMAKE_LINKER_TYPE="LLD" \ -DSFML_DRM="ON" \ -Wno-dev ninja -C build clean - ninja -C build install + ninja -C build fi # Build 'attract-mode' echo "*** Building Attract-Mode ***" cd "${md_build}" || exit local params=() - isPlatform "kms" && params+=('USE_DRM=1' 'EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib') + isPlatform "kms" && params+=('USE_DRM=1' "EXTRA_CXXFLAGS=${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib") isPlatform "rpi" && params+=('USE_MMAL=1') isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') make clean - CC="clang" CXX="clang++" LDFLAGS+=" -fuse-ld=lld" make prefix="${md_inst}" "${params[@]}" + make prefix="${md_inst}" "${params[@]}" # Remove Example Configs rm -rf "${md_build}/config/emulators/"* From ba11913494199798af3bb4b17b570a7429fdf764 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Sat, 19 Oct 2024 19:22:18 +0100 Subject: [PATCH 05/14] Try to fix build --- scriptmodules/supplementary/attractmode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 8b3e39d..06755c2 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -182,7 +182,7 @@ function build_attractmode() { echo "*** Building Attract-Mode ***" cd "${md_build}" || exit local params=() - isPlatform "kms" && params+=('USE_DRM=1' "EXTRA_CXXFLAGS=${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib") + isPlatform "kms" && params+=('USE_DRM=1' EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib") isPlatform "rpi" && params+=('USE_MMAL=1') isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') From 97968804531112e0a94ead268b557b876f74bc37 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Sun, 10 Nov 2024 23:38:37 +0000 Subject: [PATCH 06/14] Use upstream sfml --- scriptmodules/supplementary/attractmode.sh | 58 +++++++++++++++------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 896ab25..4459766 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -129,6 +129,10 @@ function _add_rom_attractmode() { chown "${__user}":"${__group}" "${config}" } +function _get_branch_sfml_attractmode() { + download "https://api.github.com/repos/sfml/sfml/tags" - | grep -m 1 name | cut -d\" -f4 +} + function depends_attractmode() { local depends=( 'cmake' @@ -155,34 +159,47 @@ function sources_attractmode() { # Set Default Config Path(s) sed -e "s|/.attract|/ArchyPie/configs/${md_id}|g" -i "${md_build}/src/fe_settings.cpp" +} + +function _sources_sfml_attractmode() { + local tag + tag="$(_get_branch_sfml_attractmode)" - isPlatform "kms" && gitPullOrClone "${md_build}/sfml-pi" "https://github.com/mickelson/sfml-pi" + gitPullOrClone "${md_build}/sfml" "https://github.com/sfml/sfml" "${tag}" +} + +function _build_sfml_attractmode() { + local params=() + #isPlatform "rpi" && params+=('-DSFML_OPENGL_ES=1') + cmake . \ + -B"sfml" \ + -G"Ninja" \ + -S"sfml" \ + -DCMAKE_BUILD_RPATH_USE_ORIGIN="ON" \ + -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_C_COMPILER="clang" \ + -DCMAKE_CXX_COMPILER="clang++" \ + -DCMAKE_INSTALL_PREFIX="${md_build}/sfml" \ + -DCMAKE_LINKER_TYPE="LLD" \ + -DSFML_DRM="ON" \ + -Wno-dev + ninja -C build clean + ninja -C build + #md_ret_require="${md_build}/zmusic/source/libzmusic.so" } function build_attractmode() { - # Build 'sfml-pi' + # Build 'sfml' for the 'kms' platform if isPlatform "kms"; then - echo "*** Building SFML-Pi ***" - cd "${md_build}/sfml-pi" || exit - local params=() - #isPlatform "rpi" && params+=('-DSFML_OPENGL_ES=1') - cmake . \ - -B"build" \ - -G"Ninja" \ - -DCMAKE_BUILD_RPATH_USE_ORIGIN="ON" \ - -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_INSTALL_PREFIX="${md_build}/sfml" \ - -DSFML_DRM="ON" \ - -Wno-dev - ninja -C build clean - ninja -C build + echo "*** Building SFML ***" + _build_sfml_attractmode fi # Build 'attract-mode' echo "*** Building Attract-Mode ***" - cd "${md_build}" || exit + #cd "${md_build}" || exit local params=() - isPlatform "kms" && params+=('USE_DRM=1' EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml-pi/include -L${md_build}/sfml-pi/lib") + isPlatform "kms" && params+=('USE_DRM=1' EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml/include -L${md_build}/sfml/lib") isPlatform "rpi" && params+=('USE_MMAL=1') isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') @@ -196,7 +213,10 @@ function build_attractmode() { } function install_attractmode() { - make -C sfml-pi install + echo "*** Installing SFML ***" + ninja -C sfml install/strip + + echo "*** Installing Attract-Mode ***" make prefix="${md_inst}" install } From c804b0faea5245b511b6281b76b95abdfbaf7929 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 00:11:27 +0000 Subject: [PATCH 07/14] fix sources --- scriptmodules/supplementary/attractmode.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 4459766..64ae63c 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -159,6 +159,11 @@ function sources_attractmode() { # Set Default Config Path(s) sed -e "s|/.attract|/ArchyPie/configs/${md_id}|g" -i "${md_build}/src/fe_settings.cpp" + + # Get 'sfml' source code for the 'kms' platform + if isPlatform "kms"; then + _sources_sfml_attractmode + fi } function _sources_sfml_attractmode() { From d769f9da2520fdfe6e89658fa16e59b30fbdad21 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 00:16:03 +0000 Subject: [PATCH 08/14] Update --- scriptmodules/supplementary/attractmode.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 64ae63c..6e7fe49 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -129,10 +129,6 @@ function _add_rom_attractmode() { chown "${__user}":"${__group}" "${config}" } -function _get_branch_sfml_attractmode() { - download "https://api.github.com/repos/sfml/sfml/tags" - | grep -m 1 name | cut -d\" -f4 -} - function depends_attractmode() { local depends=( 'cmake' @@ -168,7 +164,7 @@ function sources_attractmode() { function _sources_sfml_attractmode() { local tag - tag="$(_get_branch_sfml_attractmode)" + tag="2.6.2" gitPullOrClone "${md_build}/sfml" "https://github.com/sfml/sfml" "${tag}" } From 16a3fd01b4fb0d4f4f0cc65f0b9967d1829237bc Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 00:24:31 +0000 Subject: [PATCH 09/14] Update build options --- scriptmodules/supplementary/attractmode.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 6e7fe49..ea7894f 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -182,10 +182,11 @@ function _build_sfml_attractmode() { -DCMAKE_CXX_COMPILER="clang++" \ -DCMAKE_INSTALL_PREFIX="${md_build}/sfml" \ -DCMAKE_LINKER_TYPE="LLD" \ - -DSFML_DRM="ON" \ + -DSFML_USE_DRM="ON" \ + -DSFML_USE_SYSTEM_DEPS="ON" \ -Wno-dev - ninja -C build clean - ninja -C build + ninja -C sfml clean + ninja -C sfml #md_ret_require="${md_build}/zmusic/source/libzmusic.so" } From e4d6ec63836ae76ea2b9ed2a92d4cff424426ad2 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 00:55:52 +0000 Subject: [PATCH 10/14] fix installation --- scriptmodules/supplementary/attractmode.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index ea7894f..e9efb70 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -173,21 +173,20 @@ function _build_sfml_attractmode() { local params=() #isPlatform "rpi" && params+=('-DSFML_OPENGL_ES=1') cmake . \ - -B"sfml" \ + -B"sfml/build" \ -G"Ninja" \ -S"sfml" \ -DCMAKE_BUILD_RPATH_USE_ORIGIN="ON" \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_C_COMPILER="clang" \ -DCMAKE_CXX_COMPILER="clang++" \ - -DCMAKE_INSTALL_PREFIX="${md_build}/sfml" \ -DCMAKE_LINKER_TYPE="LLD" \ -DSFML_USE_DRM="ON" \ -DSFML_USE_SYSTEM_DEPS="ON" \ -Wno-dev - ninja -C sfml clean - ninja -C sfml - #md_ret_require="${md_build}/zmusic/source/libzmusic.so" + ninja -C sfml/build clean + ninja -C sfml/build + md_ret_require="${md_build}/sfml/build/lib/libsfml-system.so" } function build_attractmode() { @@ -201,7 +200,7 @@ function build_attractmode() { echo "*** Building Attract-Mode ***" #cd "${md_build}" || exit local params=() - isPlatform "kms" && params+=('USE_DRM=1' EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml/include -L${md_build}/sfml/lib") + isPlatform "kms" && params+=('USE_DRM=1' EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml/build/include -L${md_build}/sfml/build/lib") isPlatform "rpi" && params+=('USE_MMAL=1') isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') @@ -215,11 +214,14 @@ function build_attractmode() { } function install_attractmode() { - echo "*** Installing SFML ***" - ninja -C sfml install/strip + #ninja -C sfml install/strip echo "*** Installing Attract-Mode ***" make prefix="${md_inst}" install + + echo "*** Installing SFML ***" + mkdir "${md_inst}/lib" + cp -Pv "${md_build}"/sfml/build/*.so* "${md_inst}/lib" } function remove_attractmode() { From 2719d1b10e2d01d05d4bb3c22abf735d81c860d2 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 01:15:32 +0000 Subject: [PATCH 11/14] fix install again --- scriptmodules/supplementary/attractmode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index e9efb70..84581b7 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -221,7 +221,7 @@ function install_attractmode() { echo "*** Installing SFML ***" mkdir "${md_inst}/lib" - cp -Pv "${md_build}"/sfml/build/*.so* "${md_inst}/lib" + cp -Pv "${md_build}"/sfml/build/lib/*.so* "${md_inst}/lib" } function remove_attractmode() { From f237e46e3ac6dbe8d8af58499d056b707ec2a458 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 01:18:18 +0000 Subject: [PATCH 12/14] fix launcher --- scriptmodules/supplementary/attractmode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 84581b7..fd6f4db 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -258,7 +258,7 @@ if [[ -z "\${DISPLAY}" && -f "\${MODELIST}" && ! "\${1}" =~ build-romlist ]]; th [[ ! -z "\${default_mode}" ]] && export SFML_DRM_MODE="\${default_mode}" [[ ! -z "\${default_vrefresh}" ]] && export SFML_DRM_REFRESH="\${default_vrefresh}" fi -LD_LIBRARY_PATH="${md_inst}/sfml/lib "${md_inst}/bin/attract" "\${@}" +LD_LIBRARY_PATH="${md_inst}/sfml/lib" "${md_inst}/bin/attract" "\${@}" _EOF_ chmod +x "/usr/bin/attract" From 174c60fcba16d704c80ab9fb1caa447ec6af7deb Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 01:20:14 +0000 Subject: [PATCH 13/14] fix launcher again --- scriptmodules/supplementary/attractmode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index fd6f4db..2339c3c 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -258,7 +258,7 @@ if [[ -z "\${DISPLAY}" && -f "\${MODELIST}" && ! "\${1}" =~ build-romlist ]]; th [[ ! -z "\${default_mode}" ]] && export SFML_DRM_MODE="\${default_mode}" [[ ! -z "\${default_vrefresh}" ]] && export SFML_DRM_REFRESH="\${default_vrefresh}" fi -LD_LIBRARY_PATH="${md_inst}/sfml/lib" "${md_inst}/bin/attract" "\${@}" +LD_LIBRARY_PATH="${md_inst}/lib" "${md_inst}/bin/attract" "\${@}" _EOF_ chmod +x "/usr/bin/attract" From 5f4cae6798216fffd1304e733fd7f5e3ecfc8e76 Mon Sep 17 00:00:00 2001 From: V0rt3x667 Date: Mon, 11 Nov 2024 01:49:13 +0000 Subject: [PATCH 14/14] tidy up script --- scriptmodules/supplementary/attractmode.sh | 54 +++++++++++++--------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/scriptmodules/supplementary/attractmode.sh b/scriptmodules/supplementary/attractmode.sh index 2339c3c..35ea799 100644 --- a/scriptmodules/supplementary/attractmode.sh +++ b/scriptmodules/supplementary/attractmode.sh @@ -29,12 +29,12 @@ function _add_system_attractmode() { local platform="${6}" local theme="${7}" - # Replace Any '/' Characters In Fullname + # Replace any '/' characters in fullname fullname="${fullname//\/}" local config="${attract_dir}/emulators/${fullname}.cfg" iniConfig " " "" "${config}" - # Replace %ROM% With "[romfilename]" & Convert To An Array + # Replace %ROM% with "[romfilename]" & convert to an array # shellcheck disable=SC2206 command=(${command//%ROM%/\"[romfilename]\"}) iniSet "executable" "${command[0]}" @@ -43,12 +43,12 @@ function _add_system_attractmode() { iniSet "rompath" "${path}" iniSet "system" "${fullname}" - # Extensions Separated By Semicolons + # Extensions separated by semicolons extensions="${extensions// /;}" iniSet "romext" "${extensions}" - # Snap Path + # Snap path local snap="snap" [[ "${name}" == "archypie" ]] && snap="icons" iniSet "artwork flyer" "${path}/flyer" @@ -58,7 +58,7 @@ function _add_system_attractmode() { chown "${__user}":"${__group}" "${config}" - # If No Gameslist, Generate One + # If no gameslist generate one if [[ ! -f "${attract_dir}/romlists/${fullname}.txt" ]] && [[ -f "/usr/bin/attract" ]]; then sudo -u "${__user}" attract --build-romlist "${fullname}" -o "${fullname}" else @@ -86,16 +86,16 @@ function _del_system_attractmode() { local fullname="${1}" local name="${2}" - # Don't Remove An Empty System + # Don't remove an empty system [[ -z "${fullname}" ]] && return 0 - # Replace Any '/' Characters In Fullname + # Replace any '/' characters in fullname fullname="${fullname//\/}" rm -rf "${attract_dir}/romlists/${fullname}.txt" local tab=$'\t' - # Remove Display Block From "^display${tab}${fullname}" To Next "^display" Or Empty Line Keeping The Next Display Line + # Remove display block from "^display${tab}${fullname}" to next "^display" or empty line keeping the next display line sed -i "/^display${tab}${fullname}/,/^display\|^$/{/^display${tab}${fullname}/d;/^display\$/!d}" "${attract_dir}/attract.cfg" } @@ -113,14 +113,14 @@ function _add_rom_attractmode() { local config="${attract_dir}/romlists/${system_fullname}.txt" - # Remove Extension + # Remove file extension path="${path/%.*}" if [[ ! -f "${config}" ]]; then echo "#Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons" >"${config}" fi - # If The Entry Already Exists, Remove It + # If the entry already exists remove it if grep -q "^${path};" "${config}"; then sed -i "/^${path}/d" "${config}" fi @@ -131,7 +131,6 @@ function _add_rom_attractmode() { function depends_attractmode() { local depends=( - 'cmake' 'curl' 'ffmpeg' 'fontconfig' @@ -141,10 +140,15 @@ function depends_attractmode() { 'p7zip' ) isPlatform "kms" && depends+=( + 'clang' + 'cmake' 'glu' 'libdrm' 'libglvnd' + 'libsndfile' + 'lld' 'mesa' + 'ninja' ) isPlatform "x11" && depends+=('libxinerama' 'sfml') getDepends "${depends[@]}" @@ -153,7 +157,7 @@ function depends_attractmode() { function sources_attractmode() { gitPullOrClone - # Set Default Config Path(s) + # Set default config path(s) sed -e "s|/.attract|/ArchyPie/configs/${md_id}|g" -i "${md_build}/src/fe_settings.cpp" # Get 'sfml' source code for the 'kms' platform @@ -170,8 +174,7 @@ function _sources_sfml_attractmode() { } function _build_sfml_attractmode() { - local params=() - #isPlatform "rpi" && params+=('-DSFML_OPENGL_ES=1') + echo "*** Building SFML ***" cmake . \ -B"sfml/build" \ -G"Ninja" \ @@ -192,47 +195,52 @@ function _build_sfml_attractmode() { function build_attractmode() { # Build 'sfml' for the 'kms' platform if isPlatform "kms"; then - echo "*** Building SFML ***" _build_sfml_attractmode fi # Build 'attract-mode' echo "*** Building Attract-Mode ***" - #cd "${md_build}" || exit local params=() isPlatform "kms" && params+=('USE_DRM=1' EXTRA_CXXFLAGS="${CFLAGS} -I${md_build}/sfml/build/include -L${md_build}/sfml/build/lib") isPlatform "rpi" && params+=('USE_MMAL=1') - isPlatform "x11" && params+=('USE_SYSTEM_SFML=1' 'FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') + isPlatform "x11" && params+=('USE_SYSTEM_SFML=1') + isPlatform "x86" && params+=('FE_HWACCEL_VAAPI=1' 'FE_HWACCEL_VDPAU=1') make clean make prefix="${md_inst}" "${params[@]}" - # Remove Example Configs + # Remove example configs rm -rf "${md_build}/config/emulators/"* md_ret_require="${md_build}/attract" } function install_attractmode() { - #ninja -C sfml install/strip - + # Install 'attract-mode' echo "*** Installing Attract-Mode ***" make prefix="${md_inst}" install + # Install 'sfml' for the 'kms' platform + if isPlatform "kms"; then + _install_sfml_attractmode + fi +} + +function _install_sfml_attractmode() { echo "*** Installing SFML ***" mkdir "${md_inst}/lib" cp -Pv "${md_build}"/sfml/build/lib/*.so* "${md_inst}/lib" } function remove_attractmode() { - rm -f /usr/bin/attract + rm -f "/usr/bin/attract" } function configure_attractmode() { moveConfigDir "${arpdir}/${md_id}" "${md_conf_root}/all/${md_id}" if [[ "${md_mode}" == "install" ]]; then - # Create Default Config File + # Create default config file local config="${md_conf_root}/all/${md_id}/attract.cfg" if [[ ! -f "${config}" ]]; then @@ -243,7 +251,7 @@ function configure_attractmode() { mkUserDir "${md_conf_root}/all/${md_id}/emulators" - # Create Launcher Script + # Create launcher script cat > "/usr/bin/attract" <<_EOF_ #!/usr/bin/env bash MODELIST=/opt/archypie/supplementary/kmsxx/kmsprint-rp