If you decide to build MAME from source code in Linux, you should probably directly use the git repository on Github since bugs are corrected very quickly (and new ones are as quickly introduced ...).

The following descriptions apply to MAME release 0.256 and higher.

Preparing your Linux build environment

You need

  • gcc / gcc-c++ version 10 or higher
  • git
  • make
  • Development package of alsa
  • Development package of gconf2
  • Development package of gtk2
  • Development package of the SDL2 library
  • Development package of the SDL2_ttf library
  • Development package of the Qt5Core library
  • Development package of Pulseaudio (since 0.230)

Ubuntu

Ubuntu users use the apt(-get) command or other appropriate software repository tools.

For Ubuntu 22.04 and newer, the following packages are required:

sudo apt install git make g++ qtbase5-dev libsdl2-ttf-dev libfontconfig-dev

openSUSE

For an openSUSE installation (July 2023), either use YaST or (if not already installed) use zypper to install them:

sudo zypper install git-core make gcc-c++ libSDL2_ttf-devel alsa-devel fontconfig-devel libqt5-qtbase-devel libXi-devel libpulse-devel libXinerama-devel

Setting up your source directory

I suggest to create a directory in your home folder. Usually, I create a src directory, and in that directory I collect all my source projects in separate subdirectories. (user@host will be replaced by your user name and your host name.)

user@host:~$ mkdir -p ~/src/mamegit
user@host:~$ cd ~/src/mamegit
user@host:~/src/mamegit$ git clone https://github.com/mamedev/mame.git

This takes some minutes, depending on your Internet connection. The MAME source tree will be installed as a subdirectory mame in the current directory.

Building

If all of the libraries mentioned above are installed, you can now start compiling. With the SOURCES parameter, you can control which computer systems will be built. If you leave it away, all emulated systems will be built (which is quite a lot).

user@host:~/src/mamegit$ cd mame
user@host:~/src/mamegit/mame$ make SOURCES=ti/ti99_4x.cpp,ti/ti99_4p.cpp,ti/ti99_8.cpp,ti/geneve.cpp,ti/ti99_2.cpp REGENIE=1 TOOLS=1

If everything went smoothly, you should now find a mame file in the directory with a size of about 110 MiB (!). This depends, of course, on the number of systems you included in the SOURCES.

Installing

Actually, you could now run MAME in the directory where is has been built; you just have to put the ROM dump files of the systems you want to run in the roms subdirectory.

However, I highly suggest to use a separate directory: When you put everything in the source file directory, this will get messed up with files that do not belong to the source tree, and the git command will complain to have found unversioned files. Also, when you build MAME and something goes wrong, you would lose your previous build.

I usually create a subdirectory mame in my home directory:

user@host:~/src/mamegit$ cd mame
user@host:~/src/mamegit/mame$ mkdir ~/mame

We now copy everything we need into the mame subdirectory:

user@host:~/src/mamegit/mame$ cp -R artwork bgfx ctrlr docs hash hlsl ini language plugins roms samples ~/mame/
user@host:~/src/mamegit/mame$ cp castool chdman floptool imgtool jedutil ldresample ldverify nltool nlwav romcmp unidasm mame mamed ~/mame/

If the list contains files that are not available, you will get an error message, but the rest should be copied.

You should now continue with the setup as described in the section about setting up.

Script files

Instead of running these commands each time, I suggest you use my predefined scripts:

  • maketi: Build MAME
  • clean: Remove all previously build components in order to start fresh
  • mameinst: Install mame in the target directory
  • mameprep: Download required ROMs and other media from our server

Put them in the directory ~/src/mamegit. Make them executable with the chmod command:

user@host:~/src/mamegit$ chmod u+x maketi clean mameinst mameprep

MAME will be installed into a separate directory, the mame subdirectory of your home directory. You should run the build process with maketi, and then use mameinst to install the newly built components into that target directory.

You have to run mameprep only once. It downloads all required ROMs and creates start scripts for running the TI emulations. For all future builds, you just use mameinst.

So off you go:

user@host:~/src/mamegit$ ./clean
user@host:~/src/mamegit$ ./maketi
user@host:~/src/mamegit$ ./mameinst
user@host:~/mame$ ./mameprep

We use cookies
We use cookies on our website. All of these cookies are essential for the operation of the site. They are only used on this site and not transmitted to any third party. None of them are Tracking Cookies, and they do not serve to analyze your behavior.