Open main menu

Difference between revisions of "Compiling ScummVM/Windows CE"

updated instructions for the new cegcc compiler in the trunk
(WIP save)
(updated instructions for the new cegcc compiler in the trunk)
Line 88: Line 88:
you can find it right [http://users.uoa.gr/~knakos/scummvm/libraries/wince-gcc-libs.tar.bz2 here].
you can find it right [http://users.uoa.gr/~knakos/scummvm/libraries/wince-gcc-libs.tar.bz2 here].


Please note that many of those libraries have been officially ported to winCE
Please note that many 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 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.
Line 145: Line 145:
== Compiling using the GCC toolchain ==
== Compiling using the GCC toolchain ==


The VLC port of GCC requires some prep work before it's ready for action.
First, you need to download and install the [http://cegcc.sf.net/ cegcc] cross compiler. More specifically, you need the mingw32 variety (without the posix layer emulation that is). The package also includes a working gdb debugger for debugging the applications.
There are two major problems with it:
It does not honor the <tt>#pragma pack()</tt> directive and there is a store layout bug for packed structs.
Hence, it needs to be rebuilt.
As a welcome aside though, the procedure described in the following subsections can be applied to linux
or cygwin based environment.
This means that the cross compiler can be installed onto a Windows ([http://www.cygwin.org Cygwin])
machine as well.
 
''It has been reported that the packages needed for Cygwin are: gcc, make, sed, bison, flex, texinfo, patch, cvs, gettext, gettext-devel, perl, svn. Also some CR/LF conversion may be needed by utilities such as dos2unix and unix2dos.''
 
=== Cross compiler ===
 
The build process is carried out in two steps, first the binutils and then the gcc cross compiler.
Begin by designating a directory where all source downloads and build will take place.
 
(''Note:'' the patches by the VLC guys target specific GCC/binutils versions.
We'll rebuild those exact versions as they are good enough for the time being.)
 
==== Binutils ====
 
Checkout the binutils source, as described in the [http://www.gnu.org/software/binutils/ GNU Binutils]
page but designating a revision date as well:
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
{enter "anoncvs" as the password}
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co -D 20050514 binutils
CD into the root of the source tree and patch with the three
[http://download.videolan.org/pub/testing/wince/patches/ VLC binutils patches] (may patch with a little fuzz).
Configure the build:
./configure --target=arm-wince-pe --prefix=PREFIX_TO_CROSS_COMPILER
(PREFIX_TO_CROSS_COMPILER is the path where the cross compiler will be installed.
In linux it is: <tt>/usr/local/wince/cross-tools</tt>)
 
Make and make install. You may need to manually run ranlib on some generated libs
during making.
 
==== GCC ====
 
Checkout the [http://gcc.gnu.org/ GCC] source:
svn -q checkout -r {20050511} svn://gcc.gnu.org/svn/gcc/trunk gcc
(Note the date. It does not match the date in the VLC patches. Also, later revisions
contain severe bugs)
 
Now come the patches.
:* First apply the VLC [http://download.videolan.org/pub/testing/wince/patches/ GCC patch] (maybe a little fuzz here as well).
:* Then, patch <tt>gcc/stor-layout.c</tt> with the patch described [http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01115.html here].
:* Finally, in <tt>gcc/config/arm/arm.h</tt>, stick the following define somewhere (before the architecture define is OK):
#define HANDLE_PRAGMA_PACK_PUSH_POP
In the root of the GCC source tree, make a directory called <tt>wince</tt>.
CD into it and create a file called <tt>build.sh</tt> with the following stuff (substitute PREFIX_TO_CROSS_COMPILER), and run it:<br>
{| style="padding: 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em"
|<tt>export PATH=PREFIX_TO_CROSS_COMPILER/bin:$PATH</tt><br>
<tt>../configure --with-gcc --with-gnu-ld --with-gnu-as --target=arm-wince-pe --prefix=PREFIX_TO_CROSS_COMPILER --disable-threads --disable-nls --enable-languages=c++ --disable-win32-registry --disable-interwork --disable-multilib</tt><br>
<tt>make install</tt>
|}
 
==== Finish up ====
 
We need to copy over some stuff from the full GCC tarball.
Get [http://download.videolan.org/pub/testing/wince/wince-arm-gcc4.0.0-cvs-linux-crosscompiler-20050517.tar.bz2 the binary tarball] and unpack it somewhere.
:* Copy recursively all of <tt>usr/local/wince/cross-tools/include/</tt> into your <tt>PREFIX_TO_CROSS_COMPILER/include</tt>.
:* Copy all of the libs in <tt>usr/local/wince/cross-tools/lib</tt> into your <tt>PREFIX_TO_CROSS_COMPILER/lib</tt> (except libiberty.a).
:* CD into your <tt>PREFIX_TO_CROSS_COMPILER/arm-wince-pe/lib</tt> and make the following two symbolic links:
ln -s ../../lib/corelibc.lib crt0.o
ln -s ../../lib/coredll.lib c.lib
Done :-)
 
(''Note:'' In linux, it is much easier to get the binary tarball, extract it into the root of the filesystem, and then build
the binutils and GCC replacing essentially the offending files (C++ compiler etc). This final step in this case is not be required)


=== ScummVM ===
=== ScummVM ===
''Assuming you have installed the toolchain in its default place''
Here is the procedure for building ScummVM:
 
This is the procedure for building ScummVM, provided the compiler is patched as described above:


* Build libraries from source
* Build libraries from source
Line 256: Line 186:
|}
|}
''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>''
''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 mind. Exact command lines may differ slightly from these shown aboe''




Line 273: Line 204:


* Build
* Build
cd into <tt>backends/platform/wince/</tt>, edit the Makefile supplying the prefix to you arm-wince-gcc installation at the <tt>wince_gcc_root</tt> variable (the <tt>PREFIX_TO_CROSS_COMPILER</tt> mentioned above). Finally type <tt>make dist</tt>.
cd into <tt>backends/platform/wince/</tt>, edit the Makefile to your needs (usually you don't have to do this). Finally type <tt>make dist</tt> if you have edited the Makefile for a non-plugin build, <tt>make dist-plugins</tt> for the plugin case, or more simply <tt>make all</tt> which invokes the required build automatically.
116

edits