mkxp-z/retro
刘皓 a44f3b16b3
Add SDL headers and PhysFS to libretro builds
I don't think I'll be needing SDL. Pretty sure about 100% of the
functionality of SDL that's currently being used here is either trivial
to reimplement or needs to be replaced for the libretro core to work in
the first place. For example, I already know I'm going to need to
completely replace the SDL input handling with libretro's input API.
Also, I'll need to get rid of the use of SDL threads in the audio code
later because libretro cores need to render audio synchronously with the
video rendering.

I'm including the SDL headers, though, to reduce the number of
compilation errors.
2025-01-24 23:56:00 -05:00
..
.gitignore Upload base libretro core files 2024-12-29 23:35:35 -05:00
core.info Implement mounting game zip files 2024-12-31 00:25:00 -05:00
link.T Improve compilation flags for libretro builds 2025-01-10 17:57:10 -05:00
Makefile Add SDL headers and PhysFS to libretro builds 2025-01-24 23:56:00 -05:00
README.md Implement loading scripts from Scripts.rxdata for libretro 2025-01-18 18:51:29 -05:00
ruby-bindings.h Implement even more of binding-sandbox 2025-01-22 21:52:55 -05:00
sandbox-bindgen.rb Remove useless try/catch blocks in destructors in sandbox-bindgen 2025-01-23 22:50:17 -05:00

The build process for the libretro core is divided into two phases.

Phase 1

All the files produced by this phase are platform-agnostic, so you can run this build phase on any computer, regardless of which operating system or CPU architecture the libretro core is for.

Download WASI SDK, Binaryen and WABT. Currently you must use WASI SDK version 21; later versions of the WASI SDK do not work. Binaryen and WABT versions can be arbitrary as long as they're relatively recent. You also need to have either Universal Ctags or Exuberant Ctags installed, which we use for generating bindings for the Ruby C API.

Then go to the directory that this README.md is in and run this command, filling in the paths to WASI SDK, wasm-opt from Binaryen, wasm2c from WABT and ctags from Universal Ctags or Exuberant Ctags accordingly:

make WASI_SDK=/path/to/wasi-sdk WASM_OPT=/path/to/binaryen/bin/wasm-opt WASM2C=/path/to/wabt/bin/wasm2c CTAGS=/path/to/ctags

This will produce the directory "retro/build/retro-phase1".

Phase 2

This phase produces the actual core file. You need to have Meson, Ninja, CMake, Git, a C compiler and a C++ compiler. No software libraries are required other than the system libraries.

Go to the root directory of this repository and run:

meson setup build -Dretro=true -Dretro_phase1_path=path/to/retro-phase1
cd build
ninja

If you have a program named patch in your PATH, it has to be GNU patch. If your patch program isn't GNU patch (e.g. macOS comes with its own incompatible version of patch that will break this build system), either install GNU patch and then temporarily add it to your PATH for the duration of the meson setup command, or temporarily remove your patch program from the PATH for the duration of the meson setup command: the build system will fall back to using git apply if patch is not found, which will work fine.