Difference between revisions of "Code/build-experimental-X"
(Allow forced reconfiguring; avoid reconfiguring libdrm unnecessarily; fix Mesa "make"; disable xprint; change X permissions; add FETCH and BUILD flags) |
(Add XCB (default off); fix share/X11/xkb/compiled.tmp issue; add MAKE_CLEAN; add font X.org modules) |
||
Line 13: | Line 13: | ||
# http://web.telia.com/~u89404340/touchpad | # http://web.telia.com/~u89404340/touchpad | ||
# http://www.freedesktop.org/wiki/Software_2fXKeyboardConfig | # http://www.freedesktop.org/wiki/Software_2fXKeyboardConfig | ||
+ | # http://gitweb.freedesktop.org/?p=xorg/util/modular.git;a=blob;f=build.sh | ||
############################################# | ############################################# | ||
Line 22: | Line 23: | ||
FLAGS='-O2 -g -march=pentium-m' | FLAGS='-O2 -g -march=pentium-m' | ||
RECONFIGURE=false # Reconfigure everything even if unchanged from last run | RECONFIGURE=false # Reconfigure everything even if unchanged from last run | ||
+ | MAKE_CLEAN=false # If true, run "make clean" before building. | ||
+ | USE_XCB=false # Use XCB? | ||
trap "echo Aborting.; exit 1" ERR | trap "echo Aborting.; exit 1" ERR | ||
Line 76: | Line 79: | ||
save_dir_hash | save_dir_hash | ||
fi | fi | ||
− | run make clean | + | ! $MAKE_CLEAN || run make clean |
run make | run make | ||
save_dir_hash | save_dir_hash | ||
Line 86: | Line 89: | ||
echo "########### Build DRM kernel modules ###########" | echo "########### Build DRM kernel modules ###########" | ||
run cd $PIT/drm/linux-core | run cd $PIT/drm/linux-core | ||
+ | ! $MAKE_CLEAN || run make clean | ||
run make DRM_MODULES="radeon" | run make DRM_MODULES="radeon" | ||
run sudo sh -c \ | run sudo sh -c \ | ||
Line 129: | Line 133: | ||
export PATH="$DEST/bin:$PATH" | export PATH="$DEST/bin:$PATH" | ||
run mkdir -p $DRI_DRIVER_INSTALL_DIR | run mkdir -p $DRI_DRIVER_INSTALL_DIR | ||
+ | ! $MAKE_CLEAN || run make clean | ||
if [ -e configs/current ]; then | if [ -e configs/current ]; then | ||
run make -e | run make -e | ||
Line 146: | Line 151: | ||
XORG_DIRS=( | XORG_DIRS=( | ||
− | util/macros | + | xorg/util/macros |
− | proto/{bigreqs,composite,fixes,damage,gl,input,kb,pm,randr,resource,xext,xcmisc}proto | + | xorg/proto/{bigreqs,composite,fixes,damage,gl,input,kb,pm,randr,resource,xext,xcmisc}proto |
− | proto/{render,scrnsaver,video}proto | + | xorg/proto/{fontcache,fonts,kb}proto |
− | proto/{x11,xf86dga,xf86dri,xf86misc,xf86vidmode,xinerama}proto | + | xorg/proto/{render,scrnsaver,video}proto |
− | lib/lib{xtrans,Xau,X11,ICE,SM,Xt,Xmu,Xcomposite,Xrender,Xdamage,Xcursor,Xi,Xinerama} | + | xorg/proto/{x11,xf86dga,xf86dri,xf86misc,xf86vidmode,xinerama}proto |
− | lib/lib{xkbui,Xrandr,Xv,XvMC,Xxf86dga,Xxf86misc,Xxf86vm} | + | xcb/proto |
− | xserver | + | xorg/lib/lib{xtrans,Xau,Xdmcp} |
− | driver/xf86-video-ati | + | xcb/libxcb |
− | driver/xf86-input-mouse driver/xf86-input-keyboard | + | xorg/lib/lib{X11,ICE,SM,Xt,Xmu,Xcomposite,Xrender,Xdamage,Xcursor,Xi,Xinerama} |
− | app/{xkbutils,xkbcomp,setxkbmap} | + | xorg/lib/lib{Xfont,Xfontcache,Xft} |
+ | xorg/lib/lib{xkbui,Xrandr,Xv,XvMC,Xxf86dga,Xxf86misc,Xxf86vm} | ||
+ | xorg/xserver | ||
+ | xorg/driver/xf86-video-ati | ||
+ | xorg/driver/xf86-input-mouse driver/xf86-input-keyboard | ||
+ | xorg/app/{xkbutils,xkbcomp,setxkbmap} | ||
) | ) | ||
Line 163: | Line 173: | ||
fetch_xorg() { | fetch_xorg() { | ||
echo "########### Fetching (selected) X.org modules ###########" | echo "########### Fetching (selected) X.org modules ###########" | ||
− | XORG_GIT=git://anongit.freedesktop.org/git | + | XORG_GIT=git://anongit.freedesktop.org/git |
run mkdir -p $PIT/xorg | run mkdir -p $PIT/xorg | ||
for D in "${XORG_DIRS[@]}"; do | for D in "${XORG_DIRS[@]}"; do | ||
− | fetch_from_git $PIT/xorg "$XORG_GIT" "$D" | + | if [[ $D == xcb/* ]] && ! $USE_XCB; then continue; fi |
+ | fetch_from_git $PIT/xorg "$XORG_GIT" "$D" "${D#xorg/}" | ||
done | done | ||
} | } | ||
Line 175: | Line 186: | ||
build_x_module() { ( | build_x_module() { ( | ||
− | D=$1 | + | D="${1#xorg/}" |
echo "########### Building xorg/$D ###########" | echo "########### Building xorg/$D ###########" | ||
export PATH="$DEST/bin:$PATH" | export PATH="$DEST/bin:$PATH" | ||
Line 183: | Line 194: | ||
if [ $D == "xserver" ]; then | if [ $D == "xserver" ]; then | ||
CONF_OPT="--with-mesa-source=$PIT/Mesa --enable-xorg --disable-dmx --disable-xvfb --disable-xnest --disable-xprint" | CONF_OPT="--with-mesa-source=$PIT/Mesa --enable-xorg --disable-dmx --disable-xvfb --disable-xnest --disable-xprint" | ||
− | elif [ $D == "lib/libX11" ]; then | + | elif [ $D == "lib/libX11" ] && ! $USE_XCB; then |
CONF_OPT="--with-xcb=no" | CONF_OPT="--with-xcb=no" | ||
else | else | ||
Line 193: | Line 204: | ||
save_dir_hash | save_dir_hash | ||
fi | fi | ||
+ | ! $MAKE_CLEAN || run make clean | ||
run make | run make | ||
save_dir_hash | save_dir_hash | ||
Line 203: | Line 215: | ||
run mkdir -p $DEST/share/aclocal | run mkdir -p $DEST/share/aclocal | ||
run mkdir -p $DEST/var/log | run mkdir -p $DEST/var/log | ||
− | for D in "${XORG_DIRS[@]}"; do | + | for D in "${XORG_DIRS[@]}"; do |
+ | if [[ $D == xcb/* ]] && ! $USE_XCB; then continue; fi | ||
build_x_module $D || return 1 | build_x_module $D || return 1 | ||
done | done | ||
Line 232: | Line 245: | ||
--with-xkb-base=$DEST/share/X11/xkb --with-xkb-rules-symlink=xorg | --with-xkb-base=$DEST/share/X11/xkb --with-xkb-rules-symlink=xorg | ||
run make | run make | ||
− | + | # "make install" replaces share/X11/xkb/compiled.tmp with a junk symlink, so override it: | |
+ | mv $DEST/share/X11/xkb/compiled $DEST/share/X11/xkb/compiled.tmp | ||
run make install | run make install | ||
+ | rm -f $DEST/share/X11/xkb/compiled | ||
+ | mv $DEST/share/X11/xkb/compiled.tmp $DEST/share/X11/xkb/compiled | ||
) } | ) } | ||
Line 250: | Line 266: | ||
export PKG_CONFIG_PATH="$DEST/lib/pkgconfig:$PKG_CONFIG_PATH" | export PKG_CONFIG_PATH="$DEST/lib/pkgconfig:$PKG_CONFIG_PATH" | ||
export PATH="$DEST/bin:$PATH" | export PATH="$DEST/bin:$PATH" | ||
+ | ! $MAKE_CLEAN || run make clean | ||
run make | run make | ||
run cp -v synaptics_drv.so $DEST/lib/xorg/modules/input/ | run cp -v synaptics_drv.so $DEST/lib/xorg/modules/input/ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
) } | ) } | ||
Revision as of 15:33, 16 October 2006
- !/bin/bash
- Script to fetch and build X.org, DRI, Mesa, synaptics and xkeyboard-config
- from CVS and GIT.
- If you want to skip some tasks, comment them out at the bottom of the script.
- Source: http://thinkwiki.org/wiki/How_to_compile_an_experimental_X_server
- See also:
- http://wiki.x.org/wiki/ModularDevelopersGuide
- http://wiki.x.org/wiki/GitPage
- http://gitweb.freedesktop.org
- http://dri.freedesktop.org/wiki/Building
- http://www.mesa3d.org/cvs_access.html
- http://www.mesa3d.org/install.html
- http://web.telia.com/~u89404340/touchpad
- http://www.freedesktop.org/wiki/Software_2fXKeyboardConfig
- http://gitweb.freedesktop.org/?p=xorg/util/modular.git;a=blob;f=build.sh
- Init
PIT=$HOME/3d-pit # Download and build here DEST=$PIT/install # Install here
- MESA_DATE=2006-06-29 # Set this to get a historical Mesa CVS snapshot
FLAGS='-O2 -g -march=pentium-m' RECONFIGURE=false # Reconfigure everything even if unchanged from last run MAKE_CLEAN=false # If true, run "make clean" before building. USE_XCB=false # Use XCB?
trap "echo Aborting.; exit 1" ERR
die() {
echo "$*" exit 1
} run() {
echo "@ $@" "$@" || { echo "ERROR: Command \"$*\" failed in `pwd`"; exit 1; }
}
fetch_from_git() {
PARENT_DIR="$1" GIT_REP="$2" MODULE="$3" DIR="${4:-$MODULE}" if [ -d "$PARENT_DIR/$DIR" ]; then run cd "$PARENT_DIR/$DIR" run git pull else run cd "$PARENT_DIR" run git clone "$GIT_REP/$MODULE" "$DIR" fi
}
LAST_HASH=last_dir_hash dir_hash() {
find . \( -name $LAST_HASH -o -path ./.git -prune \) -o -type f -ls | sort | md5sum
} dir_hash_changed() {
$RECONFIGURE || [ ! -f $LAST_HASH ] || [ "`dir_hash`" != "`cat $LAST_HASH`" ]
} save_dir_hash() {
dir_hash > $LAST_HASH
}
- Fetching and building libDRM and DRM kernel drivers
fetch_drm() {
echo "########### Fetch DRM ###########" DRM_GIT=git://anongit.freedesktop.org/git/mesa fetch_from_git "$PIT" "$DRM_GIT" drm
}
build_libdrm() {
echo "########### Build libdrm ###########" run cd $PIT/drm if dir_hash_changed; then run ./autogen.sh CFLAGS="$FLAGS" run ./configure --prefix=$DEST --quiet save_dir_hash fi ! $MAKE_CLEAN || run make clean run make save_dir_hash run make install save_dir_hash
}
build_drm_modules() {
echo "########### Build DRM kernel modules ###########" run cd $PIT/drm/linux-core ! $MAKE_CLEAN || run make clean run make DRM_MODULES="radeon" run sudo sh -c \ 'rm -fv /lib/modules/`uname -r`/kernel/drivers/char/drm/*.ko; \ cp -v *.ko /lib/modules/`uname -r`/extra/; \ /sbin/depmod -a'
}
- Fetching Mesa
fetch_mesa() {
echo "########### Fetching Mesa ###########" MESA_CVS=:pserver:anonymous@anoncvs.freedesktop.org:2401/cvs/mesa run mkdir -p $PIT run cd $PIT grep -qF $MESA_CVS ~/.cvspass || run cvs -d $MESA_CVS login [ -d Mesa ] || run cvs -z3 -d $MESA_CVS co ${MESA_DATE:+-D $MESA_DATE} Mesa run cd $PIT/Mesa run cvs -z3 update -ACPd ${MESA_DATE:+-D $MESA_DATE}
}
patch_mesa() {
# patch to make Google Earth use acceleration: run perl -i -pe 'print "//DISABLE " if m/^\s*FALLBACK_IF.*Line\.SmoothFlag/' \ $PIT/Mesa/src/mesa/drivers/dri/r300/r300_render.c
}
- Building Mesa (do this after installing base X.org libraries
build_mesa() { (
echo "########### Building Mesa ###########" # This uses both old-style and new-style vars, to support older Mesa snapshots. run cd $PIT/Mesa export DRM_SOURCE_PATH=$PIT/drm export PKG_CONFIG_PATH="$DEST/lib/pkgconfig:$PKG_CONFIG_PATH" export DRM_SOURCE_PATH="$PIT/drm" export DESTDIR=$DEST INSTALL_DIR=$DEST export DRI_DRIVER_INSTALL_DIR=$DEST/lib/dri export DRI_DIRS='r300 r200 r128 radeon' export OPT_FLAGS="$FLAGS" export PATH="$DEST/bin:$PATH" run mkdir -p $DRI_DRIVER_INSTALL_DIR ! $MAKE_CLEAN || run make clean if [ -e configs/current ]; then run make -e else run make -e linux-dri-x86 fi run make -e install run cp -v lib/*_dri.so $DRI_DRIVER_INSTALL_DIR
) }
- X.org setup
- This is a list of modules that are in flux and likely to be related to
- whatever you're testing (or are required for the build), sorted by
- build order (see util/modular/build.sh for dependencies).
- Check CVS and the above URLs for other modules.
XORG_DIRS=(
xorg/util/macros xorg/proto/{bigreqs,composite,fixes,damage,gl,input,kb,pm,randr,resource,xext,xcmisc}proto xorg/proto/{fontcache,fonts,kb}proto xorg/proto/{render,scrnsaver,video}proto xorg/proto/{x11,xf86dga,xf86dri,xf86misc,xf86vidmode,xinerama}proto xcb/proto xorg/lib/lib{xtrans,Xau,Xdmcp} xcb/libxcb xorg/lib/lib{X11,ICE,SM,Xt,Xmu,Xcomposite,Xrender,Xdamage,Xcursor,Xi,Xinerama} xorg/lib/lib{Xfont,Xfontcache,Xft} xorg/lib/lib{xkbui,Xrandr,Xv,XvMC,Xxf86dga,Xxf86misc,Xxf86vm} xorg/xserver xorg/driver/xf86-video-ati xorg/driver/xf86-input-mouse driver/xf86-input-keyboard xorg/app/{xkbutils,xkbcomp,setxkbmap}
)
- Fetching X.org
fetch_xorg() {
echo "########### Fetching (selected) X.org modules ###########" XORG_GIT=git://anongit.freedesktop.org/git run mkdir -p $PIT/xorg for D in "${XORG_DIRS[@]}"; do if $D == xcb/* && ! $USE_XCB; then continue; fi fetch_from_git $PIT/xorg "$XORG_GIT" "$D" "${D#xorg/}" done
}
- Building and installing X.org
- (On repeated runs we avoid rerunning autotools if nothing changed.)
build_x_module() { (
D="${1#xorg/}" echo "########### Building xorg/$D ###########" export PATH="$DEST/bin:$PATH" export PKG_CONFIG_PATH="$DEST/lib/pkgconfig:$PKG_CONFIG_PATH" export ACLOCAL="${AC_LOCAL:-aclocal} -I $DEST/share/aclocal" export LD_LIBRARY_PATH="$DEST/lib:$LD_LIBRARY_PATH" if [ $D == "xserver" ]; then CONF_OPT="--with-mesa-source=$PIT/Mesa --enable-xorg --disable-dmx --disable-xvfb --disable-xnest --disable-xprint" elif [ $D == "lib/libX11" ] && ! $USE_XCB; then CONF_OPT="--with-xcb=no" else CONF_OPT= fi run cd $PIT/xorg/$D if dir_hash_changed; then CFLAGS="$FLAGS" run sh autogen.sh --prefix=$DEST --quiet --cache-file=$PIT/xorg/autoconf.cache $CONF_OPT save_dir_hash fi ! $MAKE_CLEAN || run make clean run make save_dir_hash run make install save_dir_hash
) }
build_xorg() {
run cd $PIT/xorg run mkdir -p $DEST/share/aclocal run mkdir -p $DEST/var/log for D in "${XORG_DIRS[@]}"; do if $D == xcb/* && ! $USE_XCB; then continue; fi build_x_module $D || return 1 done run sudo sh -c "chown -v root $DEST/bin/Xorg; \ chmod -v 4750 $DEST/bin/Xorg"
}
- Fetching and building xkeyboard-config
fetch_xkeyboard_config() {
echo "########### Fetching xkeyboard-config ###########" XKBC_CVS=:pserver:anoncvs@cvs.freedesktop.org:2401/cvs/xlibs run cd $PIT grep -qF $XKBC_CVS ~/.cvspass || run cvs -d $XKBC_CVS login [ -d xkbdesc ] || run cvs -z3 -d $XKBC_CVS co xkbdesc run cd $PIT/xkbdesc run cvs -z3 update -ACPd
}
build_xkeyboard_config() { (
echo "########### Building xkeyboard-config ###########" run cd $PIT/xkbdesc run ./autogen.sh export PKG_CONFIG_PATH="$DEST/lib/pkgconfig:$PKG_CONFIG_PATH" export PATH="$DEST/bin:$PATH" CFLAGS="$FLAGS" run ./configure --quiet --prefix=$DEST \ --with-xkb-base=$DEST/share/X11/xkb --with-xkb-rules-symlink=xorg run make # "make install" replaces share/X11/xkb/compiled.tmp with a junk symlink, so override it: mv $DEST/share/X11/xkb/compiled $DEST/share/X11/xkb/compiled.tmp run make install rm -f $DEST/share/X11/xkb/compiled mv $DEST/share/X11/xkb/compiled.tmp $DEST/share/X11/xkb/compiled
) }
- Fetching and building the synaptics driver
fetch_synaptics() {
echo "########### Fetch synaptics ###########" SYN_GIT=http://web.telia.com/~u89404340/touchpad/synaptics/.git fetch_from_git "$PIT" "$SYN_GIT" synaptics
}
build_synaptics() { (
echo "########### Build synaptics ###########" run cd $PIT/synaptics export PKG_CONFIG_PATH="$DEST/lib/pkgconfig:$PKG_CONFIG_PATH" export PATH="$DEST/bin:$PATH" ! $MAKE_CLEAN || run make clean run make run cp -v synaptics_drv.so $DEST/lib/xorg/modules/input/
) }
- Creating a script which sets env vars
create_xsetenv() {
cat <<EOF > $DEST/bin/xsetenv || die "Can't create $DEST/bin/xsetenv"
export PATH="$DEST/bin:$PATH" export LD_LIBRARY_PATH="$DEST/lib:$LD_LIBRARY_PATH" export LIBGL_DRIVERS_PATH=$DEST/lib/dri EOF
echo -e "\nRun '. $DEST/bin/xsetenv' to point env vars to this installation."
}
- Do it:
FETCH=true BUILD=true
if $FETCH; then
fetch_drm fetch_mesa # patch_mesa fetch_xorg fetch_xkeyboard_config fetch_synaptics
fi if $BUILD; then
build_libdrm build_drm_modules build_xorg build_mesa build_xkeyboard_config build_synaptics create_xsetenv
fi
echo 'Done.'