Version 11 (modified by jeremyhu@…, 6 years ago) (diff)

--

Developer Info

Background

Starting with Leopard (Mac OS-X 10.5), the version of X11 shipped with Apple's OS has been based on X11 as distributed from X.org. The shipping version of X11 with Leopard was based on X.org's modular X11R7.2 release. In fact, most components of X11 can be easily built directly from X.org's distributed tarballs.

Helping Out

If you'd like to help out with development, please join the xquartz-dev mailing list. Patches are greatly appreciated. Please send them in a format that can be easily applied with patch. You can do this with 'diff -Naurp <original source tree> <new source tree>' or by using git-diff.

Package Installation

Dependencies

The latest releases of xserver require updates to other X11 packages to compile. Running ./configure should cause an error if you are missing any of these dependencies. These requirements are included in the latest binary package from our releases page. It is recommended that you install the latest binary package before rebuilding any of its components.

In addition to X11 dependencies, you will need to install pkg-config which is available through MacPorts or Fink.

xserver

To recompile xserver (which provides Xquartz, X11.app, Xephyr, Xfake, Xnest, and Xvfb), you will need to download Mesa3D (1.2 branch: 6.5.2, 1.4 branch: 7.0.3, 1.5 branch: git master) as well as the xserver tarball from our releases page. Then you can compile them as follows:

tar jxvf MesaLib-7.0.3.tar.bz2
tar jxvf xserver-<version>.tar.bz2
cd xorg-server-<version>

export ACLOCAL="aclocal -I /usr/X11/share/aclocal"
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

export CFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"
export LDFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"

./configure --prefix=/usr/X11 --mandir=/usr/X11/man --with-mesa-source=`pwd`/../Mesa-7.0.3 --disable-dependency-tracking
make
sudo make install

To build and install Xvfb, Xnest, Xephyr, and Xfake instead of Xquartz/X11.app, you will need to add the following options to configure. Note that it is currently not possible to build these components at the same time as Xquartz due to how we currently start the Xquartz server (see dix/main.c and look for the #ifdef XQUARTZ). A solution to this is currently being sought.

--disable-xquartz --enable-xvfb --enable-xnest --enable-kdrive

Other X.org Packages

Most upstream packages (other than xserver) can be rebuilt and reinstalled if necessary (new versions, etc) by a means common to moth UNIX developers:

tar xjf <package>-<version>.tar.bz2
cd <package>-<version>

export PKG_CONFIG_PATH="/usr/X11/lib/pkgconfig:${PKG_CONFIG_PATH}"
export ACLOCAL="aclocal -I /usr/X11/share/aclocal"

export CFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"
export LDFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"

./configure --prefix=/usr/X11 --mandir=/usr/X11/man --disable-dependency-tracking
make
sudo make install

Some packages require special configure options or CFLAGS, but there are few in this category, and they are being fixed. To see what configure options, versions, or extra patches were used in Apple's official releases, check out Apple's Open-Source Repository for 10.5.

Git

All of our development is done using the Git version control system.

Using Git

Initial setup

1) Clone the repository and create local branches to track changes made in the master repository:

git-clone ssh://git.freedesktop.org/git/xorg/xserver.git # If you have commit access
   or 
git-clone git://anongit.freedesktop.org/git/xorg/xserver.git # If you don't
cd xserver
git-branch --track xorg-server-1.2-apple origin/xorg-server-1.2-apple
git-branch --track xorg-server-1.4-apple origin/xorg-server-1.4-apple
git-branch --track xorg-server-1.5-apple origin/xorg-server-1.5-apple
# add more git-branch commands for other branches you wish to track:
git-branch --track server-1.3-branch origin/server-1.3-branch
git-branch --track server-1.4-branch origin/server-1.4-branch
git-branch --track server-1.5-branch origin/server-1.5-branch

2) Switch to the branch you wish to develop on:

git-checkout -f xorg-server-1.4-apple

3) You can then compile and install the server as described in the directions above. You will just need to use './autogen.sh' instead of './configure' the first time you configure the server. Note that you will need Mesa3D-6.5.2 for xorg-server-1.2-apple and a newer versions for 1.4 (7.0.2 or later should work fine).

Local Changes

During your development, you'll reach a point where you want to commit changes to git. First, you must commit these changes to your local branch:

git-commit -a

These changes are stored locally and you can use git-diff to prune out specific change sets (to be emailed to xquartz-dev for example).

Remote Changes

You will need to pull in changes from the master repository (this is like cvs/svn update). If you have made local changes, you need to be careful to do a git-fetch and git-rebase and NOT git-pull. As a safety precaution, you should just forget that git-pull even exists. git-rebase causes your local changes to be backed out then re-applied after upstream changes. If any conflicts arise, you can use git-mergetool to resolve them.

git-fetch
git-rebase origin/xorg-server-1.4-apple # or whatever branch you're working on

I use a series of aliases to help with this fetching/rebaseing. Just executing 'gifrb' fetches all updates and rebases all my branches:

alias gi12='git-checkout xorg-server-1.2-apple'
alias gi13m='git-checkout server-1.3-branch'
alias gi14='git-checkout xorg-server-1.4-apple'
alias gi14m='git-checkout server-1.4-branch'
alias gi15='git-checkout xorg-server-1.5-apple'
alias gi15m='git-checkout server-1.5-branch'
alias gim='git-checkout master'
alias girb12='git-rebase origin/xorg-server-1.2-apple'
alias girb13m='git-rebase origin/server-1.3-branch'
alias girb14='git-rebase origin/xorg-server-1.4-apple'
alias girb14m='git-rebase origin/server-1.4-branch'
alias girb15='git-rebase origin/xorg-server-1.5-apple'
alias girb15m='git-rebase origin/server-1.5-branch'
alias girbm='git-rebase origin/master'
alias gifrb='git-fetch && gi12 && girb12 && gi13m && girb13m && gi14m && girb14m && gi14 && girb14 && gi15m && girb15m && gi15 && girb15 && gim && girbm'

Submitting Changes

If you have commit access to git.freedesktop.org, you can push your commits into the master repository by doing a git-push (make sure you git-fetch and git-rebase first).

git-fetch
git-rebase origin/xorg-server-1.4-apple
git-push

If you do not have commit access to git.freedesktop.org, you can submit patches of your changes to the xquartz-dev mailing list. See git-diff below for help on generating the patches.

git-diff

git-diff is VERY helpful. It can be used to see changes between branches or different states in a single branch. It can report the differences for the entire tree (default) or just a specific sub-directory or file. The main use of it is:

git-diff <start commit-ish> <end commit-ish> [<file or dir>]

Here are some examples:

git-log reports the following:

commit 8a079be0dd0f2ce37868988cde4ac8895522b088
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Thu Nov 29 02:19:22 2007 -0800

    Darwin: #ifdefs around dix-config.h include and NDEBUG/assert.h workaround.
    (cherry picked from commit d2b768890f0878ae4e3fec8f7219e82b79256133)

commit 38397560612424b5b348f34c1a0bea8c47a574be
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Wed Nov 28 23:07:41 2007 -0800

    Darwin: Removed support for darwinSwapAltMeta
    (cherry picked from commit 3d153c8fa40986d194b7701f5eafa0080e32399a)

If I want to generate a patch for the 'Darwin: #ifdefs around dix-config.h...' changes, I would do the following:

git-diff 38397560612424b5b348f34c1a0bea8c47a574be 8a079be0dd0f2ce37868988cde4ac8895522b088

If I want to see how the file 'darwin.c' changed between the xorg-server-1.2-apple and xorg-server-1.4-apple branches, I would do the following:

git-diff xorg-server-1.2-apple xorg-server-1.4-apple darwin.c

Branch Status

This summarizes the status of our components in the xserver git repository. This means mainly miext/rootless, GL/apple, and hw/darwin.

xorg-server-1.2-apple

This branch is based off of the server-1.3 branch (which itself is based off of the server-1.2 branch) with changes specific for Xquartz. It is the branch for our current releases.

xorg-server-1.4-apple

This branch is based off of the server-1.4 branch with changes specific for Xquartz. We will hopefully be moving to this code base for releases in the near future (May/June 2008).

The main changes from 1.2-apple to 1.4-apple include:

  • event handling code updates
  • safer multi-threading (less chance of lockups or data corruption)
  • transition to xkb
  • addition of tablet support

xorg-server-1.5-apple

The Xquartz specific code in 1.5 is almost identical to what is in 1.4. Unfortunately, some changes outside our code have caused some breakage. Currently, the X server is not accepting incoming connections.

master

Master hasn't diverged too much from the 1.5 branch, yet. So its status is pretty much the same as 1.5