Difference between revisions of "Building DOSBox with MinGW"
(update) |
|||
Line 1: | Line 1: | ||
− | DOSBox is a complicated project. This document aims to provide a step by step description of how to use the MinGW developement environment to successfully build DOSBox. An alternative is to use [[ | + | DOSBox is a complicated project. This document aims to provide a step by step description of how to use the MinGW developement environment to successfully build DOSBox. An alternative is to use [[Building DOSBox with Visual C 2008 Express|Microsoft Visual Studio]]. |
− | This page will guide you through setting up MinGW to compile a current (SVN/CVS) version of DOSBox. Because of updates to compilers and libraries, this guide will not work with the 0.74 (the last official release, which is currently over | + | This page will guide you through setting up MinGW to compile a current (SVN/CVS) version of DOSBox. Because of updates to compilers and libraries, this guide will not work with the 0.74 (the last official release, which is currently over 6 years old) source files. |
== Installing MinGW == | == Installing MinGW == |
Revision as of 20:57, 28 June 2016
DOSBox is a complicated project. This document aims to provide a step by step description of how to use the MinGW developement environment to successfully build DOSBox. An alternative is to use Microsoft Visual Studio.
This page will guide you through setting up MinGW to compile a current (SVN/CVS) version of DOSBox. Because of updates to compilers and libraries, this guide will not work with the 0.74 (the last official release, which is currently over 6 years old) source files.
Installing MinGW
- Download mingw-get-setup.exe from http://sourceforge.net/projects/mingw/
- Run the installer, choosing the defaults
- Once the MinGW Installation Manager application starts, select
- mingw-developer-toolkit (msys-base should be automatically added)
- mingw32-base
- mingw32-gcc-g++
- On the installation menu, apply changes, and confirm that you want to apply the changes
The installation manager is going to download a bunch of files, and at the end, start installing them. Once this is done, you can close the dialog box as well as the installation manager.
Well done, MinGW is now installed! Let's start it up.
- Browse to C:\MinGW\msys\1.0
- Run MSYS.BAT
This will start up a DOS prompt like screen, lets mount the base path
mount 'c:\MinGW' /mingw
You have now completed this section, lets move on to adding the SDL libraries to MinGW.
Adding the SDL libraries to MinGW
- Download the pre compiled SDL development libraries from here http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz
- Copy the downloaded file to your MSYS home folder, it's going to be something like C:\MinGW\msys\1.0\home\Administrator
- Switch back to the MSYS command prompt we started earlier
- Lets extract the downloaded files
tar xvf SDL-devel-1.2.15-mingw32.tar.gz
- And now add the files to MinGW
cd SDL-1.2.15 make install-sdl prefix=/mingw cd ..
Cool, the SDL libraries have been added to MinGW, onto the next section.
Adding Direct Draw support to DOSBox (Optional)
If you want to give DOSBox the option to use the DDRAW output option, then we need to add a couple of extra libraries to MinGW
- Download the following file, http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the files (the -C parameter, tells tar where to extract the files to)
tar xvf directx-devel.tar.gz -C /mingw
Adding networking support to DOSBox (Optional)
These steps show you how to add the SDL_net libraries to MinGW, which enable networking and modem for DOSBox. If you aren't going to be using DOSBox for multi player games, then you can probably skip this step.
- Download the SDL_net source files from https://www.libsdl.org/projects/SDL_net/release/SDL_net-1.2.8.tar.gz
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf SDL_net-1.2.8.tar.gz
- Lets configure the libraries
cd SDL_net-1.2.8 ./configure --prefix=/mingw
- And now compile them
make
- And then install them (copy the files)
make install cd ..
Adding screenshot support (Optional)
This one is a bit tricky because it relies on two libraries, zlib (libpng needs these libraries), and libpng. We are also going to be compiling the libraries statically to keep external DLL's to a minimum.
- Download zlib from here http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.xz/download
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf zlib-1.2.8.tar.xz
- Lets build the static library
cd zlib-1.2.8 make -f win32/Makefile.gcc
- And now copy the files to /mingw
cp libz.a /mingw/lib/ cp zlib.h zconf.h /mingw/include/ cd ..
Cool, that wasn't too hard, onto libpng
- Download libpng from here http://sourceforge.net/projects/libpng/files/libpng16/1.6.18/libpng-1.6.18.tar.gz/download
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf libpng-1.6.18.tar.gz
- Configure the library
cd libpng-1.6.18 ./configure --disable-shared --prefix=/mingw
- And now to compile and install the files
make make install cd ..
Adding support for compressed audio on diskimages (Optional)
This is for cue/bin cdrom images with compressed (ogg) audio tracks. We will be adding the libvorbis, libogg, and sdl_sound libraries.
- Download libogg from here http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf libogg-1.3.2.tar.gz
- Configure the library, disabling shared library files
cd libogg-1.3.2 ./configure --disable-shared --prefix=/mingw
- Compile and install the library files
make make install cd ..
- Download libvorbis from here http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf libvorbis-1.3.5.tar.gz
- Configure the library, disabling shared library files
cd libvorbis-1.3.5 ./configure --disable-shared --prefix=/mingw
- Compile and install the library files
make make install cd ..
- Download sdl_sound from here https://www.icculus.org/SDL_sound/downloads/SDL_sound-1.0.3.tar.gz
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf SDL_sound-1.0.3
- Unfortunately sdl_sound isn't going to compile on MinGW so we are going to have to edit some of the source files.
- Using something like Notepad++ (or Wordpad in a pinch), open up SDL_sound-1.0.3\decoders\mpglib\mpg123_sdlsound.h
- Replace line 8
#include <math.h>
- With the following
# define M_PI 3.14159265358979323846 # define M_SQRT2 1.41421356237309504880 # define REAL_IS_FLOAT # define NEW_DCT9 # define random rand # define srandom srand
- Using something like Notepad++ (or Wordpad in a pinch), open up SDL_sound-1.0.3\decoders\timidity\tables.h
- Comment out line 23 with two //
//#include <math.h>
- The hard part is done, lets configure and compile
cd SDL_sound-1.0.3 ./configure --disable-shared --prefix=/mingw LIBS="-lvorbisfile -lvorbis -logg" make make install cd ..
Enabling the debugger (You probably don't want this)
The debugger is mainly for developers of DOSBox, so they can find out why a game isn't working.
- Download the PDCurses source files from http://sourceforge.net/projects/pdcurses/files/pdcurses/3.4/PDCurses-3.4.tar.gz
- Copy the downloaded file to your MSYS home folder
- Switch to the MSYS command prompt
- Extract the file
tar xvf PDCurses-3.4.tar.gz
- Compile the library
cd PDCurses-3.4/win32 make -f gccwin32.mak DLL=N
- And now copy the files to your /mingw folders
cp pdcurses.a /mingw/lib/libpdcurses.a cd .. cp curses.h panel.h /mingw/include/ cd ..
Compiling DOSBox
- Download the latest official DOSBox SVN source files from here: http://source.dosbox.com/dosboxsvn.tgz
(There are also enhanced SVN versions containing additional fixes and/or features that are not officially part of DOSBox, see SVN Builds for more details)
- Copy the file to your MSYS home folder
- Extract the file
tar xvf dosboxsvn.tgz
- Let's configure DOSBox, and tell it to use the static C library (-static-libgcc) and C++ library (-static-libstdc++) and stripping the final EXE of debug information (-s)
cd dosbox ./autogen.sh ./configure --enable-core-inline LDFLAGS="-static-libgcc -static-libstdc++ -s"
- For SDL_sound support, you have to extra some extra parameters so that the configure command knows where to find the audio library files (LIBS="-lvorbisfile.....)
./configure --enable-core-inline LDFLAGS="-static-libgcc -static-libstdc++ -s" LIBS="-lvorbisfile -lvorbis -logg"
- If you want to enable debugging (you probably don't)
./configure --enable-core-inline LDFLAGS="-static-libgcc -static-libstdc++ -s" LIBS="-lvorbisfile -lvorbis -logg" --enable-debug
- And now for compiling DOSBox
make
- The last step is to gather all the files together in a folder
- Create a folder with a name of your choosing
- Copy the dosbox.exe file located under the dosbox\src folder, e.g. C:\MinGW\msys\1.0\home\Administrator\dosbox\src to the folder you created
- Copy the SDL.dll file located under SDL-1.2.15\bin, e.g. C:\MinGW\msys\1.0\home\Administrator\SDL-1.2.15\bin to the folder you created
- Optionally, copy the SDL_net.dll file located under SDL_net-1.2.8\.libs, e.g. C:\MinGW\msys\1.0\home\Administrator\SDL_net-1.2.8\.libs to the folder you created
Start up DOSBox, and see if it works.