-
-
Save primetoxinz/1cd3d7dbc62225f8dff8adfc4a64fc75 to your computer and use it in GitHub Desktop.
How to build Xorg unintrusively. Works on Debian Sid with xdm. At the time of posting this, at least.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Thank you for helping us help you help us all | |
SRCDIR=/linux1/builds | |
DSTDIR=/linux1/usr | |
## Define what's cloned | |
REPOS="\ | |
git://anongit.freedesktop.org/git/xorg/util/macros \ | |
git://anongit.freedesktop.org/git/xorg/proto/x11proto \ | |
git://anongit.freedesktop.org/git/xorg/lib/libXau \ | |
git://anongit.freedesktop.org/git/xorg/lib/libxshmfence \ | |
git://anongit.freedesktop.org/git/xorg/lib/libxtrans \ | |
git://anongit.freedesktop.org/xorg/xserver \ | |
git://anongit.freedesktop.org/git/xorg/driver/glamor \ | |
git://anongit.freedesktop.org/xorg/driver/xf86-video-ati \ | |
git://anongit.freedesktop.org/xorg/driver/xf86-input-evdev \ | |
git://anongit.freedesktop.org/pixman \ | |
git://anongit.freedesktop.org/xorg/proto/dri3proto \ | |
git://anongit.freedesktop.org/xorg/proto/presentproto \ | |
git://anongit.freedesktop.org/xorg/proto/glproto \ | |
git://anongit.freedesktop.org/xorg/proto/xextproto \ | |
git://anongit.freedesktop.org/xcb/pthread-stubs \ | |
git://anongit.freedesktop.org/xcb/proto \ | |
git://anongit.freedesktop.org/xcb/libxcb \ | |
" | |
## Set up the environment | |
export DRI_DRIVERS="radeon,r200" | |
export GALLIUM_DRIVERS="r300,r600,swrast" | |
export PKG_CONFIG_PATH=$DSTDIR/lib/pkgconfig:$DSTDIR/share/pkgconfig:${PKG_CONFIG_PATH} | |
export LD_LIBRARY_PATH=$DSTDIR/lib:${LD_LIBRARY_PATH} | |
export LD_RUN_PATH=$DSTDIR/lib:${LD_RUN_PATH} | |
export LDFLAGS=-L$DSTDIR/lib CPPFLAGS=-I$DSTDIR/include | |
export ACLOCAL="/usr/bin/aclocal -I $DSTDIR/share/aclocal" | |
# Abort on errors | |
set -e | |
## Helpers | |
function _help() { | |
echo "USAGE: $1 [--skip-deps] [--skip-source]" | |
exit 0 | |
} | |
function _straightforward_build() { | |
cd $1 | |
./autogen.sh --prefix=$DSTDIR | |
sudo make install | |
sudo /sbin/ldconfig | |
cd .. | |
} | |
function _check_arg() { | |
arg=$1 | |
args=${@:2} | |
## 0 is true | |
for _arg in $args; do | |
test $arg == $_arg && return 0 | |
done | |
# the cake is a lie | |
return 1 | |
} | |
## Actual functionality | |
function install_deps() { | |
sudo apt-get build-dep libdrm mesa xserver-xorg-video-ati xorg-server | |
sudo apt-get install git llvm-3.4-dev libelf-dev linux-headers-$(uname -r) build-essential | |
sudo apt-get install libevdev-dev | |
} | |
function get_source() { | |
test -d $SRCDIR || mkdir -p $SRCDIR | |
cd $SRCDIR | |
for repo in $REPOS; do | |
dirname=$(basename $repo) | |
test -d $dirname && { | |
cd $dirname | |
git pull | |
cd .. | |
} || git clone $repo | |
done | |
} | |
function build_deps() { | |
cd $SRCDIR | |
_straightforward_build macros | |
_straightforward_build libXau | |
_straightforward_build libxtrans | |
_straightforward_build x11proto | |
_straightforward_build dri3proto | |
_straightforward_build presentproto | |
_straightforward_build glproto | |
_straightforward_build xextproto | |
_straightforward_build pthread-stubs | |
_straightforward_build proto | |
_straightforward_build libxcb | |
_straightforward_build libxshmfence | |
# _straightforward_build drm | |
_straightforward_build glamor | |
} | |
function build_mesa() { | |
cd mesa | |
./autogen.sh --prefix=$DSTDIR \ | |
--with-dri-drivers=$DRI_DRIVERS --with-gallium-drivers=$GALLIUM_DRIVERS \ | |
--with-egl-platforms=x11,drm --enable-gbm --enable-shared-glapi \ | |
--enable-glx-tls. | |
make | |
sudo make install | |
cd .. | |
} | |
function build_ati_evdev_pixman() { | |
_straightforward_build xf86-input-evdev | |
_straightforward_build xf86-video-ati | |
_straightforward_build pixman | |
} | |
function build_xserver() { | |
cd xserver | |
./autogen.sh --prefix=$DSTDIR --enable-xorg \ | |
--disable-dmx --disable-xvfb --disable-xnest --disable-xwin | |
make | |
sudo make install | |
cd .. | |
} | |
function cake_is_served() { | |
sudo chown root $DSTDIR/bin/Xorg | |
sudo chmod u+s $DSTDIR/bin/Xorg | |
sudo ldconfig | |
sudo ln -sf /usr/bin/xkbcomp $DSTDIR/bin/xkbcomp | |
sudo ln -sf /usr/share/X11/xkb/rules $DSTDIR/share/X11/xkb/rules | |
} | |
function grief_counselling() { | |
cat <<EOF | |
Add to /etc/environment: | |
LIBGL_DRIVERS_PATH=$DSTDIR/lib/dri/ | |
Add to /etc/X11/xorg.conf: | |
Section "Files" | |
ModulePath "$DSTDIR/lib/xorg/modules,/usr/lib/xorg/modules" | |
EndSection | |
Section "Module" | |
Load "dri2" | |
Load "glamoregl" | |
EndSection | |
… and in the Device section for your video card add Option "AccelMethod" "glamor" and make sure Driver is set to "radeon". | |
Create /etc/ld.so.conf.d/0-xorg-git.conf: | |
$DSTDIR/lib | |
Have this in /etc/X11/xdm/Xservers | |
:0 local /opt/xorg/bin/X :0 vt7 -nolisten tcp | |
EOF | |
} | |
function main() { | |
test ! -z $1 && { | |
test $1 == "--help" || test $1 == "-h" && _help | |
} | |
# Conditionally set up the env | |
# _check_arg "--skip-deps" $@ || install_deps | |
_check_arg "--skip-source" $@ || get_source | |
# Always build everything, though | |
build_deps | |
# build_mesa | |
# build_ati_evdev_pixman | |
# build_xserver | |
# cake_is_served | |
# grief_counselling | |
} | |
main $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment