== Compiling ScummVM with Minimalist GNU for Windows (MinGW) == MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications. It provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. == Things needed == === MinGW and MSYS === [http://http://www.mingw.org/ MinGW Homepage] - [http://sourceforge.net/projects/mingw/files/ MinGW Downloads] Downloading MinGW and it's tools is a lot easier today, thanks to mingw-get. To start using MinGW, download mingw-get-installer (formerly known as the MinGW automated installer): *[http://prdownloads.sf.net/mingw/mingw-get-inst-20101030.exe?download mingw-get-inst-20101030.exe (796kB)] Check the "'''Installing MinGW and MSYS'''" section below for instructions on how to create your ScummVM compilation environment === Libraries and Tools needed === You don't need to download them right now, we will do that when your MSYS environment is ready to compile these libraries and tools. * [http://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D NASM] Optional, for faster compile of scalers ** [http://www.nasm.us/pub/nasm/releasebuilds/2.10rc3/win32/nasm-2.10rc3-win32.zip nasm-2.10rc3-win32.zip (469kB)] * [http://www.libsdl.org/download-1.2.php SDL 1.2]. ** [http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz SDL-devel-1.2.14-mingw32.tar.gz (856kB)] * [http://tdm-gcc.tdragon.net/ TDM-GCC] GCC <4.4.0 because of a bug in g++: ** [http://prdownloads.sf.net/tdm-gcc/gcc-4.3.3-tdm-1-core.zip?download gcc-4.3.3-tdm-1-core.zip (5.3MB)] ** [http://prdownloads.sf.net/tdm-gcc/gcc-4.3.3-tdm-1-g++.zip?download gcc-4.3.3-tdm-1-g++.zip (6.0MB)] * [http://www.zlib.net/ zlib]. Optional, for compressed saved games. ** [http://prdownloads.sourceforge.net/libpng/zlib-1.2.5.tar.gz?download zlib-1.2.5.tar.gz (532kB)] * [http://downloads.xiph.org/releases/ogg/ libogg] and [http://downloads.xiph.org/releases/vorbis/ libvorbis] Optional, for OGG support ** [http://downloads.xiph.org/releases/ogg/libogg-1.2.2.zip libogg-1.2.2.zip (488kB)] ** [http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.zip libvorbis-1.3.2.zip (1.7MB)] * [ftp://ftp.mars.org/pub/mpeg/ libmad] Optional, for MP3 support ** [ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz libmad-0.15.1b.tar.gz (491kB)] ** [http://merkur.calypse.de/libmad-0.15.1b-optimize.diff Patch to remove a deprecated optimiziation flag not available in newer gcc] * [http://flac.sourceforge.net/download.html FLAC]. Optional, for FLAC support ** [http://prdownloads.sf.net/flac/flac-1.2.1.tar.gz?download flac-1.2.1.tar.gz (2.0MB)] ** [http://merkur.calypse.de/flac-1.2.1-mingw.diff Patch for MinGW] * [http://www.zlib.net/ zlib]. Optional, for compressed saved games. ** [http://prdownloads.sourceforge.net/libpng/zlib-1.2.5.tar.gz?download zlib-1.2.5.tar.gz (532kB)] * [http://libpng.org/pub/png/libpng.html libpng]. Optional, for Broken Sword 2.5-Engine. ** [http://prdownloads.sourceforge.net/libpng/libpng-1.4.5.tar.gz?download libpng-1.4.5.tar.gz (818kB)] * [http://downloads.xiph.org/releases/theora/ libtheora]. Optional, for Broken Sword 2.5-Engine. ** [http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz libtheora-1.1.1.tar.gz (2.0MB)] === Precompiled libraries === To ease the whole process, a package of all the needed precompiled libraries has been created. All you need to do is to download: ** [http://merkur.calypse.de/scummvm-required-libs-mingw.zip Precompiled libraries] After having installed MinGW with MSYS, the additional MSYS tools and a working version of gcc, you can unpack the precompiled libs into your MinGW-directory and then skip to compiling ScummVM directly. == Installing MinGW and MSYS == Both MinGW and MSYS need to be installed and working to compile ScummVM. * Launch the mingw-get-installer you have downloaded above. * To get the newest MinGW-components you can download the latest repository catalogues * Accept the license and select an installation directory - the default is recommended, since MinGW may have problems with spaces in directory names * Select the needed components: '''C++ Compiler''' and the '''MinGW Developer Toolkit''' (which will include MSYS) * Start installation and wait until everything is downloaded and in place. * If you see any download errors (blame SourceForge for that) just re-run the installer, it will download and install only the missing files. * Start the '''MinGW Shell''' in your Start Menu == MSYS primer == From the developer's webpage: "MSYS or Minimal SYStem is a POSIX and Bourne shell environment use with MinGW. It provides a hand picked set of tools to allow a typical configuration script with Bourne syntax to execute. This allows most of the GNU packages to create a Makefile just from executing the typical configure script which can then be used to build the package using the native MinGW version of GCC". For more information, check the [http://www.mingw.org/wiki/FAQ MinGW FAQ page] MSYS commands can be confusing for people using Windows, as MSYS emulates a Bourne shell environment, which is found in most Unix/Linux distributions. The available commands can be viewed by typing "help" in the command prompt. Help on a specific command is available by typing "help" followed by the command, e.g. "help alias". Note that MSYS uses forward slashes between folder names, not backward slashes, as is the case with Windows. Additionally, some special characters like the space need to be escaped with a backward slash("\"). Drives are mounted to folders, so drive "C:" would be under folder "/c". Therefore, to switch to directory: C:\Program Files\Test Folder we would switch to: /c/Program\ Files/Test\ Folder The basic commands you'll need are: cd - changes the current drive and directory pwd - shows the current drive and directory ls - lists files in a folder make - makefile, used to compile projects strip - remove debug information from executable files Note that if you wish to run a file from the current folder, you need to specify it before the file name, i.e. if you wish to run "test" from the current folder, you should type: ./test == Building the libraries == Now, we need to compile the required libraries and tools. === Additional MSYS tools === In order to download, unpack and patch the needed libraries and tools, we mingw-get the following: mingw-get install msys-wget mingw-get install msys-unzip mingw-get install msys-patch === NASM === NASM is used for optimized scaler implementations and possibly by some libraries below, so this should be the first to download and install. We just need '''nasm.exe''' and '''ndisasm.exe''' in a directory, found in the PATH-variable. For now, we'll use MinGW's bin-directory: wget http://www.nasm.us/pub/nasm/releasebuilds/2.10rc3/win32/nasm-2.10rc3-win32.zip unzip -j nasm-2.10rc3-win32.zip nasm-*/n*asm.exe -d /mingw/bin === SDL === SDL is already compiled, so we only need to unpack it and put the files in their corresponding places. You can safely ignore the warnings from tar, since we don't care about file ownership in this case. wget http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz tar xvfz SDL-devel-1.2.14-mingw32.tar.gz mkdir /mingw/include/SDL mv SDL-*/include/SDL/* /mingw/include/SDL mv SDL-*/lib/* /mingw/lib mv SDL-*/bin/* /mingw/bin rm -rf SDL-1* If you want to have a console window, when launching scummvm.exe (the old default), you have to modify sdl-config as follows: mv /mingw/bin/sdl-config /mingw/bin/sdl-config-org sed 's/-mwindows//g' /mingw/bin/sdl-config-org >/mingw/bin/sdl-config === gcc === Since MinGW's g++ starting with version 4.4.0 seems to be buggy ([http://forums.scummvm.org/viewtopic.php?t=9450]), you will need an older version of gcc and g++ (eg. 4.3.3 from [http://tdm-gcc.tdragon.net/ TDM-GCC]) until this bug is fixed: wget http://prdownloads.sf.net/tdm-gcc/gcc-4.3.3-tdm-1-core.zip?download wget http://prdownloads.sf.net/tdm-gcc/gcc-4.3.3-tdm-1-g++.zip?download unzip -o gcc-4.3.3-tdm-1-core.zip -d /mingw unzip -o gcc-4.3.3-tdm-1-g++.zip -d /mingw You can check the installed version with g++ --version Output should contain ''g++.exe (4.3.3-tdm-1 mingw32) 4.3.3'' === zlib === Issue these commands to download, compile and install the library: wget http://prdownloads.sourceforge.net/libpng/zlib-1.2.5.tar.gz?download tar xvfz zlib-1.2.5.tar.gz cd zlib-* make -f win32/Makefile.gcc BINARY_PATH=/mingw/bin INCLUDE_PATH=/mingw/include LIBRARY_PATH=/mingw/lib install cd .. === libogg === libogg should be compiled before libvorbis and libFLAC Issue these commands to download, compile and install the library: wget http://downloads.xiph.org/releases/ogg/libogg-1.2.2.zip unzip libogg-1.2.2.zip cd libogg-* ./configure --disable-shared make make install prefix=/mingw cd .. === libvorbis === Issue these commands to download, compile and install the library: wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.zip unzip libvorbis-1.3.2.zip cd libvorbis-* ./configure --disable-shared make make install prefix=/mingw cd .. === libmad === Issue these commands to download, patch (to remove a deprecated optimizitation flag not available in newer gcc), compile and install the library: wget ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz wget http://merkur.calypse.de/libmad-0.15.1b-optimize.diff tar xvfz libmad-0.15.1b.tar.gz patch -i libmad-0.15.1b-optimize.diff -p0 cd libmad-* ./configure --disable-shared make make install prefix=/mingw cd .. === FLAC === Issue these commands to download, patch (see [http://sourceforge.net/tracker/?func=detail&atid=313478&aid=1761712&group_id=13478], [http://lists.xiph.org/pipermail/flac-dev/2008-August/002569.html] and [http://theunknown.com.au/flac-main-cpp75-erreur-%E2%80%98memcmp%E2%80%99-was-not-declared-in-this-scope/]), compile and install the library: wget http://prdownloads.sf.net/flac/flac-1.2.1.tar.gz?download wget http://merkur.calypse.de/flac-1.2.1-mingw.diff tar xvfz flac-1.2.1.tar.gz patch -i flac-1.2.1-mingw.diff -p0 cd flac-* ./configure --disable-shared make make install prefix=/mingw cd .. === libpng === Issue these commands to download, compile and install the library: wget http://prdownloads.sourceforge.net/libpng/libpng-1.4.5.tar.gz?download tar xvfz libpng-1.4.5.tar.gz cd libpng-* mv INSTALL INSTALL.txt make -f scripts/makefile.mingw prefix=/mingw install cd .. === libtheora === Issue these commands to download, compile and install the library: wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz tar xvfz libtheora-1.1.1.tar.gz cd libtheora-* ./configure --disable-shared --disable-examples make make install prefix=/mingw cd .. == Compiling ScummVM == Get the latest sources ([http://prdownloads.sourceforge.net/scummvm/scummvm-1.2.1.tar.bz2?download Release 1.2.1] or [http://helllabs.org/scummvm/ Daily Source Snapshot]) and unpack them: tar xvfj scummvm-20110101.tar.bz2 cd scummvm-* Edit the configure-script to your liking, ie. what engines you want to use. To compile ScummVM, issue the following commands: ./configure --enable-release make After compilation, you'll end up with a very big scummvm.exe (around 16MB). This is because debug symbols and information are embedded by default in the exe file, making it very big. To remove all the unneeded debug information from the executable, thus reducing its size by about 12MB, go to the folder where the compiled scummvm.exe file is and run the following command: strip scummvm.exe == Ready to go! == OK this should be all of it (thankfully), so you should be good to go.