Xming/Building

Building HowTo

Requirements

Build tools

You will need at least binutils, gcc, make, flex, bison and the system libraries

If you want to do cross compiling the required packages are

$ ln -sf /usr/bin/i586-mingw32msvc-windres /usr/i586-mingw32msvc/bin/windres
$ ln -sf /usr/bin/i586-mingw32msvc-cc /usr/i586-mingw32msvc/bin/cc
$ ln -sf /usr/bin/i586-mingw32msvc-gcc /usr/i586-mingw32msvc/bin/gcc

/usr/bin/gcc -mno-cygwin "$@"

pthreads-win32

Get the sources from ftp://sources.redhat.com/pub/pthreads-win32/pthreads-w32-2-6-0-release.tar.gz.

For cross compiling you'll need a patch from http://sources.redhat.com/ml/pthreads-win32/2005/msg00091.html too.

$ tar xvzf pthreads-w32-2-6-0-release.tar.gz
$ cd pthreads-w32-2-6-0-release
$ patch -p1 < ../pthreads-w32-2-6-0-release.patch

Build libraries. Only the dynamic library (dll) works so far.

$ make clean GC

Debian:

$ make CC=i586-mingw32msvc-gcc \
       RC=i586-mingw32msvc-windres \
       RANLIB=i586-mingw32msvc-ranlib \
       DLLTOOL=i586-mingw32msvc-dlltool \
       clean GC

Cygwin:

$ make CC=i686-pc-mingw32-gcc \
       RC=i686-pc-mingw32-windres \
       RANLIB=i686-pc-mingw32-ranlib \
       DLLTOOL=i686-pc-mingw32-dlltool \
       clean GC

Copy the resulting library and headers to the system locations

$ cp sched.h semaphore.h pthread.h /usr/include
$ cp libpthreadGC2.a /usr/lib
$ cp pthreadGC2.dll /usr/bin
$ ln -sf libpthreadGC2.a /usr/lib/libpthreadGC.a

Cygwin:

$ cp sched.h semaphore.h pthread.h /usr/i686-pc-mingw32/include
$ cp libpthreadGC2.a /usr/i686-pc-mingw32/lib
$ cp pthreadGC2.dll /usr/i686-pc-mingw32/bin
$ ln -sf libpthreadGC2.a /usr/i686-pc-mingw32/lib/libpthreadGC.a

Debian:

$ cp sched.h semaphore.h pthread.h /usr/i586-mingw32msvc/include
$ cp libpthreadGC2.a /usr/i586-mingw32msvc/lib
$ cp pthreadGC2.dll /usr/i586-mingw32msvc/bin
$ ln -sf libpthreadGC2.a /usr/i586-mingw32msvc/lib/libpthreadGC.a

Get Xming source

$ cvs -d :pserver:anoncvs@cvs.freedesktop.org:/cvs/xorg login
CVS password: <hit return>
$ cvs -d :pserver:anoncvs@cvs.freedesktop.org:/cvs/xorg co -P xc

Compiling

I'm not sure if native compiling works. In theory you'll need a working MinGW or MSYS environment.

Start compiling:

$ cd xc
$ make World

Since I've not setup MinGW I can't tell you if this works. But cross compiling from Cygwin or Linux does work. Check the next section about it.

Cross Compiling

Cygwin:

$ cd xc
$ make World CROSSCOMPILEDIR=/usr/i686-pc-mingw32/bin 

Debian:

$ cd xc
$ make World CROSSCOMPILEDIR=/usr/i586-mingw32msvc/bin