[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.6 OS/2

Written by Andrew Zabolotny, Andrew Zabolotny.

This section contains configuration, compilation, and installation instructions for the OS/2 port of Crystal Space, which was created, and is maintained by Andrew Zabolotny (bit@eltech.ru). Details of the internals of the OS/2 port are also available, 8.1.2 OS/2

Currently Crystal Space compiles under OS/2 only with GNU C/C++ compiler. Theoretically it can be done with VisualAge and Watcom compilers (almost) as well, but you will have to do it all yourself. Besides, currently assembler optimizations are available only for GNU C/C++ compiler (they uses GAS syntax) so most likely you anyway will want to use GCC. Also you may consider using Pentium-optimizing GCC (PGCC) instead of simple GCC which can be found at http://goof.com/pcg/os2. Also you need the EMX package; you need at least EMX tools (like `emximp'), include files and C libraries.

Crystal Space provides support for MMX instructions; GAS 2.6 which is shipped with as-of-today-latest EMX 0.9c does not; so you will need GAS 2.8.1 or later compiled for OS/2. You can find a pre-compiled binary on the above web page.

Also you will need GNU `make' (you should have it already if you're using GCC). You will also need GNU `sed' if you want to make dependency files (you can get Crystal Space up and running without them as well, but you will want them if you're going to make changes to source code). You also will need a Unix-like shell (for example, `bash') for this since `cmd.exe' locks up with long command lines (Crystal Space sometimes generates 1K and even more!) and redirection. You will need to use this shell only when building dependencies.

You will need a Resource Compiler (which is bundled with the OS/2 itself, during installation you should click the `Development tools' checkbox or so). Also it is available in OS/2 Toolkit.

OS/2 makefile allows both Unix-like shells and OS/2's standard `cmd.exe' to be used. By default it is configured for cmd.exe since it is faster. You can switch shells by changing the `SHELL=' line in `makefile.os2'.

You also will need IBM OS/2 Toolkit for DIVE headers. Theoretically it can be made with DIVE headers for EMX which can be found on several sites.

You will also require `zlib' (de/compression library), `pnglib' (if you're going to work with PNG files), and `libjpeg' (if you're going to use JPEG format). PNG and JPG support are optional, but highly recommended. See section 2.3 External Libraries.

Compiling the Libraries

You will need to pre-compile at least `zlib' prior to compiling Crystal Space itself. In the following I suppose you downloaded all three libraries; however if you didn't download `libjpeg' or `libpng' simply skip corresponding instructions.

Find and download (preferably latest) versions of `zlib', `pnglib' and `libjpeg'. Unpack them into the `CS/' subdirectory; usually they unpacks in a directory named something like `libjpeg-x.xx' or `zlib-x.xx' where `x.xx' is current version number. You should rename them to `CS/libs/zlib', `CS/libs/libjpeg' and `CS/libs/libpng' so that Crystal Space will find them. You should have a tree like:

The most recent `zlib' and `pnglib' already includes makefiles for compiling them under OS/2 with EMX/GCC; even if you got a library that does not, you can find all required makefiles in `CS/libs/cssys/os2'. There is a `README' file in each directory which will tell you what you should do; in short, for `zlib':

 
cd CS
xcopy /s libs\cssys\os2\zlib zlib
xcopy /s libs\cssys\os2\libpng libpng
xcopy /s libs\cssys\os2\libjpeg libjpeg

Now you should build each library:

 
cd zlib
make -f os2/makefile.os2 OMF=0
del *.o
make -f os2/makefile.os2 OMF=1

You should run `make' twice to build both `a.out' format libraries (OMF=0) and OMF libraries (OMF=1). You also should delete `.o' files between compilations since in any case makefiles builds `.o' (not `.obj') files; however the final library will have `.lib' or `.a' extension depending on format.

After compilation, you will have four copies of the `zlib' library, each in a different format, as summarized by this table.

z.dll Dynamic library.
z.a Static library in `a.out' format.
zdll.a Dynamic import library in `a.out' format.
z.lib Static library in OMF format.
zdll.lib Dynamic import library in OMF format.

You can leave libraries in their place; you only will need to copy (or move) `z.dll' into a directory somewhere on your `LIBPATH' if you're going to use dynamic version of `zlib'. Also you can (but you aren't required to) copy (or move) `.lib' and `.a' files into a directory on your `LIBRARY_PATH' (say `f:/emx/lib') if you're going to use them in other projects too (or to avoid recompiling zlib upon receiving of future Crystal Space updates).

Similarly:

 
cd libpng
make -f makefile.os2 OMF=0
del *.o
make -f makefile.os2 OMF=1

cd libjpeg
make -f os2/makefile.os2 OMF=0
del *.o
make -f os2/makefile.os2 OMF=1


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html