Difference between revisions of "Compiling ScummVM/Windows CE"
m (→Libraries) |
|||
Line 1: | Line 1: | ||
So you want to roll your own binary for the ScummVM [[Windows CE]] port? | So you want to roll your own binary for the ScummVM [[Windows CE]] port? | ||
The first thing to ask yourself is do you really need to compile it? | The first thing to ask yourself is do you really need to compile it? | ||
The official | The official ScummVM for Windows CE binaries are "good enough" for more than the average user. | ||
Also, bear in mind that the compilation procedure is seldom as simple as | Also, bear in mind that the compilation procedure is seldom as simple as | ||
unpack-build and that, probably, you'll have to know your way around | unpack-build and that, probably, you'll have to know your way around | ||
makefiles and editing appropriately the source files.<br/> | |||
Still reading? Good :-)<br/> | Still reading? Good :-)<br/> | ||
Many people are put off by the sheer volume of work which has to take place | Many people are put off by the sheer volume of work which has to take place | ||
Line 10: | Line 10: | ||
Things are not that bad though as, hopefully, this document tries to describe. | Things are not that bad though as, hopefully, this document tries to describe. | ||
More than often you may find that once you set up you build environment | More than often you may find that once you set up you build environment | ||
right, there's only minimal work to be done to build any version of | right, there's only minimal work to be done to build any version of ScummVM for Windows CE. | ||
Alright, ready? Let's go :-) | Alright, ready? Let's go :-) | ||
== Get your gear together == | == Get your gear together == | ||
=== Compilers === | === Compilers === | ||
Over the years, the compiler used to build ScummVM WinCE has changed several times. The following lists which version requires which compiler(s): | Over the years, the compiler used to build ScummVM WinCE has changed several times. The following lists which version requires which compiler(s): | ||
* Versions '''before''' 0.9.0 use the Microsoft Embedded Visual C development environment. More specifically you | * Versions '''before''' 0.9.0 use the Microsoft Embedded Visual C development environment. More specifically you could use either [http://www.microsoft.com/downloads/details.aspx?familyid=f663bf48-31ee-4cbe-aac5-0affd5fb27dd&displaylang=en evc3] or [http://www.microsoft.com/downloads/details.aspx?familyid=4a4ed1f4-91d3-4dbe-986e-a812984318e5&displaylang=en evc4] for those versions. | ||
* Version 0.9.x | * Version 0.9.x supported two ways to compile: | ||
** Using [http://msdn.microsoft.com/windowsmobile/downloads/tools/install/default.aspx Microsoft Visual Studio 2005], or | ** Using [http://msdn.microsoft.com/windowsmobile/downloads/tools/install/default.aspx Microsoft Visual Studio 2005], or | ||
** Using the [http://download.videolan.org/pub/testing/wince/ Windows CE GCC cross compiler] developed by the [http://www.videolan.org/vlc/ VLC] team ('''do not''' rush to download and install this compiler. It needs to be rebuilt first. More on this [[Compiling_ScummVM/Windows_CE/Old_GCC|on this page]]). | ** Using the [http://download.videolan.org/pub/testing/wince/ Windows CE GCC cross compiler] developed by the [http://www.videolan.org/vlc/ VLC] team ('''do not''' rush to download and install this compiler. It needs to be rebuilt first. More on this [[Compiling_ScummVM/Windows_CE/Old_GCC|on this page]]). | ||
* Version 0.10.x builds with the VLC GCC cross compiler. | * Version 0.10.x builds with the VLC GCC cross compiler. | ||
* Version 0.11.x and newer use the [http://cegcc.sf.net/ cegcc] GCC cross compiler. | * Version 0.11.x and newer use the [http://cegcc.sf.net/ cegcc] GCC cross compiler. | ||
* Version 1.0 and newer use the [http://cegcc.sf.net/ mingw32ce] GCC cross compiler. This is only compiler being supported now. You may succeed in compiling with VS2005, but this is beyond the scope of these instructions. | |||
Why all these compiler changes? There are absolutely critical reasons for switching between them. | Why all these compiler changes? There are absolutely critical reasons for switching between them. | ||
Line 38: | Line 36: | ||
Also, note that [http://msdn.microsoft.com/vstudio/express/ Visual Studio Express] (which is free) does | Also, note that [http://msdn.microsoft.com/vstudio/express/ Visual Studio Express] (which is free) does | ||
not support Windows CE (at least at the time of writing this). | not support Windows CE (at least at the time of writing this). | ||
Further, the | Further, the change from our semi-custom VLC GCC port to cegcc was mandated because building dlls which are required by the plugins is broken in the former. Finally we have switched to mingw32ce, which does not use the unix compatibility layer which cegcc brings along as we don't need it. | ||
=== Libraries === | === Libraries === | ||
Line 45: | Line 43: | ||
These are: | These are: | ||
* [http:// | * [http://wss.co.uk/pinknoise/tremolo/ Tremolo] 0.7 | ||
: Tremolo is an ARM optimized version of the Tremor lib from [http://www.xiph.org/ xiph.org]. For those that don't know, the Tremor lib is an integer only library for doing Ogg Vorbis decompression. | |||
* [http://www.underbit.com/products/mad/ mad] 0.15.1b | |||
: | |||
* [http://www.underbit.com/products/mad/ mad] 0. | |||
: MP3 sound files. | : MP3 sound files. | ||
* [http://www.libsdl.org/ SDL] 1.2.6 | * [http://www.libsdl.org/ SDL] 1.2.6 | ||
: Handles all backend screen drawing. | : Handles all backend screen drawing. | ||
* [http://www.zlib.net/ zlib] 1.2. | * [http://www.zlib.net/ zlib] 1.2.5 | ||
: Compressing/Decompressing files. | : Compressing/Decompressing files. | ||
[[user:Arisme|Arisme]] | [[user:Arisme|Arisme]] and [[user:Jubanka|Knakos]] have done an excellent job in porting all these libraries to Windows CE, along the process of porting ScummVM itself. Lately, this job is being done by [[user:CeRiAl|CeRiAl]]. | ||
along the process of porting ScummVM itself. | |||
Furthermore, the libraries need to be patched in order to successfully compile. | |||
The patches are available [http://pocketinsanity.org/scummvm/libraries/ here] and are '''accumulated'''. | |||
to successfully compile. | |||
The patches are available [http:// | |||
This means that are direct patches to the original source versions of the libraries, | This means that are direct patches to the original source versions of the libraries, | ||
that they include Arisme's patches and are ''not'' incremental to them. | that they include Arisme's, Knakos' and CeRiAl's patches and are ''not'' incremental to them. | ||
A precompiled lib/header pack is available | A precompiled lib/header pack is available as well and | ||
you can find it right [http:// | you can find it right [http://pocketinsanity.org/scummvm/libraries/release-1-5-0/wince-gcc-libs.tar.bz2 here]. | ||
Please note that | Please note that some of those libraries have been officially ported to WinCE | ||
after the work done by Arisme or, newer versions are available for them. | after the work done by Arisme/Knakos/CeRiAl or, newer versions are available for them. | ||
We generally cannot comment on how well they will work with ScummVM. | We generally cannot comment on how well they will work with ScummVM. | ||
The more adventurous of you may want to give them a shot, but we find | The more adventurous of you may want to give them a shot, but we find | ||
that these work well enough for our purposes. | that these work well enough for our purposes. | ||
== Compiling using the mingw32ce GCC toolchain == | |||
== Compiling using the GCC toolchain == | |||
First, you need to download and install the [http://cegcc.sf.net/ | First, you need to download and install the [http://cegcc.sf.net/ mingw32ce] cross compiler. More specifically, you need the mingw32ce variety (without the posix layer emulation that is). You may optionally also download a working gdb debugger there for debugging the applications. Version 0.59.1 is the recommended version, your milage may vary with other versions. It's also recommended, though not mandatory, to install the toolchain to /opt/mingw32ce (in the following example we use this directory). | ||
=== ScummVM === | === ScummVM === | ||
Line 141: | Line 76: | ||
* Build libraries from source | * Build libraries from source | ||
You may skip this step if you downloaded the prebuilt library package. | You may skip this step if you downloaded the prebuilt library package. | ||
Download the original library source | Download the original library source tarballs. | ||
Download the patches from [http://pocketinsanity.org/scummvm/libraries/ here] and patch the libraries. | |||
Please note that there is no patch available for zlib 1.2.5 as patching it is not needed any more (yay!). | |||
Download the | |||
You need to ''configure'' and ''make'' each library, | You need to ''configure'' and ''make'' each library, | ||
except the SDL | except for the SDL and Tremolo libraries which both sport a customly created (and lame :-) ) | ||
Makefile. | Makefile. | ||
It should be sufficient to set the PATH to the following to make the toolchain usable: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | |||
|<tt>export PATH=/opt/mingw32ce/bin:$PATH</tt> | |||
|} | |||
Here are the typical parameters to the configure scripts: | Here are the typical parameters to the configure scripts: | ||
* mad: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | {| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | ||
|<tt> | |<tt>./configure --host=arm-mingw32ce --target=arm-mingw32ce</tt> | ||
|} | |} | ||
* libz: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | {| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | ||
|<tt> | |<tt>CC=arm-mingw32ce-gcc AR=arm-mingw32ce-ar RANLIB=arm-mingw32ce-ranlib ./configure</tt> | ||
|} | |} | ||
You just <tt>make</tt> each library after configuring.<br/> | |||
The SDL and Tremolo libraries have no configuration script - you just <tt>make</tt> | |||
* Place the library and include files in an appropriate place. In this example, we use /opt/mingw32ce/libraries | |||
to keep them seperate from the toolchain's libs and headers. | |||
Here is an overview of the needed files, where to find them inside the specific library sourcetree, and where to put them: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | {| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | ||
|<tt> | |<tt><pre>mad: | ||
/path_to_patched_mad_sources/.libs/libmad.a -> /opt/mingw32ce/libraries/lib | |||
/path_to_patched_mad_sources/mad.h -> /opt/mingw32ce/libraries/include | |||
Tremolo: | |||
/path_to_patched_tremolo_sources/libtremolo.a -> /opt/mingw32ce/libraries/lib | |||
/path_to_patched_tremolo_sources/config_types.h -> /opt/mingw32ce/libraries/include/tremolo | |||
/path_to_patched_tremolo_sources/ivorbiscodec.h -> /opt/mingw32ce/libraries/include/tremolo | |||
/path_to_patched_tremolo_sources/ivorbisfile.h -> /opt/mingw32ce/libraries/include/tremolo | |||
/path_to_patched_tremolo_sources/ogg.h -> /opt/mingw32ce/libraries/include/tremolo | |||
/path_to_patched_tremolo_sources/os_types.h -> /opt/mingw32ce/libraries/include/tremolo | |||
zlib: | |||
/path_to_zlib_sources/libz.a -> /opt/mingw32ce/libraries/lib | |||
/path_to_zlib_sources/z*.h -> /opt/mingw32ce/libraries/include | |||
SDL: | |||
/path_to_patched_sdl_sources/libSDL.a -> /opt/mingw32ce/libraries/lib | |||
/path_to_patched_sdl_sources/include/* -> /opt/mingw32ce/libraries/include/SDL/*</pre></tt> | |||
|} | |} | ||
* Build | |||
Please note that it may be needed to change the line "<tt>_host_alias=arm-wince-mingw32ce</tt>" to "<tt>_host_alias=arm-mingw32ce</tt>" in the ScummVM configure script if the compiler is not found. | |||
For ScummVM we recommend a so called "out of source tree" build, so change to the ScummVM source directory and create a directory for that and run the configure script as following: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | {| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | ||
|<tt> | |<tt><pre>mkdir build-mingw32ce | ||
cd build-mingw32ce | |||
LDFLAGS="-L/opt/mingw32ce/libraries/lib" CXXFLAGS="-I/opt/mingw32ce/libraries/include -I/opt/mingw32ce/libraries/include/SDL" \ | |||
../configure --host=wince</pre></tt> | |||
|} | |} | ||
Of course you may use additional configuration switches like "<tt>--enable-release</tt>" or "<tt>--enable-engine(s)=xxx/--disable--engine(s)=yyy</tt>" as you like. | |||
The libraries should now be automatically be detected by the configuration script, check the output for the following lines; if they're present everything should be ok: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | |||
|<tt><pre>Checking for Tremor... yes | |||
Checking for MAD... yes | |||
Checking for zlib... yes | |||
Backend... wince, savegame timestamp, HQ scalers</pre></tt> | |||
|} | |||
Finally do a <tt>make</tt> and after a while you should have a nice and shiny <tt>scummvm.exe</tt>. | |||
It's additionally recommended to do an "<tt>arm-mingw32ce-strip scummvm.exe</tt>" as the executable size is quite big (> 85MB). | |||
Copy the resulting <tt>scummvm.exe</tt> along with the following files into a fresh folder on your device/emulator and give it a go: | |||
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em" | |||
|<tt><pre>gui/themes/scummclassic.zip | |||
gui/themes/scummmodern.zip | |||
gui/themes/translations.dat | |||
dists/pred.dic | |||
dists/engine-data/drascula.dat | |||
dists/engine-data/hugo.dat | |||
dists/engine-data/kyra.dat | |||
dists/engine-data/lure.dat | |||
dists/engine-data/queen.tbl | |||
dists/engine-data/sky.cpt | |||
dists/engine-data/teenagent.dat | |||
dists/engine-data/toon.dat</pre></tt> | |||
|} |
Revision as of 00:24, 5 December 2011
So you want to roll your own binary for the ScummVM Windows CE port?
The first thing to ask yourself is do you really need to compile it?
The official ScummVM for Windows CE binaries are "good enough" for more than the average user.
Also, bear in mind that the compilation procedure is seldom as simple as
unpack-build and that, probably, you'll have to know your way around
makefiles and editing appropriately the source files.
Still reading? Good :-)
Many people are put off by the sheer volume of work which has to take place
in order to get a successful build.
Things are not that bad though as, hopefully, this document tries to describe.
More than often you may find that once you set up you build environment
right, there's only minimal work to be done to build any version of ScummVM for Windows CE.
Alright, ready? Let's go :-)
Get your gear together
Compilers
Over the years, the compiler used to build ScummVM WinCE has changed several times. The following lists which version requires which compiler(s):
- Versions before 0.9.0 use the Microsoft Embedded Visual C development environment. More specifically you could use either evc3 or evc4 for those versions.
- Version 0.9.x supported two ways to compile:
- Using Microsoft Visual Studio 2005, or
- Using the Windows CE GCC cross compiler developed by the VLC team (do not rush to download and install this compiler. It needs to be rebuilt first. More on this on this page).
- Version 0.10.x builds with the VLC GCC cross compiler.
- Version 0.11.x and newer use the cegcc GCC cross compiler.
- Version 1.0 and newer use the mingw32ce GCC cross compiler. This is only compiler being supported now. You may succeed in compiling with VS2005, but this is beyond the scope of these instructions.
Why all these compiler changes? There are absolutely critical reasons for switching between them. For example, the migration from evc to VS is mandatory, as C++ templates introduced through core code evolution in the trunk of ScummVM cause the evc compilers to crash with 'Internal compiler error'. Unfortunately the migration is not completely successful as VS2005 (no service packs) introduces incorrect optimization in release builds, leading to workarounds in the source and compilation of specific files with no optimizations at all. Also, note that Visual Studio Express (which is free) does not support Windows CE (at least at the time of writing this). Further, the change from our semi-custom VLC GCC port to cegcc was mandated because building dlls which are required by the plugins is broken in the former. Finally we have switched to mingw32ce, which does not use the unix compatibility layer which cegcc brings along as we don't need it.
Libraries
ScummVM depends on quite a few external libraries to handle content. These are:
- Tremolo 0.7
- Tremolo is an ARM optimized version of the Tremor lib from xiph.org. For those that don't know, the Tremor lib is an integer only library for doing Ogg Vorbis decompression.
- mad 0.15.1b
- MP3 sound files.
- SDL 1.2.6
- Handles all backend screen drawing.
- zlib 1.2.5
- Compressing/Decompressing files.
Arisme and Knakos have done an excellent job in porting all these libraries to Windows CE, along the process of porting ScummVM itself. Lately, this job is being done by CeRiAl.
Furthermore, the libraries need to be patched in order to successfully compile. The patches are available here and are accumulated. This means that are direct patches to the original source versions of the libraries, that they include Arisme's, Knakos' and CeRiAl's patches and are not incremental to them. A precompiled lib/header pack is available as well and you can find it right here.
Please note that some of those libraries have been officially ported to WinCE after the work done by Arisme/Knakos/CeRiAl or, newer versions are available for them. We generally cannot comment on how well they will work with ScummVM. The more adventurous of you may want to give them a shot, but we find that these work well enough for our purposes.
Compiling using the mingw32ce GCC toolchain
First, you need to download and install the mingw32ce cross compiler. More specifically, you need the mingw32ce variety (without the posix layer emulation that is). You may optionally also download a working gdb debugger there for debugging the applications. Version 0.59.1 is the recommended version, your milage may vary with other versions. It's also recommended, though not mandatory, to install the toolchain to /opt/mingw32ce (in the following example we use this directory).
ScummVM
Here is the procedure for building ScummVM:
- Build libraries from source
You may skip this step if you downloaded the prebuilt library package. Download the original library source tarballs. Download the patches from here and patch the libraries. Please note that there is no patch available for zlib 1.2.5 as patching it is not needed any more (yay!). You need to configure and make each library, except for the SDL and Tremolo libraries which both sport a customly created (and lame :-) ) Makefile. It should be sufficient to set the PATH to the following to make the toolchain usable:
export PATH=/opt/mingw32ce/bin:$PATH |
Here are the typical parameters to the configure scripts:
- mad:
./configure --host=arm-mingw32ce --target=arm-mingw32ce |
- libz:
CC=arm-mingw32ce-gcc AR=arm-mingw32ce-ar RANLIB=arm-mingw32ce-ranlib ./configure |
You just make each library after configuring.
The SDL and Tremolo libraries have no configuration script - you just make
- Place the library and include files in an appropriate place. In this example, we use /opt/mingw32ce/libraries
to keep them seperate from the toolchain's libs and headers. Here is an overview of the needed files, where to find them inside the specific library sourcetree, and where to put them:
mad: /path_to_patched_mad_sources/.libs/libmad.a -> /opt/mingw32ce/libraries/lib /path_to_patched_mad_sources/mad.h -> /opt/mingw32ce/libraries/include Tremolo: /path_to_patched_tremolo_sources/libtremolo.a -> /opt/mingw32ce/libraries/lib /path_to_patched_tremolo_sources/config_types.h -> /opt/mingw32ce/libraries/include/tremolo /path_to_patched_tremolo_sources/ivorbiscodec.h -> /opt/mingw32ce/libraries/include/tremolo /path_to_patched_tremolo_sources/ivorbisfile.h -> /opt/mingw32ce/libraries/include/tremolo /path_to_patched_tremolo_sources/ogg.h -> /opt/mingw32ce/libraries/include/tremolo /path_to_patched_tremolo_sources/os_types.h -> /opt/mingw32ce/libraries/include/tremolo zlib: /path_to_zlib_sources/libz.a -> /opt/mingw32ce/libraries/lib /path_to_zlib_sources/z*.h -> /opt/mingw32ce/libraries/include SDL: /path_to_patched_sdl_sources/libSDL.a -> /opt/mingw32ce/libraries/lib /path_to_patched_sdl_sources/include/* -> /opt/mingw32ce/libraries/include/SDL/* |
- Build
Please note that it may be needed to change the line "_host_alias=arm-wince-mingw32ce" to "_host_alias=arm-mingw32ce" in the ScummVM configure script if the compiler is not found. For ScummVM we recommend a so called "out of source tree" build, so change to the ScummVM source directory and create a directory for that and run the configure script as following:
mkdir build-mingw32ce cd build-mingw32ce LDFLAGS="-L/opt/mingw32ce/libraries/lib" CXXFLAGS="-I/opt/mingw32ce/libraries/include -I/opt/mingw32ce/libraries/include/SDL" \ ../configure --host=wince |
Of course you may use additional configuration switches like "--enable-release" or "--enable-engine(s)=xxx/--disable--engine(s)=yyy" as you like.
The libraries should now be automatically be detected by the configuration script, check the output for the following lines; if they're present everything should be ok:
Checking for Tremor... yes Checking for MAD... yes Checking for zlib... yes Backend... wince, savegame timestamp, HQ scalers |
Finally do a make and after a while you should have a nice and shiny scummvm.exe. It's additionally recommended to do an "arm-mingw32ce-strip scummvm.exe" as the executable size is quite big (> 85MB).
Copy the resulting scummvm.exe along with the following files into a fresh folder on your device/emulator and give it a go:
gui/themes/scummclassic.zip gui/themes/scummmodern.zip gui/themes/translations.dat dists/pred.dic dists/engine-data/drascula.dat dists/engine-data/hugo.dat dists/engine-data/kyra.dat dists/engine-data/lure.dat dists/engine-data/queen.tbl dists/engine-data/sky.cpt dists/engine-data/teenagent.dat dists/engine-data/toon.dat |