Skip to content

Instantly share code, notes, and snippets.

@milnak
Last active May 31, 2025 16:57
Show Gist options
  • Save milnak/02bf3bba6d98ee68fc8d5868e05856e1 to your computer and use it in GitHub Desktop.
Save milnak/02bf3bba6d98ee68fc8d5868e05856e1 to your computer and use it in GitHub Desktop.
Compiling MAME for Windows

Building MAME for Windows

Derived from Compiling MAME

Install the MSYS2 environment

Instructions

Direct Link

Default install folder is c:\MSYS64

Start "MSYS2 MINGW64"

Update installation:

pacman -S --noconfirm --refresh --sysupgrade 

MSYS2 may close afterwards. If so, re-open MSYS2 and run this again.

Exclude MSYS2 from virus scans (optional)

This will speed up compilation, but it optional, as it adds risk!

Open elevated PowerShell prompt and run:

Add-MpPreference -ExclusionPath 'C:\MSYS2'

Download and install mame-essentials package

mkdir ~/tmp && cd ~/tmp
curl -O 'https://repo.mamedev.org/x86_64/mame-essentials-1.0.6-1-x86_64.pkg.tar.xz'
pacman -U --noconfirm  mame-essentials-1.0.6-1-x86_64.pkg.tar.xz

Add the mame package repository to pacman

echo -e '\n[mame]\nInclude = /etc/pacman.d/mirrorlist.mame\nSigLevel = Never' >> /etc/pacman.conf

Update mame packages

pacman -S --noconfirm --refresh --sysupgrade

Install packages necessary to build MAME

pacman -S --noconfirm git make unzip mingw-w64-x86_64-gcc mingw-w64-x86_64-libc++ mingw-w64-x86_64-python

Put MINGW64 and MINGW32 environment variables in ~/.bashrc, and refresh

echo "export MINGW64=/mingw64 MINGW32=" >> ~/.bashrc
source ~/.bashrc

Clone MAME sources

git clone https://github.com/mamedev/mame.git

Build MAME (REGENIE=1 will regenerate settings in the makefile)

cd mame
make --jobs=4 PTR64=1 OPTIMIZE=3 SYMBOLS=1 SYMLEVEL=1 STRIP_SYMBOLS=1

Verify build

Binaries will be in C:\MSYS64\home(username)\tmp\mame - mame.exe

Run mame.exe and yhou should see a version with a long identifier, e.g. "mame0277-416-geccbb3d77c8":

.\mame.exe -version
0.277 (mame0277-416-geccbb3d77c8)

while an official release would look like this:

.\mame.exe -version
0.277 (mame0277)

Update MAME

git pull
make clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment