Author: enygmata
Contributors: radius
This build is not supported by the RetroArch developers.
This little tutorial will help you build RetroArch for Windows bundled with most of the features available for this platform. The advantage of this build over the official ones is that it doesn't require tweaking anything and RetroArch will use more up to date libraries.
It is called pure MSYS2 and Unix-like because it uses the same build commands as the Unix-inspired systems and and the development files provided by MSYS2 instead of the ones available in the official compilation guide.
Your RetroArch will have the following extra features:
- Python shader state tracker
- GLUI menu driver
- XMB menu driver
- SDL2 driver set (input, joystick, audio, video and gl context)
- FFMPEG recording
- Overlays
- maister's audio filters
- Video filters
- Content database (cheats, ROM metadata and more)
- Collapsed submenu groups
First you need to grab MSYS2 from https://msys2.github.io/, pick whatever version you like. Install it and then start the MSYS2 Shell entry that should be present in your Start Menu.
Updating your install is a multiple step operation: first you update the core, then you have to rehash the environment and finally you'll be able to properly update the rest of the system.
Once you are in the MSYS2 Shell terminal, run the following commands to upgrade the core MSYS2 packages:
pacman --noconfirm -Sy
pacman --needed --noconfirm -S bash pacman pacman-mirrors msys2-runtime
When the command is done working, close all MSYS2 shells you might have open and run these commands in the Run as dialog or in cmd.exe
:
-
In a 64bit install of MSYS2:
%systemdrive%\msys64\autorebase.bat
-
In a 32bit install of MSYS2:
%systemdrive%\msys32\autorebase.bat
Once the window closes, open the MSYS2 Shell again and type pacman --noconfirm -Su
then repeat the previous operation to finish the process.
Note: If you get fork errors, the second step may have failed. You should go to your msys2 install directory and run autorebase.bat manually. If that didn't solve the problem consider reinstalling msys2.
The following commands will install everything you need to build RetroArch in your MSYS2 environment.
-
For 32 bit builds run:
pacman -S --noconfirm --needed git make mingw-w64-i686-toolchain mingw-w64-i686-pkgconf mingw-w64-i686-nvidia-cg-toolkit mingw-w64-i686-SDL2 mingw-w64-i686-libxml2 mingw-w64-i686-freetype mingw-w64-i686-python3 mingw-w64-i686-ffmpeg
-
For 64 bit builds:
pacman -S --noconfirm --needed git make mingw-w64-x86_64-toolchain mingw-w64-x86_64-pkgconf mingw-w64-x86_64-nvidia-cg-toolkit mingw-w64-x86_64-SDL2 mingw-w64-x86_64-libxml2 mingw-w64-x86_64-freetype mingw-w64-x86_64-python3 mingw-w64-x86_64-ffmpeg
After installing the packages, close the MSYS2 shell and open either MinGW-w64 Win64 Shell for 64 bit builds or MinGW-w64 Win32 Shell if you want to build for 32 bit systems. Both should be available in your Start Menu.
First thing you need to do is to grab the source files, here we'll fetch them from the official git repository (this may take a while):
git clone https://github.com/libretro/RetroArch.git
cd RetroArch
git clone https://github.com/libretro/common-overlays.git
git clone https://github.com/libretro/retroarch-assets.git
git clone https://github.com/libretro/retroarch-joypad-autoconfig.git
git clone https://github.com/libretro/common-shaders.git
git clone https://github.com/Themaister/RetroArch-DSP-Plugins.git
git clone https://github.com/libretro/libretro-database.git
Now it's time to build everything, first we'll build RetroArch...
./configure --enable-glui --enable-xmb
make -j3
Note: If the last command fails, try appending
V=1
or removing the-j3
parameter from themake
invocation.
... then we build the video filters ...
make -C gfx/video_filters
... and finally the audio filters.
make -C RetroArch-DSP-Plugins CC=gcc CXX=g++
In this tutorial we'll generate zip packages named like RetroArch-Year-Month-Day.zip
that'll reside in the packages
directory, so let's set a temporary environment variable just to make things easier:
RA_DIR=$(pwd)/packages/RetroArch-$(date +%F)
Make sure you are in the RetroArch directory before you run this command.
Now it's time to copy all the files:
mkdir -p $RA_DIR
cd $RA_DIR
mkdir -p shaders overlays assets autoconfig filters/{video,audio} cores screenshots config system content playlists database cheats
cp -r ../../libretro-database/rdb/* database
cp -r ../../libretro-database/cht/* cheats
cp -r ../../common-shaders/* shaders
cp -r ../../common-overlays/* overlays
cp -r ../../retroarch-assets/* assets
cp -r ../../retroarch-joypad-autoconfig/* autoconfig
find ../../gfx/filters/ -type f -iname '*.dll' -exec sh -c 'cp -vu "$1" "filters/video/$(basename ${1%.dll}).filt"' cp {} \;
find ../../RetroArch-DSP-Plugins/ -type f -iname '*.so' -exec sh -c 'cp -vu "$1" "filters/audio/$(basename ${1%.so}).dsp"' cp {} \;
cp ../../retroarch.exe .
cp ../../retroarch.cfg retroarch.cfg.original
cp ../../tools/retroarch-joyconfig.exe .
Then we need to get RetroArch dependencies:
for i in $(seq 3); do for bin in $(ldd *exe *dll | grep -i mingw | cut -d\ -f 3); do cp -vu "$bin" . ; done; done
Note: This will most of the time only fetch MSYS2-installed dependencies.
Now we make a minimal retroarch.cfg
so that we get a working portable package:
cat << EOF > retroarch.cfg
libretro_directory = ":\cores"
screenshot_directory = ":\screenshots"
rgui_config_directory = ":\config"
rgui_browser_directory = ":\content"
assets_directory = ":\assets"
overlay_directory = ":\overlays"
joypad_autoconfig_dir = ":\autoconfig"
system_directory = ":\system"
audio_filter_dir = ":\filters\audio"
video_filter_dir = ":\filters\video"
video_shader_dir = ":\shaders"
playlist_directory = ":\playlists"
cheat_database_path = ":\cheats"
content_database_path = ":\database"
menu_collapse_subgroups_enable = true
EOF
To wrap things up, we compress the folder with the zip utility:
zip -r9 "${RA_DIR}.zip" "$RA_DIR"
explorer ..
And we're done.