Difference between revisions of "Building DOSBox with MinGW"

From DOSBoxWiki
Jump to navigationJump to search
(16 intermediate revisions by 10 users not shown)
Line 1: Line 1:
As nobody has yet ported the original page (http://dosbox.sourceforge.net/wiki/index.php?page=BuildingDOSBox) I've done it.
+
== Building your own version of DOSBox ==
<br><br>
+
 
<br><br>
+
Why to do this?<br>
<br>Building your own version of DOSBox
+
Because any resource-intensive program can benefit greatly from optimization for your exact processor.<br>
<br>1. Grab the source
+
[[System_Requirements|System Requirements]] states that a P3 1Ghz can emulate a 3/486 - early dos games. I have compiled Dosbox and SDL myself for this processor, 1Ghz P3, and I can run games from 95/96 OK (Caesar 2, C&C: Red Alert).
<br>
+
So, if you have the skill, the performance increase is recommended.
<br>First, grab the latest version of the DOSbox sourcecode. A fairly often updated CVS-Dump can be found at: http://dosbox.linuxdevel.net/dosboxcvs.tgz
+
 
<br>
+
 
<br>Download it and extract it to a seperate directory.
+
=== 1. Grab the source ===
<br>2. SDL
+
 
<br>
+
First, grab the latest version of the DOSBox source code. A fairly often updated CVS-Dump can be found at: http://dosbox.linuxsecured.net/dosboxcvs.tgz  
<br>DOSBox utilizes SDL (Simple DirectMedia Layer) to use your graphics and sound-hardware. Ergo, you'll need to download it as well. Grab the latest source at
+
 
<br>http://www.libsdl.org/  
+
Download it and extract it to a separate directory.
<br>
+
 
<br>and extract to a seperate directory.
+
=== 2. SDL ===
<br>
+
 
<br>When working on Windows, you might want to save a lot of effort and just use the SDL (and optionally SDL_net) .DLL files included with the latest official DOSBox release, as compiling SDL with full options (e.g. DirectX support) is a bit involved. There are also pre-built .DLL files on the SDL web site (Runtime Libraries -> Win32) that you can try at
+
DOSBox uses SDL (Simple DirectMedia Layer) to access your graphics and sound hardware, so you'll need to download it as well. Grab the latest source at
<br>http://www.libsdl.org/download-1.2.php  
+
 
<br>
+
: http://www.libsdl.org/
<br>Note that as of 12 Dec 2004, ddraw (DirectDraw) rendering mode will not work in DOSBox unless you either use the SDL.dll included with the latest version of DOSBox, or build your own SDL.dll with the changes mentioned in the "Compiling SDL" section below.
+
 
<br>3. Compiling enviroment
+
and extract to a separate directory.
<br>
+
 
<br>When working on Windows, you'll most likely need a compiling enviroment. We suggest using the combination of MiniGW and MSYS, which can be found at
+
When working on Windows, you might want to save a lot of effort and just use the SDL (and optionally SDL_net) .DLL files included with the latest official DOSBox release, as compiling SDL with full options (e.g. DirectX support) is a bit involved. There are also pre-built .DLL files on the SDL web site (Runtime Libraries -> Win32) that you can try at
<br>http://prdownloads.sf.net/mingw/  
+
 
<br>
+
: http://www.libsdl.org/download-1.2.php
<br>You'll need to download both the latest MiniGW and MSYS. After downloading install MiniGW and MSYS (in this order). The MSYS-Installer should ask for the installation directory of MiniGW, so you should pick the path where you installed it. After the installation, run the MSYS.BAT and you should see a unix-like command prompt.  
+
 
<br>4. Compiling SDL
+
Note that as of 12 Dec 2004, ddraw (DirectDraw) rendering mode will not work in DOSBox unless you either use the SDL.dll included with the latest version of DOSBox, or build your own SDL.dll with the changes mentioned in the "Compiling SDL" section below.
<br>
+
 
<br>Navigate to the directory where you extracted the SDL-source (using unix commands) and type
+
=== 3. Compiling environment ===
<br>./configure  
+
 
<br>make  
+
When working on Windows, you'll most likely need a compiling environment. We suggest using the combination of MiniGW and MSYS, which can be found at
<br>make install  
+
 
<br>
+
: http://prdownloads.sf.net/mingw/
<br>Some MinGW-specific info on compiling SDL under Windows is available at
+
 
<br>http://www.libsdl.org/extras/win32/mingw32/README.txt  
+
You'll need to download both the latest MiniGW and MSYS. After downloading, install MiniGW and MSYS (in this order). The MSYS-Installer should ask for the installation directory of MiniGW, so you should pick the path where you installed it. After the installation, run the MSYS.BAT and you should see a unix-like command prompt.  
<br>
+
 
<br>If you are having trouble with a message like 'no acceptable ld found in $PATH' try 'export LD=/c/gxx-2.95.2/bin/ld.exe' (or wherever you have the exe; GCC 2.95 in this case)
+
=== 4. Compiling SDL ===
<br>
+
 
<br>Also, if you have trouble getting ddraw (DirectDraw) working in DOSBox, see this post on the DOSBox forum for a possible fix:
+
Navigate to the directory where you extracted the SDL-source (using unix commands) and type
<br>http://vogons.zetafleet.com/viewtopic.php?p=48050&highlight=#48050  
+
 
<br>4b. SDL-net (optional)
+
./configure
<br>
+
make
<br>If you want to benefit from DOSBox'es Modem-Emulation or IPX-Support, you'll additionally need the SDL-net library, which can be found at
+
make install
<br>http://www.libsdl.org/projects/SDL_net/  
+
 
<br>
+
Some MinGW-specific info on compiling SDL under Windows is available at
<br>Download, extract and compile as you did with SDL.
+
 
<br>
+
: http://www.libsdl.org/extras/win32/mingw32/README.txt
<br>If you skipped building your own SDL.dll, you can use the one included with the latest official release of DOSBox or you can get a SDL_net win32 binary (.DLL) release on the SDL web site at the URL above.
+
 
<br>5. Compiling DOSBox
+
If you are having trouble with a message like 'no acceptable ld found in $PATH' try 'export LD=/c/gxx-2.95.2/bin/ld.exe' (or wherever you have the exe; GCC 2.95 in this case).
<br>
+
 
<br>After compiling you'll need to adjust the PATH variable to point at the directory where the freshly built SDL-Library can be found.
+
Also, if you have trouble getting ddraw (DirectDraw) working in DOSBox, see this post on the DOSBox forum for a possible fix:
<br>
+
 
<br>Note: if you want to use SDL-net, do the same with that library.
+
: http://vogons.zetafleet.com/viewtopic.php?p=48050&highlight=#48050
<br>
+
 
<br>Then, change to the directory where you extracted the DOSBox-Source and type
+
==== 4b. SDL-net (optional) ====
<br>./configure  
+
 
<br>make  
+
If you want to benefit from DOSBox's Modem-Emulation or IPX-Support, you'll also need the SDL-net library, which can be found at
<br>
+
 
<br>to compile DOSBox. If everything worked, you should have a DOSBOX.EXE in the ./src - directory.
+
: http://www.libsdl.org/projects/SDL_net/
<br>6. Running
+
 
<br>
+
Download, extract, and compile as you did with SDL.
<br>The easiest way to run the new executable is to copy it (and your fresh SDL.dll and maybe even the SDL_net.dll) to the installation-directory of a non-CVS-version of DOSBox. That way, you have the needed directory structure and configuration files.
+
 
<br>Example for Building DosBOX 7.1 on OpenSUSE 10.2 Linux
+
If you skipped building your own SDL.dll, you can use the one included with the latest official release of DOSBox or you can get a SDL_net win32 binary (.DLL) release on the SDL web site at the URL above.
<br>
+
 
<br>NOTE: configure flags need double dashes in front of them. Couldn't show this due to wiki formatting restrictions.
+
=== 5. Compiling DOSBox ===
<br>
+
 
<br>-Remove the existing dosbox version if you have it.
+
After compiling you'll need to adjust the PATH variable to point at the directory where the freshly built SDL-Library can be found.
<br>
+
 
<br>-Obtain and extract the dosbox source code.
+
''Note: if you want to use SDL-net, do the same with that library.''
<br>
+
 
<br>-SUSE linux 10.2 already has SDL and alsa installed, but you need to install the SDL-devel package and alsa-devel package (for header files and libs).
+
Then, change to the directory where you extracted the DOSBox-Source and type
<br>
+
 
<br>-Obtain the SDL_Sound src from http://icculus.org/SDL_sound/downloads. Extract the source somewhere.
+
./configure
<br>
+
make
<br>Run configure -with-sdl-prefix=/usr/lib64 -with-sdl-exec-prefix=/usr
+
 
<br>
+
to compile DOSBox. If everything worked, you should have a <tt>DOSBOX.EXE</tt> in the <tt>./src</tt> - directory.
<br>make
+
 
<br>
+
=== 6. Running ===
<br>make install (need to be root)
+
 
<br>
+
The easiest way to run the new executable is to copy it (and your fresh <tt>SDL.dll</tt> ''and maybe even the SDL_net.dll'') to the installation-directory of a non-CVS-version of DOSBox. That way, you have the needed directory structure and configuration files.
<br>-OK, now you have everything you need to compile dosbox. cd to your dosbox directory, then run this at the shell:
+
 
<br>
+
=== Example for Building DosBOX 7.1 on OpenSUSE 10.2 Linux ===
<br>export CPPFLAGS="-I/usr/local/include/SDL"
+
 
<br>
+
-Remove the existing DOSBox version if you have it.
<br>export LDFLAGS="-L/usr/local/lib"
+
 
<br>
+
-Obtain and extract the DOSBox source code.
<br>configure -with-sdl-prefix=/usr/lib64 -with-sdl-exec-prefix=/usr -with-alsa-prefix=/usr/lib64
+
 
<br>
+
-SUSE linux 10.2 already has SDL and alsa installed, but you need to install the SDL-devel package and alsa-devel package (for header files and libs).
<br>-with-alsa-inc-prefix=/usr/include/alsa
+
 
<br>
+
-Obtain the SDL_Sound src from http://icculus.org/SDL_sound/downloads. Extract the source somewhere.
<br>make
+
Run configure --with-sdl-prefix=/usr/lib64 --with-sdl-exec-prefix=/usr
<br>
+
make
<br>make install (need to be root).
+
make install (need to be root)
<br>
+
 
<br>-The reason for the shell variables is that it seemed to be the only way configure could find the files it needed. There aren't any config options to find the SDL_sound library, and I tried giving it -libdir= and -includedir=, but that didn't work.
+
-OK, now you have everything you need to compile DOSBox. cd to your DOSBox directory, then run this at the shell:
<br>
+
export CPPFLAGS="-I/usr/local/include/SDL"
 +
export LDFLAGS="-L/usr/local/lib"
 +
configure --with-sdl-prefix=/usr/lib64 --with-sdl-exec-prefix=/usr --with-alsa-prefix=/usr/lib64
 +
    --with-alsa-inc-prefix=/usr/include/alsa
 +
make
 +
make install (need to be root).
 +
 
 +
-The reason for the shell variables is that it seemed to be the only way configure could find the files it needed. There aren't any config options to find the SDL_sound library, and I tried giving it -libdir= and -includedir=, but that didn't work.

Revision as of 17:06, 15 April 2008

Building your own version of DOSBox

Why to do this?
Because any resource-intensive program can benefit greatly from optimization for your exact processor.
System Requirements states that a P3 1Ghz can emulate a 3/486 - early dos games. I have compiled Dosbox and SDL myself for this processor, 1Ghz P3, and I can run games from 95/96 OK (Caesar 2, C&C: Red Alert). So, if you have the skill, the performance increase is recommended.


1. Grab the source

First, grab the latest version of the DOSBox source code. A fairly often updated CVS-Dump can be found at: http://dosbox.linuxsecured.net/dosboxcvs.tgz

Download it and extract it to a separate directory.

2. SDL

DOSBox uses SDL (Simple DirectMedia Layer) to access your graphics and sound hardware, so you'll need to download it as well. Grab the latest source at

http://www.libsdl.org/

and extract to a separate directory.

When working on Windows, you might want to save a lot of effort and just use the SDL (and optionally SDL_net) .DLL files included with the latest official DOSBox release, as compiling SDL with full options (e.g. DirectX support) is a bit involved. There are also pre-built .DLL files on the SDL web site (Runtime Libraries -> Win32) that you can try at

http://www.libsdl.org/download-1.2.php

Note that as of 12 Dec 2004, ddraw (DirectDraw) rendering mode will not work in DOSBox unless you either use the SDL.dll included with the latest version of DOSBox, or build your own SDL.dll with the changes mentioned in the "Compiling SDL" section below.

3. Compiling environment

When working on Windows, you'll most likely need a compiling environment. We suggest using the combination of MiniGW and MSYS, which can be found at

http://prdownloads.sf.net/mingw/

You'll need to download both the latest MiniGW and MSYS. After downloading, install MiniGW and MSYS (in this order). The MSYS-Installer should ask for the installation directory of MiniGW, so you should pick the path where you installed it. After the installation, run the MSYS.BAT and you should see a unix-like command prompt.

4. Compiling SDL

Navigate to the directory where you extracted the SDL-source (using unix commands) and type

./configure
make
make install

Some MinGW-specific info on compiling SDL under Windows is available at

http://www.libsdl.org/extras/win32/mingw32/README.txt

If you are having trouble with a message like 'no acceptable ld found in $PATH' try 'export LD=/c/gxx-2.95.2/bin/ld.exe' (or wherever you have the exe; GCC 2.95 in this case).

Also, if you have trouble getting ddraw (DirectDraw) working in DOSBox, see this post on the DOSBox forum for a possible fix:

http://vogons.zetafleet.com/viewtopic.php?p=48050&highlight=#48050

4b. SDL-net (optional)

If you want to benefit from DOSBox's Modem-Emulation or IPX-Support, you'll also need the SDL-net library, which can be found at

http://www.libsdl.org/projects/SDL_net/

Download, extract, and compile as you did with SDL.

If you skipped building your own SDL.dll, you can use the one included with the latest official release of DOSBox or you can get a SDL_net win32 binary (.DLL) release on the SDL web site at the URL above.

5. Compiling DOSBox

After compiling you'll need to adjust the PATH variable to point at the directory where the freshly built SDL-Library can be found.

Note: if you want to use SDL-net, do the same with that library.

Then, change to the directory where you extracted the DOSBox-Source and type

./configure
make

to compile DOSBox. If everything worked, you should have a DOSBOX.EXE in the ./src - directory.

6. Running

The easiest way to run the new executable is to copy it (and your fresh SDL.dll and maybe even the SDL_net.dll) to the installation-directory of a non-CVS-version of DOSBox. That way, you have the needed directory structure and configuration files.

Example for Building DosBOX 7.1 on OpenSUSE 10.2 Linux

-Remove the existing DOSBox version if you have it.

-Obtain and extract the DOSBox source code.

-SUSE linux 10.2 already has SDL and alsa installed, but you need to install the SDL-devel package and alsa-devel package (for header files and libs).

-Obtain the SDL_Sound src from http://icculus.org/SDL_sound/downloads. Extract the source somewhere.

Run configure --with-sdl-prefix=/usr/lib64 --with-sdl-exec-prefix=/usr
make
make install (need to be root)

-OK, now you have everything you need to compile DOSBox. cd to your DOSBox directory, then run this at the shell:

export CPPFLAGS="-I/usr/local/include/SDL"
export LDFLAGS="-L/usr/local/lib"
configure --with-sdl-prefix=/usr/lib64 --with-sdl-exec-prefix=/usr --with-alsa-prefix=/usr/lib64
   --with-alsa-inc-prefix=/usr/include/alsa
make
make install (need to be root).

-The reason for the shell variables is that it seemed to be the only way configure could find the files it needed. There aren't any config options to find the SDL_sound library, and I tried giving it -libdir= and -includedir=, but that didn't work.