Xorg Libraries

#### Gaming Linux® From Scratch - Version 13.0

### Chapter 8. Basic X11 Software

- Prev

  Fontconfig-2.17.1

- Next

  libxcvt-0.1.3

- Up
- Home

# Xorg Libraries

## Introduction to Xorg Libraries

The Xorg libraries provide library routines that are used within all X Window applications.

### Note

This may take a while to build. Feel free to do something else while this is building.

### Important

For the lib32 installation instructions, they require new Meson cross files from MLFS, as `--libdir=/usr/lib32` has been moved to the cross files and no longer appear in the instructions. Install the new cross files so that 32-bit libraries don't get installed in `/usr/lib`.

- Download: https://xorg.freedesktop.org/archive/individual/lib/

### Xorg Libraries Dependencies

Required
Fontconfig-2.17.1 and libxcb-1.17.0
Optional
W3m (to generate additional PDF or text documentation for the libXfont package)

## Downloading Xorg Libraries

First, create a list of files to be downloaded:

    cat > x7lib-7-list << "EOF"
    xtrans-1.6.0.tar.xz
    libX11-1.8.13.tar.xz
    libXext-1.3.7.tar.xz
    #libFS-1.0.10.tar.xz
    libICE-1.1.2.tar.xz
    libSM-1.2.6.tar.xz
    libXScrnSaver-1.2.5.tar.xz
    libXt-1.3.1.tar.xz
    libXmu-1.3.1.tar.xz
    libXpm-3.5.18.tar.xz
    libXaw-1.0.16.tar.xz
    libXfixes-6.0.2.tar.xz
    libXcomposite-0.4.7.tar.xz
    libXrender-0.9.12.tar.xz
    libXcursor-1.2.3.tar.xz
    libXdamage-1.1.7.tar.xz
    libfontenc-1.1.9.tar.xz
    libXfont2-2.0.7.tar.xz
    libXft-2.3.9.tar.xz
    libXi-1.8.2.tar.xz
    libXinerama-1.1.6.tar.xz
    libXrandr-1.5.5.tar.xz
    libXres-1.2.3.tar.xz
    libXtst-1.2.5.tar.xz
    libXv-1.0.13.tar.xz
    libXvMC-1.0.15.tar.xz
    libXxf86dga-1.1.7.tar.xz
    libXxf86vm-1.1.7.tar.xz
    libpciaccess-0.18.1.tar.xz
    libxkbfile-1.2.0.tar.xz
    libxshmfence-1.3.3.tar.xz
    libXpresent-1.0.2.tar.xz
    EOF

libFS is commented out and will not be built unless you go out of your way to uncomment it. It is not needed for any packages in the LFS books and only necessary for some Xorg apps.

To download the needed files using Wget-1.25.0, use the following commands:

    mkdir x7lib &&
    cd x7lib &&
    grep -v '^#' ../x7lib-7-list | wget -i- -c \
        -B https://xorg.freedesktop.org/archive/individual/lib/

## Installation of Xorg Libraries

### Note

When installing multiple packages in a script, the installation needs to be done as the root user. There are three general options that can be used to do this:

1. Run the entire script as the root user (not recommended).

2. Use the sudo command from the sudo package.

3. Use su -c "command arguments" (quotes required) which will ask for the root password for every iteration of the loop.

One way to handle this situation is to create a short bash function that automatically selects the appropriate method. Once the command is set in the environment, it does not need to be set again.

    as_root()
    {
      if   [ $EUID = 0 ];        then $*
      elif [ -x /usr/bin/sudo ]; then sudo $*
      else                            su -c \\"$*\\"
      fi
    }

    export -f as_root

First, start a subshell that will exit on error:

    bash -e

Install all of the packages by running the following commands:

    for package in $(grep -v '^#' ../x7lib-7-list)
    do
      packagedir=${package%.tar.?z*}
      echo "Building $packagedir"

      tar -xf $package
      pushd $packagedir
      docdir="--docdir=/usr/share/doc/$packagedir"

      do_build()   { make; }
      do_install() { as_root make install; }

      case $packagedir in
        libXfont2-[0-9]* )
          ./configure $XORG_CONFIG $docdir --disable-devel-docs
        ;;

        libXt-[0-9]* )
          ./configure $XORG_CONFIG $docdir \
                      --with-appdefaultdir=/etc/X11/app-defaults
        ;;

        libXpm-[0-9]* )
          ./configure $XORG_CONFIG $docdir --disable-open-zfile
        ;;

        libpciaccess* | libxkbfile*)
          meson setup --prefix=/usr --buildtype=release build
          do_build()   { ninja -C build; }
          do_install() { as_root ninja -C build install; }
        ;;

        * )
          ./configure $XORG_CONFIG $docdir
        ;;
      esac

      do_build
      do_install
      unset do_build do_install

      popd
      rm -rf $packagedir
      as_root /sbin/ldconfig
    done

For multilib, install all of the lib32 variants of the packages by running the following commands:

    for package in $(grep -v '^#' ../x7lib-7-list)
    do
      case $package in xtrans* )
        continue
      ;;
      esac
      packagedir=${package%.tar.?z*}
      echo "Building lib32-$packagedir"

      tar -xf $package
      pushd $packagedir
      libdir="--libdir=/usr/lib32"
      docdir="--docdir=/usr/share/doc/$packagedir"
      host="--host=i686-pc-linux-gnu"

      do_build()        { make; }
      do_dest_install() { make DESTDIR=$PWD/DESTDIR install; }

      case $packagedir in
        libXfont2-[0-9]* )
          CC="gcc -m32" CXX="g++ -m32" PKG_CONFIG_PATH=/usr/lib32/pkgconfig  \
          ./configure $XORG_CONFIG $libdir $host $docdir --disable-devel-docs
        ;;

        libXt-[0-9]* )
          CC="gcc -m32" CXX="g++ -m32" PKG_CONFIG_PATH=/usr/lib32/pkgconfig \
          ./configure $XORG_CONFIG $libdir $host $docdir                    \
                      --with-appdefaultdir=/etc/X11/app-defaults
        ;;

        libXpm-[0-9]* )
          CC="gcc -m32" CXX="g++ -m32" PKG_CONFIG_PATH=/usr/lib32/pkgconfig  \
          ./configure $XORG_CONFIG $libdir $host $docdir --disable-open-zfile
        ;;

        libpciaccess* | libxkbfile* )
          meson setup --prefix=/usr --buildtype=release --cross-file=lib32 build

          do_build()        { ninja -C build; }
          do_dest_install() { DESTDIR=$PWD/DESTDIR ninja -C build install; }
        ;;

        * )
          CC="gcc -m32" CXX="g++ -m32"                   \
          PKG_CONFIG_PATH=/usr/lib32/pkgconfig   \
          ./configure $XORG_CONFIG $libdir $host $docdir
        ;;
      esac

      do_build
      do_dest_install
      unset do_build do_dest_install

      as_root cp -vR DESTDIR/usr/lib32/* /usr/lib32
      rm -rf DESTDIR
      popd
      rm -rf $packagedir
      as_root /sbin/ldconfig
    done

Finally, exit the shell that was started earlier:

    exit

## Command Explanations

`--disable-open-zfile`: Allow libXpm to build without the optional compress command present.

`--disable-devel-docs`: Disable generation of text documentation in the libXfont2 package if xmlto is installed without a text browser. Omit this parameter (or the entire case statement) if a text browser is installed.

## Contents

Installed Programs: cxpm and sxpm
Installed Libraries: libfontenc, libICE, libpciaccess, libSM, libX11, libX11-xcb, libXaw6, libXaw7, libXaw, libXcomposite, libXcursor, libXdamage, libXext, libXfixes, libXfont2, libXft, libXinerama, libXi, libxkbfile, libXmu, libXmuu, libXpm, libXpresent, libXrandr, libXrender, libXRes, libxshmfence, libXss, libXt, libXtst, libXvMC, libXvMCW, libXv, libXxf86dga and libXxf86vm
Installed Directories: /usr/include/X11/fonts, /usr/include/X11/ICE, /usr/include/X11/SM, /usr/include/X11/Xmu, /usr/include/X11/Xtrans, /usr/share/doc/libICE-1.1.2, /usr/share/doc/libSM-1.2.6, /usr/share/doc/libX11-1.8.13, /usr/share/doc/libXaw, /usr/share/doc/libXext, /usr/share/doc/libXi, /usr/share/doc/libXmu-1.3.1, /usr/share/doc/libXrender, /usr/share/doc/libXt, /usr/share/doc/libXtst, /usr/share/doc/libXvMC, /usr/share/doc/xtrans and /usr/share/X11/locale

### Short Descriptions

cxpm | checks the format of an XPM file
sxpm | shows an XPM file and/or converts XPM 1 or 2 files to XPM 3
`libfontenc` | is the X11 font encoding library
`libICE` | is the X Inter Client Exchange Library
`libpciaccess` | is the generic PCI Access library for X
`libSM` | is the X Session Management Library
`libX11` | is the Xlib Library
`libXaw6` | is the X Athena Widgets Library, version 6
`libXaw7` | is the X Athena Widgets Library, version 7
`libXaw` | are symbolic links to the current X Athena Widgets Library, version 7
`libXcomposite` | is the X Composite Library
`libXcursor` | is the X Cursor management library
`libXdamage` | is the X Damage Library
`libXext` | is the Misc X Extension Library
`libXfixes` | provides augmented versions of core protocol requests
`libXfont2` | is the X font library
`libXft` | is the X FreeType interface library
`libXinerama` | is the Xinerama Library
`libXi` | is the X Input Extension Library
`libxkbfile` | is the xkbfile Library
`libXmu` | is the X interface library for miscellaneous utilities not part of the Xlib standard
`libXmuu` | is the Mini Xmu Library
`libXpm` | is the X Pixmap Library
`libXpresent` | is the library interface to the X Present Extension
`libXrandr` | is the X Resize, Rotate and Reflection extension library
`libXrender` | is the X Render Library
`libXRes` | is the X-Resource extension client library
`libxshmfence` | exposes an event API on top of Linux futexes
`libXss` | is the X11 Screen Saver extension client library
`libXt` | is the X Toolkit Library
`libXtst` | is the Xtst Library
`libXvMC` | is the X-Video Motion Compensation Library
`libXvMCW` | is the XvMC Wrapper including the Nonstandard VLD extension
`libXv` | is the X Window System video extension library
`libXxf86dga` | is the client library for the XFree86-DGA extension
`libXxf86vm` | is the client library for the XFree86-VidMode X extension

- Prev

  Fontconfig-2.17.1

- Next

  libxcvt-0.1.3

- Up
- Home