Jump to content

Porting from Unix platforms: Difference between revisions

From EDM2
Ydario (talk | contribs)
Ydario (talk | contribs)
Line 35: Line 35:


For an advanced enviroment, you need also:
For an advanced enviroment, you need also:
*Automake
*GNU Automake
*Autoconf
*GNU Autoconf
*GNU M4 command processor


For using Innotek gcc (recommended), get also:
For using Innotek gcc (recommended), get also:

Revision as of 13:39, 20 November 2004

Introduction

This article will cover the basic steps for porting programs written for the Unix platform.

Only command line program will be covered, since porting the X window interface is a second step. If you are working on a GUI program, consider using the EverBlue Project or the WxWidgets (formerly WxWindows) project. Remind that the steps described here, probably still apply to your project.

System requirements

The most common enviroment used for porting Unix programs, is the EMX/GCC compiler&tools. It is based on gcc 2.8.1 and provides most of the required tools.

A new enviroment actually coming up, is the Innotek gcc compiler, based on gcc 3.2.2 for libc 0.5 level, on gcc 3.3.5 for the libc 0.6 release (currently in alpha test, soon in beta test). This is an enviroment currently in developement, but I consider it the preferrable way for starting.

To create an EMX basic enviroment you need to download the following files:

For an advanced enviroment, you need also:

  • GNU Automake
  • GNU Autoconf
  • GNU M4 command processor

For using Innotek gcc (recommended), get also:

Get the above packages and install following the included instructions. I will add a scheme here sometimes. Since you can use GNU utilities with different enviroments, I suggest to put EMX core files into a different directory tree. So you can use the utilities and other tools with Innotek gcc without too much trouble.

Getting the source code

First step is to get the program source code. I can't tell you where to find it, but SourgeForge is a good place for starting :-)

Usually source code comes as a 'tarball': that means all files are packed into a single file with tar (extension .tar) and most of the times also compressed (extension .tar.gz).

Untar the tarball with 'tar xzf place_here_my_tar.gz' and you will get all the sources extracted into a subdirectory (usually a tar file doesn't write files to the current directory).

If someone worked on the same program in the past, you can review the old work and use the old patches with your version. Keep in mind that old patches cannot always be applied to current source code, so a manual review is better in such cases.

Configuring the scripts

Since Unix is not a single platform, but has a wide range of choices (like Linux, various *BSD, Solaris, AIX, ...), most unix programs are coming with a so-called 'configure' script. This is a shell script that must be run to recognize the current system configuration, so the correct compiler switches, libraries path and tools will be used.

The configure script is usually a very long script, and it takes really long to execute. When this script is created from recent autoconf releases (2.57 and later), it will work under OS/2 with minor (or nothing at all) modifications.

Compiling the code

Running tests

Installing the binaries

Submitting patch file