Jump to navigation Jump to search

Compiling ScummVM/Windows CE

1,854 bytes removed, 02:24, 5 December 2011
no edit summary
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 PocketScumm 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
projects, makefiles and editing appropriately the source files.<br/>
Still reading? Good :-)<br/>
Many people are put off by the sheer volume of work which has to take place
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 PocketScummScummVM for Windows CE.
Alright, ready? Let's go :-)
== Get your gear together ==
The first thing you need to do is decide on the compiler and grab all required
=== 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 can could use either [ evc3] or [ evc4] for those versions. Most of the following instructions for building with VS2005 adhere to these builds as well.* Version 0.9.x supports 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 [[Compiling_ScummVM/Windows_CE/Old_GCC|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. We try not to break builds * 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 can in no way be guaranteed as we do not longer use those tools. With some minor tweaking is beyond the code should be able to compile with VS tools tooscope of these instructions.
Why all these compiler changes? There are absolutely critical reasons for switching between them.
Also, note that [ Visual Studio Express] (which is free) does
not support Windows CE (at least at the time of writing this).
Further, the latest change from our semi-custom VLC GCC port to cegcc is was mandated because building dlls which are required by the plugins is broken in the former. Fortunately Finally we do not perceive any more compiler changes in the future. CEGCC is well maintained and even if it is have switched to mingw32ce, which does not updated in use the future (unix compatibility layer which seems unlikely) it is a darn good wince cross compiler cegcc brings along as we don't need it is :-).
=== Libraries ===
These are:
* [http://flacwss.sourceforgeco.netuk/ FLAC] 1.1.0: Lossless audio compression for sound files.* [http:pinknoise/tremolo/ mpeg2decTremolo] 0.4.07: Decoding Tremolo is an ARM optimized version of MPEG-2 video content.* the Tremor lib from []: Fixed point implementation of . For those that don't know, the OGG Tremor lib is an integer only library for doing Ogg Vorbis algorithm, also for sound filesdecompression.* [ mad] 0.1415.2b1b
: MP3 sound files.
* [ SDL] 1.2.6
: Handles all backend screen drawing.
* [ zlib] 1.2.15
: Compressing/Decompressing files.
[[user:Arisme|Arisme]] has and [[user:Jubanka|Knakos]] have done and 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]].
For Microsoft toolchain builds, you can find all of them on [ his webpage]both in source/patch form and as pre-built binaries.Usually, you don't need to rebuild these libraries so we recommend to usethe binaries.To relieve you even further from the hassle, we have prepared a precompiled lib/headerpack which is available [ here].This package contains all that is peripheral to ScummVM and is required for builds. For GCC toolchain buildsFurthermore, the libraries need to be further patched in orderto 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 for GCC builds as well andyou can find it right [ here].
Please note that many some of those libraries have been officially ported to WinCEafter 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 Microsoft tools == * Build libraries from sourceIf you downloaded prebuilt libraries, you may skip this step.We will not document the process of compiling individual libraries.Generally, you should download the source and patch from Arisme's site,perform the patch and use the included project files to build. * Place library files in appropriate places.You need two things: The library header files (*.h) and the actuallibraries (*.lib).There's no place in particular where it would be good to put these files.Just make sure that the VS compiler's ''additional include directories''option points additionally to the directory (-ies) where your libraryheader files live, and the linker's ''additional library directories''to the *.lib files directory (-ies).For ScummVM 0.9.1, the VS2005 files assume that the directories <tt>lib</tt>and <tt>libinclude</tt> are situated in <tt>backends/wince/missing</tt>. * Open the ProjectFor versions older than 0.9.1, project files can be found in directories <tt>dists/msevc3</tt> and <tt>dists/msevc4</tt> of the source tree.For 0.9.1 the project files are in <tt>dists/msvc8-wince</tt>.Open <tt>PocketScumm.vcw</tt> or <tt>PocketScumm.sln</tt>, whatever is applicable.In the workspace that opens you should be able to see several projects,the main one being the "scummvm" project and the others being thescummvm engines which are built as libraries.<br/>A common problem which occurs here stems from the requirementthat the project files '''have to''' be in ''CR/LF'' format, or elsethe tools will error out with various errors while opening them.(This unfortunately happens as tagging usually takes place ona non-Windows machine ( :-) ), plus some shortcomings of CVS.Hopefully SVN remedies this.)<br/>Another point to note is that evc4 can "import" evc3 project filesand VS2005 can import project files from both. * BuildPress F7 :-)<br/>This is not a fool proof procedure. You may get from zero fatal compilationerrors to several thousand.Please be patient and try to make sense of what the tool is reporting.More than often, the very first '''error''' the tool reports is theone you should attend to before re-trying the build.If you can't make heads or tails out of it, you may try asking for helpin the [ forums], but '''*please*''' refrain fromasking if you don't know what you're doing here.The developers cannot be burdened with the task of answering questionsfor your specific build setup; the community although may provide you with answers. == Compiling using the mingw32ce GCC toolchain ==
First, you need to download and install the [ cegccmingw32ce] cross compiler. More specifically, you need the mingw32 mingw32ce variety (without the posix layer emulation that is). The package You may optionally also includes 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 ===
* Build libraries from source
You may skip this step if you downloaded the prebuilt library package.
Download the original library source tarball (those in Arisme's site are OK).As an exception, get the Tremor snapshot from[ here]tarballs.Download the diffs 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 library and Tremolo libraries which sports both sport a customly created (and lame :-) )
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:
:* FLACmad:
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em"
|<tt>CFLAGS="-D__stdcall= -D_WIN32_WCE=300 -I/usr/local/wince/cross-tools/include" LDFLAGS=-L/usr/local/wince/cross-tools/lib CC=arm-wince-pe-gcc ./configure --host=arm-wince-pe mingw32ce --target=arm-wince-pe --without-ogg --without-xmms -without-libiconv --without-id3libmingw32ce</tt>
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em"
|<tt>CFLAGS="-D__stdcall= -D_OFF_T_ -I/usr/local/wince/cross-tools/include" LDFLAGS=-L/usr/local/wince/cross-tools/lib CC=arm-wince-pemingw32ce-gcc ./configure --hostAR=arm-wince-pe -mingw32ce-targetar RANLIB=arm-wincemingw32ce-pe --disable-nlsranlib ./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> *mpeg2decPlace the library and include files in an appropriate place. In this example, we use /opt/mingw32ce/librariesto 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"
|<tt>CFLAGS="<pre>mad: /path_to_patched_mad_sources/.libs/libmad.a -D__stdcall= > /opt/mingw32ce/libraries/lib /path_to_patched_mad_sources/mad.h -D_OFF_T_ > /opt/mingw32ce/libraries/include Tremolo: /path_to_patched_tremolo_sources/libtremolo.a -I> /opt/mingw32ce/usrlibraries/locallib /wincepath_to_patched_tremolo_sources/crossconfig_types.h -tools> /opt/mingw32ce/libraries/include" LDFLAGS=/tremolo /path_to_patched_tremolo_sources/ivorbiscodec.h -L> /usropt/localmingw32ce/wincelibraries/crossinclude/tremolo /path_to_patched_tremolo_sources/ivorbisfile.h -tools> /lib CC=armopt/mingw32ce/libraries/include/tremolo /path_to_patched_tremolo_sources/ogg.h -wince> /opt/mingw32ce/libraries/include/tremolo /path_to_patched_tremolo_sources/os_types.h -pe> /opt/mingw32ce/libraries/include/tremolo zlib: /path_to_zlib_sources/libz.a -gcc > /opt/mingw32ce/libraries/lib /path_to_zlib_sources/z*.h -> /opt/mingw32ce/libraries/configure include SDL: /path_to_patched_sdl_sources/libSDL.a -> /opt/mingw32ce/libraries/lib /path_to_patched_sdl_sources/include/* -host=arm-wince-pe --target=arm-wince-pe> /opt/mingw32ce/libraries/include/SDL/*</pre></tt>
:*Tremor:Build{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; Please note that it may be needed to change the line-height: 1.1em"|<tt>CFLAGS_host_alias="-D__stdcall= -D_OFF_T_ arm-I/usr/local/wince/cross-toolsmingw32ce</includett>" to " LDFLAGS=-L/usr/local/wince/cross-tools/lib CC<tt>_host_alias=arm-wince-pe-gcc ./ --host=arm-wince-pe --target=arm-wince-pemingw32ce</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"
|<tt>CFLAGS="-D__stdcall= <pre>mkdir build-D_OFF_T_ mingw32cecd build-D_WIN32_WCE -D_MSC_VERmingw32ceLDFLAGS=666" CC=arm-wince-pe-gcc ARL/opt/mingw32ce/libraries/lib" CXXFLAGS="arm-wince-peI/opt/mingw32ce/libraries/include -ar cru" RANLIB=arm-wince-pe-ranlib .I/configure --libdir=opt/usrmingw32ce/locallibraries/winceinclude/cross-toolsSDL" \../lib configure --includedirhost=/usr/local/wince</cross-tools/includepre></tt>
''Try <tt>make libz.a</tt> for libz. Also DrMcCoy reported that he had to include "<tt>typedef long _off_t; typedef _off_t off_t;</tt>" into <tt>unistd.h</tt>''
''WARNING: These instructions have been written with the VLC GCC compiler in mindOf 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. Exact command lines may differ slightly from these shown aboe''
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:
You may also have to do some minor manual edits to the config{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em"|<tt><pre>Checking for Tremor... yesChecking for MAD... yesChecking for zlib..h files.yes(''libmad's one springs to mindBackend... wince, savegame timestamp, in which you have to undefine HAVE_STDINT_H'')HQ scalers</pre></tt>|}
You just Finally do a <tt>make</tt> each library and after configuringa while you should have a nice and shiny <tt>scummvm.exe</tt>.The SDL library has no configuration script - you just It's additionally recommended to do an "<tt>makearm-mingw32ce-strip scummvm.exe</tt>" as the executable size is quite big (&gt; 85MB).
* Place library Copy the resulting <tt>scummvm.exe</tt> along with the following files in appropriate places.Take into a look at the Makefile to check out where the headers fresh folder on your device/emulator and libs are expectedgive it a go:{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em"Currently they need to be under |<tt>backends<pre>gui/platformthemes/wincescummclassic.zipgui/libsthemes/<scummmodern.zipgui/themes/translations.datdists/tt> in directoriespred.dic<tt>include<dists/tt> and <tt>lib<engine-data/tt>drascula.datAlso note that the Makefile expects the libraries to have somewhat more "funky" names than their defaultdists/engine-data/hugo.datThis has been done for compatibility reasons with the evc built libsdists/engine-data/kyra.datJust rename the libraries according to the Makefile, or edit the Makefile to match the default namingdists/engine-data/lure.datdists/engine-data/queen.tbl* Builddists/engine-data/sky.cptcd into <tt>backendsdists/platformengine-data/winceteenagent.datdists/<engine-data/tt>, edit the Makefile to your needs (usually you don't have to do this)toon. Finally type dat<tt/pre>make dist</tt>, irrespectively whether you have enabled a plugin build or not, which invokes the required build automatically.|}


Navigation menu