NVIDIA EGL Libraries

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

### Chapter 12. Graphics Drivers - NVIDIA

- Prev

  NVIDIA Revisions

- Next

  nv-codec-headers-13.0.19.0 (ffnvcodec)

- Up
- Home

# NVIDIA EGL Libraries

## Introduction to NVIDIA EGL Libraries

The NVIDIA EGL Libraries allow the EGL drivers for the NVIDIA driver to function properly.

### NVIDIA EGL Libraries Dependencies

Required
libgbm-1.0.4, libdrm-2.4.131, libglvnd-1.7.0, Wayland-1.24.0, Wayland-Protocols-1.47, and Xorg Libraries

## Downloading NVIDIA EGL Libraries

First, create a list of files to be downloaded:

    cat > nvidia-egl-list << "EOF"
    eglexternalplatform/archive/1.2.1/eglexternalplatform-1.2.1.tar.gz
    egl-gbm/archive/1.1.2.1/egl-gbm-1.1.2.1.tar.gz
    egl-wayland/archive/1.1.20/egl-wayland-1.1.20.tar.gz
    egl-x11/archive/v1.0.4/egl-x11-1.0.4.tar.gz
    EOF

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

    mkdir nvidia-egl &&
    cd nvidia-egl &&
    grep -v '^#' ../nvidia-egl-list | wget -i- -c \
        -B https://github.com/NVIDIA/

## Installation of NVIDIA EGL 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 libraries by running the following commands:

    for package in $(grep -v '^#' ../nvidia-egl-list)
    do
      package=$(basename "$package")
      packagedir=${package%.tar.?z*}
      tar -xf $package
      pushd $packagedir
         mkdir build
         cd    build
           meson setup --prefix=/usr       \
                       --buildtype=release \
                       ..
           ninja
         as_root ninja install
      popd
      rm -rf $packagedir
      as_root /sbin/ldconfig
    done

Finally, exit the shell that was started earlier:

    exit

## Contents

Installed Programs: None
Installed Libraries: libnvidia-egl-gbm, libnvidia-egl-wayland, libnvidia-egl-xcb, and libnvidia-egl-xlib
Installed Directories: /usr/share/egl/egl_external_platform.d

### Short Descriptions

`libnvidia-egl-gbm` | provides GBM EGL application support
`libnvidia-egl-wayland` | provides client-side Wayland EGL application support
`libnvidia-egl-xcb` | provides EGL XCB support
`libnvidia-egl-xlib` | provides EGL XLib support

- Prev

  NVIDIA Revisions

- Next

  nv-codec-headers-13.0.19.0 (ffnvcodec)

- Up
- Home