From 9058c40f9ce96879729320ade0f4e1323a89aa37 Mon Sep 17 00:00:00 2001 From: Apaczer <94932128+Apaczer@users.noreply.github.com> Date: Fri, 14 Feb 2025 18:39:21 +0100 Subject: [PATCH] PKG: optimize v2 `libretro-scummvm` and strip obj. on all (#151) * PKG: strip `lr-scummvm` & `lr-scummvm-legacy` * PKG: optimize `libretro-scummvm` by removing heavy engines (leave only lesser ones by shared obj plugin size) --- .../libretro-scummvm-legacy.mk | 1 + ...e-optimize-by-reducing-engines-count.patch | 94 --------------- ...isable-large-engines-with-HEAVY-flag.patch | 113 ++++++++++++++++++ ...05-LR-Makefile-use-TREMOR-explicitly.patch | 34 ++++++ ...disable-all-unstable-eng-if-NO_WIP-1.patch | 26 ++++ .../libretro-scummvm/libretro-scummvm.mk | 3 +- 6 files changed, 176 insertions(+), 95 deletions(-) delete mode 100644 package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-Makefile-optimize-by-reducing-engines-count.patch create mode 100644 package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-disable-large-engines-with-HEAVY-flag.patch create mode 100644 package/miyoo/retroarch/libretro-scummvm/0005-LR-Makefile-use-TREMOR-explicitly.patch create mode 100644 package/miyoo/retroarch/libretro-scummvm/0006-LIBRETRO-force-disable-all-unstable-eng-if-NO_WIP-1.patch diff --git a/package/miyoo/retroarch/libretro-scummvm-legacy/libretro-scummvm-legacy.mk b/package/miyoo/retroarch/libretro-scummvm-legacy/libretro-scummvm-legacy.mk index 5ef9ad84..fb3df134 100644 --- a/package/miyoo/retroarch/libretro-scummvm-legacy/libretro-scummvm-legacy.mk +++ b/package/miyoo/retroarch/libretro-scummvm-legacy/libretro-scummvm-legacy.mk @@ -20,6 +20,7 @@ define LIBRETRO_SCUMMVM_LEGACY_BUILD_CMDS CXXFLAGS="$(TARGET_CXXFLAGS) $(LIBRETRO_SCUMMVM_LEGACY_LTO_CXXFLAGS) -ffat-lto-objects" \ LDFLAGS="$(TARGET_LDFLAGS) $(LIBRETRO_SCUMMVM_LEGACY_LTO_LDFLAGS) -ffat-lto-objects -shared -Wl,--no-undefined" \ $(MAKE) all TOOLSET="$(TARGET_CROSS)" -C $(@D)/backends/platform/libretro/build/ platform="$(RETROARCH_LIBRETRO_PLATFORM)" + $(TARGET_STRIP) --strip-unneeded $(@D)/backends/platform/libretro/build/scummvm_libretro.so endef define LIBRETRO_SCUMMVM_LEGACY_INSTALL_TARGET_CMDS diff --git a/package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-Makefile-optimize-by-reducing-engines-count.patch b/package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-Makefile-optimize-by-reducing-engines-count.patch deleted file mode 100644 index 2b1bfaaf..00000000 --- a/package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-Makefile-optimize-by-reducing-engines-count.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 5a2e1d3ec02f976a446b94850fa3fcf260648f2b Mon Sep 17 00:00:00 2001 -From: Apaczer <94932128+Apaczer@users.noreply.github.com> -Date: Mon, 3 Feb 2025 21:22:13 +0100 -Subject: [PATCH 3/4] LIBRETRO-Makefile: optimize by reducing engines count - (LITE) - -- discard HIGH_DEF engines from lite_engine.list & inline with legacy (add ultima4) -- add also -fno-PIC - -Update lite_engines.list ---- - backends/platform/libretro/Makefile | 5 +++-- - backends/platform/libretro/lite_engines.list | 22 +++++++++++++------- - 2 files changed, 18 insertions(+), 9 deletions(-) - -diff --git a/backends/platform/libretro/Makefile b/backends/platform/libretro/Makefile -index af2063fef82..c66c6cccfa0 100644 ---- a/backends/platform/libretro/Makefile -+++ b/backends/platform/libretro/Makefile -@@ -280,9 +280,9 @@ else ifeq ($(platform), miyoo) - LD = /opt/miyoo/usr/bin/arm-linux-g++ - AR = /opt/miyoo/usr/bin/arm-linux-ar cru - RANLIB = /opt/miyoo/usr/bin/arm-linux-ranlib -- DEFINES += -DDINGUX -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s -fPIC -+ DEFINES += -DDINGUX -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s -fno-PIC - DEFINES += -ffunction-sections -fdata-sections -DDEFAULT_PERF_TUNER -DREDUCE_MEMORY_USAGE -DUNCACHED_PLUGINS -- LDFLAGS += -shared -Wl,--gc-sections -Wl,--version-script=$(ROOT_PATH)/link.T -fPIC -+ LDFLAGS += -shared -Wl,--gc-sections -Wl,--version-script=$(ROOT_PATH)/link.T -fno-PIC - USE_VORBIS = 0 - USE_THEORADEC = 0 - USE_TREMOR = 1 -@@ -290,6 +290,7 @@ else ifeq ($(platform), miyoo) - USE_CURL = 0 - USE_MT32EMU = 0 - USE_HIGHRES := 0 -+ LITE := 1 - - # MIYOOMINI - else ifeq ($(platform), miyoomini) -diff --git a/backends/platform/libretro/lite_engines.list b/backends/platform/libretro/lite_engines.list -index bc681b60598..efb6d85f6e8 100644 ---- a/backends/platform/libretro/lite_engines.list -+++ b/backends/platform/libretro/lite_engines.list -@@ -1,32 +1,40 @@ -+access - agi - agos --agos2 - cine - cruise - draci - drascula - eob - gob --groovie - he - ihnm - kyra -+lab - lol - lure - made --mortevielle - parallaction -+plumbers - queen - saga - sci --sci32 - scumm - scumm_7_8 - sherlock - sky --sword1 --sword2 - teenagent - tinsel --touche - tucker -+bbvs -+cge -+cge2 -+dreamweb -+hugo -+illusions -+mads -+supernova -+tsage -+ultima4 -+voyeur -+xeen --- -2.45.2.windows.1 - diff --git a/package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-disable-large-engines-with-HEAVY-flag.patch b/package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-disable-large-engines-with-HEAVY-flag.patch new file mode 100644 index 00000000..bcc8e374 --- /dev/null +++ b/package/miyoo/retroarch/libretro-scummvm/0003-LIBRETRO-disable-large-engines-with-HEAVY-flag.patch @@ -0,0 +1,113 @@ +From 8902a8a1afb00339bb66b72710c0887a8d0ca449 Mon Sep 17 00:00:00 2001 +From: Apaczer <94932128+Apaczer@users.noreply.github.com> +Date: Wed, 12 Feb 2025 22:11:13 +0100 +Subject: [PATCH 3/5] LIBRETRO: disable large engines with HEAVY flag + +0 - default +1 - enable +2 - disable +--- + backends/platform/libretro/Makefile.common | 3 ++- + backends/platform/libretro/heavy_engines.list | 22 +++++++++++++++++++ + .../libretro/scripts/configure_engines.sh | 16 +++++++++++++- + 3 files changed, 39 insertions(+), 2 deletions(-) + create mode 100644 backends/platform/libretro/heavy_engines.list + +diff --git a/backends/platform/libretro/Makefile.common b/backends/platform/libretro/Makefile.common +index 01f2ef19ec2..8e179c48c05 100644 +--- a/backends/platform/libretro/Makefile.common ++++ b/backends/platform/libretro/Makefile.common +@@ -29,6 +29,7 @@ ENABLE_VKEYBD = 1 + HAVE_GCC3 = 1 + STATIC_LINKING ?= 0 + LITE ?= 0 ++HEAVY ?= 0 + NO_WIP ?= 1 + USE_LIBCO ?= 1 + USE_MT32EMU ?= 1 +@@ -212,7 +213,7 @@ endif + + ifeq (,$(filter clean datafiles coreinfo,$(MAKECMDGOALS))) + $(info Configuring ScummVM engines...) +-ifneq ($(shell cd $(SCRIPTS_PATH); ./configure_engines.sh $(ROOT_PATH) $(SCUMMVM_PATH) $(NO_WIP) $(STATIC_LINKING) $(LITE) $(UNAVAILABLE_DEPS)),0) ++ifneq ($(shell cd $(SCRIPTS_PATH); ./configure_engines.sh $(ROOT_PATH) $(SCUMMVM_PATH) $(NO_WIP) $(STATIC_LINKING) $(LITE) $(HEAVY) $(UNAVAILABLE_DEPS)),0) + $(error Configuring ScummVM engines failed) + else + -include $(SCUMMVM_PATH)/config.mk.engines +diff --git a/backends/platform/libretro/heavy_engines.list b/backends/platform/libretro/heavy_engines.list +new file mode 100644 +index 00000000000..85606b3fa9c +--- /dev/null ++++ b/backends/platform/libretro/heavy_engines.list +@@ -0,0 +1,22 @@ ++ags ++ ++glk ++ ++kyra ++lol ++eob ++ ++mads ++madsv2 ++ ++mm ++mm1 ++xeen ++ ++tsage ++ ++ultima ++ultima1 ++ultima4 ++ultima6 ++ultima8 +diff --git a/backends/platform/libretro/scripts/configure_engines.sh b/backends/platform/libretro/scripts/configure_engines.sh +index 43a355bd395..3e1ccecf993 100755 +--- a/backends/platform/libretro/scripts/configure_engines.sh ++++ b/backends/platform/libretro/scripts/configure_engines.sh +@@ -22,12 +22,13 @@ + # $3 [REQ] NO_WIP [0,1] + # $4 [REQ] STATIC_LINKING [0,1] + # $5 [REQ] LITE [0,1,2] ++# $6 [REQ] HEAVY [0,1,2] + # $[...] [OPT] Engines dependencies not available + + set -e + + # Exit if in parameters are not provided +-if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ] || [ -z $5 ] ; then ++if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ] || [ -z $5 ] || [ -z $6 ]; then + exit 1 + fi + +@@ -42,6 +43,8 @@ STATIC_LINKING=$1 + shift + LITE=$1 + shift ++HEAVY=$1 ++shift + no_deps=$@ + + cd "${SCUMMVM_PATH}" +@@ -60,6 +63,17 @@ tot_deps="" + # Test LITE + [ $LITE -ne 0 ] && engine_disable_all + ++# Test HEAVY ++if [ $HEAVY -eq 1 ] ; then ++ for eng in $(cat "${BUILD_PATH}"/heavy_engines.list) ; do ++ engine_enable "$eng" ++ done ++elif [ $HEAVY -eq 2 ] ; then ++ for eng in $(cat "${BUILD_PATH}"/heavy_engines.list) ; do ++ engine_disable "$eng" ++ done ++fi ++ + if [ $LITE -eq 1 ] ; then + for eng in $(cat "${BUILD_PATH}"/lite_engines.list) ; do + engine_enable "$eng" +-- +2.45.2.windows.1 + diff --git a/package/miyoo/retroarch/libretro-scummvm/0005-LR-Makefile-use-TREMOR-explicitly.patch b/package/miyoo/retroarch/libretro-scummvm/0005-LR-Makefile-use-TREMOR-explicitly.patch new file mode 100644 index 00000000..e35575ec --- /dev/null +++ b/package/miyoo/retroarch/libretro-scummvm/0005-LR-Makefile-use-TREMOR-explicitly.patch @@ -0,0 +1,34 @@ +From 67682387370edddb2205ff9c1b0fc80b41be23c6 Mon Sep 17 00:00:00 2001 +From: Apaczer <94932128+Apaczer@users.noreply.github.com> +Date: Tue, 11 Feb 2025 22:22:49 +0100 +Subject: [PATCH 5/5] LR-Makefile: use TREMOR explicitly + +thus disable Fluidsynth from build +also use -fno-PIC +--- + backends/platform/libretro/Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/backends/platform/libretro/Makefile b/backends/platform/libretro/Makefile +index 4a3cdc99236..a7508996a64 100644 +--- a/backends/platform/libretro/Makefile ++++ b/backends/platform/libretro/Makefile +@@ -280,12 +280,13 @@ else ifeq ($(platform), miyoo) + LD = /opt/miyoo/usr/bin/arm-linux-g++ + AR = /opt/miyoo/usr/bin/arm-linux-ar cru + RANLIB = /opt/miyoo/usr/bin/arm-linux-ranlib +- DEFINES += -DDINGUX -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s -fPIC ++ DEFINES += -DDINGUX -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s -fno-PIC + DEFINES += -ffunction-sections -fdata-sections -DDEFAULT_PERF_TUNER -DREDUCE_MEMORY_USAGE -DUNCACHED_PLUGINS +- LDFLAGS += -shared -Wl,--gc-sections -Wl,--version-script=$(ROOT_PATH)/link.T -fPIC ++ LDFLAGS += -shared -Wl,--gc-sections -Wl,--version-script=$(ROOT_PATH)/link.T -fno-PIC + USE_VORBIS = 0 + USE_THEORADEC = 0 + USE_TREMOR = 1 ++ USE_FLUIDSYNTH = 0 + USE_LIBCO = 0 + USE_CURL = 0 + USE_MT32EMU = 0 +-- +2.45.2.windows.1 + diff --git a/package/miyoo/retroarch/libretro-scummvm/0006-LIBRETRO-force-disable-all-unstable-eng-if-NO_WIP-1.patch b/package/miyoo/retroarch/libretro-scummvm/0006-LIBRETRO-force-disable-all-unstable-eng-if-NO_WIP-1.patch new file mode 100644 index 00000000..811dafc9 --- /dev/null +++ b/package/miyoo/retroarch/libretro-scummvm/0006-LIBRETRO-force-disable-all-unstable-eng-if-NO_WIP-1.patch @@ -0,0 +1,26 @@ +From 3e4f8c0f3f3a97cdf9a5e298e8018536029a0c24 Mon Sep 17 00:00:00 2001 +From: Apaczer <94932128+Apaczer@users.noreply.github.com> +Date: Fri, 14 Feb 2025 14:54:36 +0100 +Subject: [PATCH 6/6] LIBRETRO: force "disable all unstable eng" if NO_WIP=1 + +--- + backends/platform/libretro/scripts/configure_engines.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/backends/platform/libretro/scripts/configure_engines.sh b/backends/platform/libretro/scripts/configure_engines.sh +index 3e1ccecf993..cf69709655e 100755 +--- a/backends/platform/libretro/scripts/configure_engines.sh ++++ b/backends/platform/libretro/scripts/configure_engines.sh +@@ -80,6 +80,9 @@ if [ $LITE -eq 1 ] ; then + done + fi + ++# Test NO_WIP #2 ++[ $NO_WIP -eq 1 ] && engine_disable_all_unstable ++ + # Define engines list + for a in $_engines ; do + # Collect all default engines dependencies and force to yes +-- +2.45.2.windows.1 + diff --git a/package/miyoo/retroarch/libretro-scummvm/libretro-scummvm.mk b/package/miyoo/retroarch/libretro-scummvm/libretro-scummvm.mk index f95b1a4f..ced470dc 100644 --- a/package/miyoo/retroarch/libretro-scummvm/libretro-scummvm.mk +++ b/package/miyoo/retroarch/libretro-scummvm/libretro-scummvm.mk @@ -21,7 +21,8 @@ define LIBRETRO_SCUMMVM_BUILD_CMDS CFLAGS="$(TARGET_CFLAGS) $(LIBRETRO_SCUMMVM_LTO_CFLAGS) -ffat-lto-objects" \ CXXFLAGS="$(TARGET_CXXFLAGS) $(LIBRETRO_SCUMMVM_LTO_CXXFLAGS) -ffat-lto-objects" \ LDFLAGS="$(TARGET_LDFLAGS) $(LIBRETRO_SCUMMVM_LTO_LDFLAGS) -ffat-lto-objects -shared -Wl,--no-undefined" \ - $(MAKE) all TOOLSET="$(TARGET_CROSS)" -C $(@D)/backends/platform/libretro/ platform="$(RETROARCH_LIBRETRO_PLATFORM)" + $(MAKE) all TOOLSET="$(TARGET_CROSS)" -C $(@D)/backends/platform/libretro/ HEAVY=2 platform="$(RETROARCH_LIBRETRO_PLATFORM)" + $(TARGET_STRIP) --strip-unneeded $(@D)/backends/platform/libretro/scummvm_libretro.so endef define LIBRETRO_SCUMMVM_INSTALL_TARGET_CMDS