Introduction to XCB Utilities
        
        
          The XCB utilities provide extensions that developers can use when
          making X Window software. xcb-util-0.4.1 was just installed but
          these utilities offer even more extensions that X Window software
          may depend on.
        
        
          This package is known to build and work properly using an LFS 12.4
          platform.
        
        
          Package Information
        
        
          
            - 
              
                Download (HTTP): https://xcb.freedesktop.org/dist/
               
- 
              
                Download size: 1.1 MB
               
- 
              
                Estimated disk space required: 13.3 MB
               
- 
              
                Estimated build time: 0.1 SBU (ignoring the time to download)
               
 
        
          XCB Utilities Dependencies
        
        
          Required
        
        
          libxcb-1.17.0 and xcb-util-0.4.1
        
       
      
        
          Downloading XCB Utilities
        
        
          First, create a list of files to be downloaded. This file will also
          be used to verify the integrity of the downloads when complete:
        
        cat > xcb-utils.md5 << "EOF"
a67bfac2eff696170259ef1f5ce1b611  xcb-util-image-0.4.1.tar.xz
fbdc05f86f72f287ed71b162f1a9725a  xcb-util-keysyms-0.4.1.tar.xz
193b890e2a89a53c31e2ece3afcbd55f  xcb-util-renderutil-0.3.10.tar.xz
581b3a092e3c0c1b4de6416d90b969c3  xcb-util-wm-0.4.2.tar.xz
bc30cd267b11ac5803fe19929cabd230  xcb-util-cursor-0.1.5.tar.xz
EOF
        
          To download the needed files using Wget-1.25.0, use
          the following commands:
        
        mkdir xcb-utils &&
cd    xcb-utils &&
grep -v '^#' ../xcb-utils.md5 | awk '{print $2}' | wget -i- -c \
     -B https://xcb.freedesktop.org/dist/ &&
md5sum -c ../xcb-utils.md5
       
      
        
          Installation of XCB Utilities
        
        
          ![[Note]](../images/note.png) 
          
            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:
          
          
            
              - 
                
                  Run the entire script as the root user (not recommended).
                 
- 
                
                  Use the sudo
                  command from the Sudo-1.9.17p2 package.
                 
- 
                
                  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 '^#' ../xcb-utils.md5 | awk '{print $2}')
do
  packagedir=${package%.tar.?z*}
  tar -xf $package
  pushd $packagedir
     ./configure $XORG_CONFIG
     make
     as_root make install
  popd
  rm -rf $packagedir
done
        
          Finally, exit the shell that was started earlier:
        
        exit