Native Compiling

Compiling the Source Code

Compiling Cygwin/X doesn't have to be hard, although the X Window System source code tree is reasonably large. There are a few simple techniques that make building the source code, keeping the source code up to date, and keeping the source code organized much easier.

Required Packages for Compiling

Many developer libraries and developer tools are required to build Cygwin/X. Several packages are required in addition to the default packages installed by the Cygwin installer. Following is a list of additional packages that are required to compile Cygwin/X natively in Cygwin. Note that some of these packages are meta packages that will automatically cause several other packages to be selected for installation; do not unselect any of these automatically selected packages.

  • autoconf

  • automake

  • binutils

  • bzip2

  • diffutils

  • fileutils

  • findutils

  • flex

  • gawk

  • gcc

  • git

  • make

  • patch

  • sed

  • tar

  • zlib

Standard Build

Follow these steps to create a standard, non-debug, build:

  1. Change the current directory to your X Window System development directory:

    
Username@CygwinHost ~
    $ cd x-devel
    
    Username@CygwinHost ~/xserver
    $ ./configure --prefix=/usr
    [lots of output]
    $ make
    [lots more output]
    
    

    Standard build is now complete.

    Note: XXX: Add figures for normal diskspace occupied by source, additional diskspace occupied by build, and a benchmark time for the build to complete

    XXX: Describe configure option for specifying a builddir

Debug Build

Follow these steps to create a build with debugging information:

  1. Change the current directory to your X Window System development directory:

    
Username@CygwinHost ~
    $ cd x-devel
    
    Username@CygwinHost ~/xserver
    $ ./configure --prefix=/usr --enable-debug CFLAGS="-g -O0"
    [lots of output]
    $ make
    [lots more 
    

    Debug build is now complete.

Running a local build

Follow these steps to run the built X server:

  1. Change the current directory to your X Window System development directory:

    
Username@CygwinHost ~
    $ cd xserver
    Username@CygwinHost ~/xserver
    $
    
  2. Invoke the hw/xwin/Xwin executable:

    
Username@CygwinHost ~/xserver
    $ hw/xwin/XWin
    

    The X server you have built will now attempt to run.

Installing a local build

Installing a local build enables you to verify that a build of the entire source tree is operational. It is wise to verify the operation of full builds of the source tree from time to time, as full builds will occasionally be broken by changes that other developers are making to the X Window System source code tree.

Installing a local build on top of an existing build is not a good idea, as this can mask problems that occurred during the build process, or it can cause problems that are unrelated to the build process; either situation is undesirable. It is generally a good idea to move your old installation out of the way before installing a local build, and these instructions will assume that you desire to do so. Follow the instructions below to install a local build:

  1. Change the current directory to your desired X Window System build directory:

    
Username@CygwinHost ~
    $ cd ~/xserver/build/build-prefix
    
    Username@CygwinHost ~/xserver/build/build-prefix
    $ 
    
  2. Make the install target, which installs everything:

    
Username@CygwinHost ~/xserver/build/build-prefix
    $ make install
    
    Username@CygwinHost ~/xserver/build/build-prefix
    $ 
    

Keeping your source code tree updated

git makes keeping your source code tree up to date easy. Consult the git documentation for details.