Lua scripts on hardware without SD card

I would like to have the ability to run some scripts on hardware without SD card. Scripts could be stored in ROMFS (this is already possible, but only if hardware supports SD card) or in external flash.
It seems that the scripting engine is not compiled on hardware without SDMMC pins defined in hwdef.dat
I’ve tried adding some random lines on the hardware definition files just to see if I can have the scripting engine to compile, like:

define AP_FILESYSTEM_ROMFS_ENABLED 1
define HAL_OS_FATFS_IO 1
define HAL_OS_POSIX_IO 1
define HAL_USE_SDC 1

but the scripting library is not compiled, as reported from waf:

$./waf configure --board KakuteH7v2
...
Scripting                                      : disabled

I’ve even tried to force compile the scripting libraries, forcing AP_SCRIPTING_ENABLED = 1, but it results in a lot of errors, I think due to some missing dependencies on filesystem libraries.
Actually an easy workaround is to define the SDMMC pins even if there is no SD card slot, but of course it doesn’t make sense.
Is there an easier way to reach this goal? Maybe some define I’m missing?

I’ve seen there were some questions on this topic before, like Better alternative of SD card which can support AP_Filesystem API and lua scripting and some major changes involving littlefs by @ntamas and @andyp1per, but I can’t get that to work.