Compiling Cygwin/X doesn't have to be hard, although the X Window System source code tree contains over 250 MiB of data. 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.
Compiling the X Window System source code tree is a lot easier when you keep your builds in directories separate from the source code directory. Keeping the source code and builds in separate directories, using the lndir utility, allows you to have many builds for different configurations, allows you to easily delete a build, and keeps the source code tree clean and manageable.
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.
binutils
bison
byacc
bzip2
cvs
diffutils
expat
fileutils
findutils
flex
gawk
gcc
libfontconfig-devel
libfreetype2-devel
libncurses-devel
make
patch
pcre
pcre-devel
perl
sed
tar
termcap
terminfo
zlib
The lndir utility allows you to keep your build directories separate from your source directory; lndir works just like the standard ln command on UNIX, but lndir creates links recursively for all files and directories in the specified directory. The lndir utility is included with the X Window System source code tree and you can build lndir seperately before you build the whole source code tree. Follow the simple instructions below to build and install the utility:
Launch a Cygwin bash prompt. You should see a screen similar to the following:
Username@CygwinHost ~ $ |
Change the current directory to your X Window System development directory:
Username@CygwinHost ~ $ cd x-devel Username@CygwinHost ~/x-devel $ |
Change the current directory to config/util/ in the root of the X Window System source code tree, xc/:
Username@CygwinHost ~/x-devel $ cd xc/config/util Username@CygwinHost ~/x-devel/xc/config/util $ |
Build lndir:
Username@CygwinHost ~/x-devel/xc/config/util $ make -f Makefile.ini CC=gcc CDEBUGFLAGS=-O2 lndir Username@CygwinHost ~/x-devel/xc/config/util $ |
Move lndir.exe to /bin:
Username@CygwinHost ~/x-devel/xc/config/util $ mv lndir.exe /bin Username@CygwinHost ~/x-devel/xc/config/util $ |
Verify that lndir is working:
Username@CygwinHost ~/x-devel/xc/config/util $ lndir usage: lndir [-silent] [-ignorelinks] fromdir [todir] Username@CygwinHost ~/x-devel/xc/config/util $ |
The lndir utility is now installed.
Follow these steps to create a standard, non-debug, build:
Change the current directory to your X Window System development directory:
Username@CygwinHost ~ $ cd x-devel Username@CygwinHost ~/x-devel $ |
Create a directory to house your builds, ~/x-devel/build is recommended:
Username@CygwinHost ~/x-devel $ mkdir build Username@CygwinHost ~/x-devel $ |
Change the current directory to your build directory:
Username@CygwinHost ~/x-devel $ cd build Username@CygwinHost ~/x-devel/build $ |
Create a directory for your standard build, std is recommended:
Username@CygwinHost ~/x-devel/build $ mkdir std Username@CygwinHost ~/x-devel/build $ |
Change the current directory to your standard build directory:
Username@CygwinHost ~/x-devel/build $ cd std Username@CygwinHost ~/x-devel/build/std $ |
Create symlinks to your source tree, using lndir, in your standard build directory:
Note: As of 2001-09-19, creating symlinks to the source tree creates 11,678 files in 1,524 folders, which is only 2.31 MiB of data, but requires 45.6 MiB of storage space on a file system using 4 KiB allocation units.
Username@CygwinHost ~/x-devel/build/std $ lndir ../../xc ../../xc/config: ../../../xc/config/cf: ... Username@CygwinHost ~/x-devel/build/std $ |
Alternatively, you can redirect the output of lndir to /dev/null, which greatly speeds up the process of creating symlinks:
Username@CygwinHost ~/x-devel/build/std $ lndir ../../xc > /dev/null Username@CygwinHost ~/x-devel/build/std $ |
Run a standard build of the entire tree, which takes between 30 minutes and 5 hours, saving the output of the build commands to World.log:
Note: As of 2001-09-19, a standard build of the entire tree requires 234 MiB of storage space on a file system using 4 KiB allocation units; that is in addition to the 45.6 MiB of previously generated symlinks.
As a benchmark, a standard build runs for 30 minutes on a machine with a 1.2 GHz Atlhon, 256 MiB DDR RAM, and a 7200 RPM ATA/100 HD.
Username@CygwinHost ~/x-devel/build/std $ make World > World.log 2>&1 Username@CygwinHost ~/x-devel/build/std $ |
Standard build is now complete.
Follow these steps to create a build with debugging information:
Change the current directory to your X Window System development directory:
Username@CygwinHost ~ $ cd x-devel Username@CygwinHost ~/x-devel $ |
If you have not already done so, create a directory to house your builds, ~/x-devel/build is recommended:
Username@CygwinHost ~/x-devel $ mkdir build Username@CygwinHost ~/x-devel $ |
Change the current directory to your build directory:
Username@CygwinHost ~/x-devel $ cd build Username@CygwinHost ~/x-devel/build $ |
Create a directory for your debug build, debug is recommended:
Username@CygwinHost ~/x-devel/build $ mkdir debug Username@CygwinHost ~/x-devel/build $ |
Change the current directory to your debug build directory:
Username@CygwinHost ~/x-devel/build $ cd debug Username@CygwinHost ~/x-devel/build/debug $ |
Create links to your source tree, using lndir, in your debug build directory:
Note: As of 2001-09-19, creating symlinks to the source tree creates 11,678 files in 1,524 folders, which is only 2.31 MiB of data, but requires 45.6 MiB of storage space on a file system using 4 KiB allocation units.
Username@CygwinHost ~/x-devel/build/debug $ lndir ../../xc ../../xc/config: ../../../xc/config/cf: ... Username@CygwinHost ~/x-devel/build/debug $ |
Alternatively, you can redirect the output of lndir to /dev/null, which greatly speeds up the process of creating symlinks:
Username@CygwinHost ~/x-devel/build/debug $ lndir ../../xc > /dev/null Username@CygwinHost ~/x-devel/build/debug $ |
Run a debug build of the entire tree, which takes between 30 minutes and 5 hours, saving the output of the build commands to World.log:
Note: As of 2001-06-12, a debug build of the entire tree requires 566.5 MiB of storage space on a file system using 4 KiB allocation units; that is in addition to the 45.6 MiB of previously generated symlinks.
As a benchmark, a debug build runs for 71 minutes on a machine with a 1.2 GHz Atlhon, 256 MiB DDR RAM, and a 7200 RPM ATA/100 HD. You may have noticed that the standard build time and the debug build time are identical.
Username@CygwinHost ~/x-devel/build/debug $ ./config/util/makeg.sh World > World.log 2>&1 Username@CygwinHost ~/x-devel/build/debug $ |
Debug build is now complete.
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:
Move the /etc/X11 directory to /etc/X11_build-prefix_date_time:
Username@CygwinHost ~ $ mv /etc/X11 /etc/X11_build-prefix_date_time Username@CygwinHost ~ $ |
Move the /usr/X11R6 directory to /usr/X11R6_build-prefix_date_time:
Username@CygwinHost ~ $ mv /usr/X11R6 /usr/X11R6_build-prefix_date_time Username@CygwinHost ~ $ |
Change the current directory to your desired X Window System build directory:
Username@CygwinHost ~ $ cd ~/x-devel/build/build-prefix Username@CygwinHost ~/x-devel/build/build-prefix $ |
Make the install target, which installs binaries, fonts, libraries, and configuration files; in short, install installs everything except the man pages:
Note: As of 2001-06-12, the install target copies 5,074 files in 83 folders into /usr/X11R6, requiring 89.2 MiB of storage space for a standard build or 177 MiB of storage space for a debug build, and 276 files in 39 folders into /etc/X11, requiring 2.57 MiB of storage space. All stated storage requirements are for a file system using 4 KiB allocation units.
As a benchmark, install runs for 20 minutes on a machine with a 1.2 GHz Atlhon, 256 MiB DDR RAM, and a 7200 RPM ATA/100 HD. Standard and debug installs both complete in the stated time.
Username@CygwinHost ~/x-devel/build/build-prefix $ make install > install.log 2>&1 Username@CygwinHost ~/x-devel/build/build-prefix $ |
Make the install.man target, which only installs the man pages:
Note: As of 2001-06-12, the install.man target copies 541 files in 3 folders into /usr/X11R6/man, requiring 4.22 MiB of storage space, and 544 files in 1 folder into /usr/X11R6/lib/X11/doc, requiring 4.76 MiB of storage space. All stated storage requirements are for a file system using 4 KiB allocation units.
As a benchmark, install.man runs for 2 minutes on a machine with a 1.2 GHz Atlhon, 256 MiB DDR RAM, and a 7200 RPM ATA/100 HD.
Username@CygwinHost ~/x-devel/build/build-prefix $ make install.man > install.man.log 2>&1 Username@CygwinHost ~/x-devel/build/build-prefix $ |
CVS makes keeping your source code tree up to date easy. You may update your entire source code tree at once, or you can update individual directories or files, if you so choose.
Change the current directory to your X Window System development directory:
Username@CygwinHost ~ $ cd x-devel Username@CygwinHost ~/x-devel $ |
Change the current directory to the root of the X Window System source code tree, xc/:
Username@CygwinHost ~/x-devel $ cd xc Username@CygwinHost ~/x-devel/xc $ |
To update your entire X Window System source code tree, run the following command:
Tip: The -zn parameter specifies the compression level to use, from 1 to 9, with 9 being maximum compression.
The -d parameter instructs cvs to rebuild the directory list, which causes new directories in the source code tree to be downloaded (new directories are skipped if you do not specify -d).
Username@CygwinHost ~/x-devel/xc $ cvs -z4 update -d > cvs-update.log 2>&1 Username@CygwinHost ~/x-devel/xc $ |
Search cvs-update.log for any lines containing conflict. Examine each line that contains conflict; resolve those lines that are true conflicts. grep will not display any information if no line in cvs-update.log contains conflict.
Username@CygwinHost ~/x-devel/xc $ grep conflict cvs-update.log Username@CygwinHost ~/x-devel/xc $ |
Change the current directory to your X Window System development directory:
Username@CygwinHost ~ $ cd x-devel Username@CygwinHost ~/x-devel $ |
Change the current directory to the directory that contains the file you wish to update, or change the current directory to the directory that you wish to update:
Username@CygwinHost ~/x-devel $ cd xc/directory_to_update Username@CygwinHost ~/x-devel/xc/directory_to_update $ |
To update a single file, or a set of specified files, run the following command:
Tip: The -zn parameter specifies the compression level to use, from 1 to 9, with 9 being maximum compression.
Username@CygwinHost ~/x-devel/xc/directory_to_update $ cvs -z4 update filename_1 [filename_2 ...] Username@CygwinHost ~/x-devel/xc/directory_to_update $ |
To update a single directory, and its subdirectories, run the following command:
Note: The -zn parameter specifies the compression level to use, from 1 to 9, with 9 being maximum compression.
The -d parameter instructs cvs to rebuild the directory list, which causes new directories in the source code tree to be downloaded (new directories are skipped if you do not specify -d).
Username@CygwinHost ~/x-devel/xc/directory_to_update $ cvs -z4 update -d Username@CygwinHost ~/x-devel/xc/directory_to_update $ |