4,400
edits
No edit summary |
m (Robot: Cosmetic changes) |
||
Line 7: | Line 7: | ||
FlightGear to the mingw32 (win32 APIs only, no cygwin.dll, etc...) | FlightGear to the mingw32 (win32 APIs only, no cygwin.dll, etc...) | ||
target, *not* how to compile it using the [[MSYS]] command line | target, *not* how to compile it using the [[MSYS]] command line | ||
environment. | environment. I presume the user already has either a working linux | ||
box or cygwin installation.) | box or cygwin installation.) | ||
---- | ---- | ||
First you need to build the MinGW cross compiler tools. | First you need to build the MinGW cross compiler tools. (Cygwin users | ||
can skip this section and simply install the MinGW environment from | can skip this section and simply install the MinGW environment from | ||
the setup tool) | the setup tool) I used the source distributions available from the GNU | ||
project instead of the MinGW trees, because the MinGW ones failed to | project instead of the MinGW trees, because the MinGW ones failed to | ||
build in linux. | build in linux. Either should work under Cygwin. | ||
I am assuming that your cross compiler tools are going to live in a | I am assuming that your cross compiler tools are going to live in a | ||
directory named "/mingw" Change this as appropriate. | directory named "/mingw" Change this as appropriate. | ||
Remember to put /mingw/bin on your path. | Remember to put /mingw/bin on your path. Some of the configure | ||
scripts notice the --prefix setting and pick the right binaries up by | scripts notice the --prefix setting and pick the right binaries up by | ||
default, but others do not, and end up defaulting to the native | default, but others do not, and end up defaulting to the native | ||
Line 37: | Line 37: | ||
Now you need the MinGW C runtime and Win32 libraries and headers, | Now you need the MinGW C runtime and Win32 libraries and headers, | ||
because the compiler cannot build without them (this sounds like a bug | because the compiler cannot build without them (this sounds like a bug | ||
to me...) | to me...) Download them from the mingw.org site and unpack them into | ||
the /mingw/mingw32 directory. | the /mingw/mingw32 directory. | ||
Line 44: | Line 44: | ||
tar xfz //w32api-2.5.tar.gz | tar xfz //w32api-2.5.tar.gz | ||
Now it is time to build gcc (3.3.3 in my case). | Now it is time to build gcc (3.3.3 in my case). This works just like | ||
the binutils step: | the binutils step: | ||
Line 54: | Line 54: | ||
Pick a destination path for your FlightGear installation; I am using | Pick a destination path for your FlightGear installation; I am using | ||
"/fg" here for brevity. | "/fg" here for brevity. You will need to specify this with a | ||
"--prefix=/fg" argument to all configure scripts. | "--prefix=/fg" argument to all configure scripts. Don't forget. | ||
For "native" builds many people use the /usr/local default, but for | For "native" builds many people use the /usr/local default, but for | ||
Line 69: | Line 69: | ||
You will want to install "SDK" headers and libraries for OpenAL, SDL, | You will want to install "SDK" headers and libraries for OpenAL, SDL, | ||
pthread, and zlib. | pthread, and zlib. The goal here is to get header files, lib*.a | ||
static libraries, and (if needed) runtime DLLs for them installed to | static libraries, and (if needed) runtime DLLs for them installed to | ||
the appropriate place: the *.a libraries go in /fg/lib, DLLs in | the appropriate place: the *.a libraries go in /fg/lib, DLLs in | ||
Line 82: | Line 82: | ||
The zlib library (source is packaged with SimGear) has a rather | The zlib library (source is packaged with SimGear) has a rather | ||
primitive non-standard configure script that simply doesn't work for | primitive non-standard configure script that simply doesn't work for | ||
building with a cross compiler or outside a Unix-like environment. | building with a cross compiler or outside a Unix-like environment. I | ||
built it (just three files: libz.a, zlib.h, zconf.h) by hand. | built it (just three files: libz.a, zlib.h, zconf.h) by hand. It | ||
''may'' be possible to use the zlib implementation that ships with | ''may'' be possible to use the zlib implementation that ships with | ||
cygwin with a MinGW build; whether it works or not depends on whether | cygwin with a MinGW build; whether it works or not depends on whether | ||
Line 89: | Line 89: | ||
SDL has a nicely packaged mingw32 development tarball on their website | SDL has a nicely packaged mingw32 development tarball on their website | ||
(www.libsdl.org). | (www.libsdl.org). You can simply unpack this under /fg if you like. | ||
My version eliminates some of the unnecessary files and is somewhat | My version eliminates some of the unnecessary files and is somewhat | ||
smaller, but is otherwise unchanged. | smaller, but is otherwise unchanged. | ||
The Win32 pthread library (http://sources.redhat.com/pthreads-win32) | The Win32 pthread library (http://sources.redhat.com/pthreads-win32) | ||
also distributes pre-compiled libraries. | also distributes pre-compiled libraries. Unfortunately, you will have | ||
to rename them before using them. | to rename them before using them. They also ship a broken header (no | ||
joke) which fails when compiled in an autoconf environment where | joke) which fails when compiled in an autoconf environment where | ||
HAVE_CONFIG_H is defined. | HAVE_CONFIG_H is defined. My version fixes these problems, but is | ||
otherwise the same library. | otherwise the same library. | ||
OpenAL is the hardest to get working. | OpenAL is the hardest to get working. First, you really want to | ||
install the binary package via the Creative installer (follow link | install the binary package via the Creative installer (follow link | ||
from www.openal.org) in order to take advantage of binary-only vendor | from www.openal.org) in order to take advantage of binary-only vendor | ||
extensions from Creative and NVidia. | extensions from Creative and NVidia. Second, the SDK is MSVC-only, | ||
with no MinGW/Cygwin import libraries and (sigh) no meaningful | with no MinGW/Cygwin import libraries and (sigh) no meaningful | ||
directory structure. | directory structure. I generated libalut.a and libopenal32.a import | ||
libraries by hand from the MSVC .lib files. | libraries by hand from the MSVC .lib files. Unless you want to help | ||
out the OpenAL project by generating a Cygwin/MinGW build environment | out the OpenAL project by generating a Cygwin/MinGW build environment | ||
for them, you'll probably want to use my pre-packaged version. | for them, you'll probably want to use my pre-packaged version. | ||
Line 112: | Line 112: | ||
Note that the openal32.dll file is *not* dumped in the /fg/bin | Note that the openal32.dll file is *not* dumped in the /fg/bin | ||
directory; it is intended to be a system-wide library installed by the | directory; it is intended to be a system-wide library installed by the | ||
Creative installer. | Creative installer. Also note that the alut.dll library is a separate | ||
library, not part of openal32.dll. | library, not part of openal32.dll. | ||
So to make a long story short, I put a tarball of "SDK" tarballs up at | So to make a long story short, I put a tarball of "SDK" tarballs up at | ||
http://plausible.org/andy/fgfs-mingw-libs.tar.gz for folks to use. | http://plausible.org/andy/fgfs-mingw-libs.tar.gz for folks to use. In | ||
side are four tar files (openal, pthread, sdl, zlib). | side are four tar files (openal, pthread, sdl, zlib). Simply unpack | ||
each one you need in the /fg directory. | each one you need in the /fg directory. | ||
---- | ---- | ||
Now you are ready to compile. | Now you are ready to compile. This part works exactly as you are used | ||
to. | to. Note that it is important to specify --host (the target platform) | ||
and --build (the platform on which you are compiling) in order to get | and --build (the platform on which you are compiling) in order to get | ||
the configure script into "cross compilation" mode. | the configure script into "cross compilation" mode. If you specify | ||
only host, it tries to guess and sometimes gets it wrong (simple .exe | only host, it tries to guess and sometimes gets it wrong (simple .exe | ||
files work on Linux when wine is installed!). | files work on Linux when wine is installed!). Cygwin users should of | ||
course replace the build host with "i386-cygwin". | course replace the build host with "i386-cygwin". | ||
Line 144: | Line 144: | ||
FlightGear: | FlightGear: | ||
Note here that we can only build in the src directory. | Note here that we can only build in the src directory. The auxilliary | ||
directories tend to be POSIX-only and are not (automatically) | directories tend to be POSIX-only and are not (automatically) | ||
compilable at the moment. | compilable at the moment. | ||
Line 159: | Line 159: | ||
cd /fg/bin | cd /fg/bin | ||
mingw32-strip *.exe | mingw32-strip *.exe | ||
[[Category:Software]] | [[Category:Software]] | ||
[[Category: Howto]] | [[Category:Howto]] |