Version 21 (modified by jeremyhu@…, 5 years ago) (diff)

updated branch status

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.

You should setup an account at macosforge.org, so you can submit and comment in bugs. Click on the link in the upper right corner of this page.

If you are planning on doing substantial work for Xquartz, you should get git commit access. You will need a freedesktop.org account to do that.

Package Installation

Building and Installing

For simple, verified, step-by-step instructions for building and installing XQuartz, see the Build Instructions page. They can be a good starting place for setting up your development environment.

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.

pkg-config

In addition to X11 dependencies, you will need to install pkg-config.

curl -LO http://pkg-config.freedesktop.org/releases/pkg-config-0.23.tar.gz
tar -xzf pkg-config-0.23.tar.gz
cd pkg-config-0.23
./configure && make && sudo make install

MacPorts, Fink, Gentoo Conflicts

You may encounter some problems if you have Fink, MacPorts, Gentoo, NetBSD Pkgsrc, or another package system in your environment. Before compilation, try sourcing a script like this:

export PKG_CONFIG="/usr/local/bin/pkg-config"

strip_finkmp() {
        local OIFS=$IFS
        local d
        IFS=:
        for d in ${@} ; do
                if [[ "${d}" == "${d#/opt/local}" && "${d}" == "${d#/sw}" && "${d}" == "${d#/opt/gentoo}" ]] ; then
                        echo -n "${d}:"
                fi
        done
        echo
        IFS=$OIFS
}

export PATH="/usr/X11/bin:$(strip_finkmp ${PATH})"
export CPLUS_INCLUDE_PATH="/usr/X11/include:$(strip_finkmp ${CPLUS_INCLUDE_PATH})"
export C_INCLUDE_PATH="/usr/X11/include:$(strip_finkmp ${C_INCLUDE_PATH})"
export OBJC_INCLUDE_PATH="/usr/X11/include:$(strip_finkmp ${OBJC_INCLUDE_PATH})"
export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig:$(strip_finkmp ${PKG_CONFIG_PATH})"

export ACLOCAL="aclocal -I /usr/X11/share/aclocal"

xserver

Before attempting to compile the server, you should first install the latest Xquartz release to ensure you have the latest headers and libraries.

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.4, 1.5 branch: 7.1_rc4) as well as the xserver tarball from our releases page. Then you can compile them as follows:

tar jxvf MesaLib-7.0.4.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 --with-mesa-source=`pwd`/../Mesa-7.0.4 --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 --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 gicp="git-cherry-pick -x"
alias gi14="git-checkout xorg-server-1.4-apple"
alias gi15="git-checkout xorg-server-1.5-apple"
alias gi16="git-checkout xorg-server-1.6-apple"
alias gi14m="git-checkout server-1.4-branch"
alias gi15m="git-checkout server-1.5-branch"
alias gi16m="git-checkout server-1.6-branch"
alias gim="git-checkout master"
alias girb14="git-rebase origin/xorg-server-1.4-apple"
alias girb15="git-rebase origin/xorg-server-1.5-apple"
alias girb16="git-rebase origin/xorg-server-1.6-apple"
alias girb14m="git-rebase origin/server-1.4-branch"
alias girb15m="git-rebase origin/server-1.5-branch"
alias girb16m="git-rebase origin/server-1.6-branch"
alias girbm="git-rebase origin/master"
alias gifrb="git-fetch && gi14m && girb14m && gi14 && girb14 && gi15m && girb15m && gi15 && girb15 && gi16m && girb16m && gi16 && girb16 &&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

New Branch Creation

If you need to create a new branch in the upstream repository, you can follow this example which creates a new xorg-server-1.6-apple branch based off the server-1.6 branch:

git-checkout -b xorg-server-1.6-apple server-1.6-branch
git-push origin xorg-server-1.6-apple:refs/heads/xorg-server-1.6-apple

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 (Old Stable)

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 the 2.1.x and 2.2.x releases and will not see any further development.

xorg-server-1.4-apple (Stable)

This branch is based off of the server-1.4 branch with changes specific for Xquartz. This is the branch for the 2.3.x releases and is our current stable branch.

xorg-server-1.5-apple (Skipped)

The Xquartz specific code in 1.5 is almost identical to what is in 1.4. This branch was included in 2.4.0_alpha1.

xorg-server-1.6-apple (Development)

The Xquartz specific code in 1.6 is almost identical to what is in 1.5. This is our current development branch and will be the server in the 2.4.0 release.

master

The Xquartz specific code in 1.7 is almost identical to what is in 1.6.