193.18. glew-2.3.1
The OpenGL Extension Wrangler — libGLEW, GLX mode, with glewinfo and visualinfo
2.3.1-1 · BSD-3-Clause AND MIT · 1.7 SBU · 3.4 MiB, 15 files · 42_graphics, 115 of 189 · ports/core/gpu/glew
Homepage: https://glew.sourceforge.net/
Why it is in KDOS. The comment above glew and glfw in script/phases/42_graphics/packages.d/gpu.txt:
The GL loader and window the GL programs and games open.
GLEW, the OpenGL Extension Wrangler, finds out at run time which OpenGL version and extensions the current context offers and loads their entry points; a program calls glewInit() once and then uses the functions as if they were linked. It also installs glewinfo, which prints every extension and entry point the driver supports, and visualinfo, which lists the visuals and framebuffer configurations. Games and emulators written against GLEW link it.
Depends on: cmake, ninja, pkgconf, libglvnd, mesa, glu, libX11, libXext.
Required by (12): avogadrolibs, ddnet, endless-sky, opencolorio, opencpn, openmsx, orcaslicer, pioneer, ppsspp, prusaslicer, supertux, widelands.
Sources: glew-2.3.1.tar.gz (845.8 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install glew'
build.sh:
cd build/cmake
cmake . -G Ninja -B _build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_UTILS=ON \
-DGLEW_X11=ON \
-DGLEW_EGL=OFF \
-DGLEW_OSMESA=OFF \
-DGLEW_REGAL=OFF \
-DOpenGL_GL_PREFERENCE=GLVND
ninja -C _build
DESTDIR=$PKG ninja -C _build install
-DBUILD_UTILS=ON— Buildsglewinfoandvisualinfo, upstream’s default.-DGLEW_X11=ON,-DGLEW_EGL=OFF— Builds the GLX variant of the library.GLEW_EGLswaps GLX for EGL under the same soname, so one build serves one of them; this is the GLX build the programs that use GLEW are written against. Function lookup goes through libglvnd’s dispatch and resolves under an EGL context too, butglewInit()returnsGLEW_ERROR_NO_GLX_DISPLAYwhen no GLX display is current, so a program that treats that error as fatal has to run as an X11 client under Xwayland.-DGLEW_OSMESA=OFF,-DGLEW_REGAL=OFF— Builds neither the OSMesa (off-screen Mesa) nor the Regal variant; both are upstream’s defaults, named here.-DOpenGL_GL_PREFERENCE=GLVND— Tells CMake’sFindOpenGLto take the libglvnd libraries,libOpenGLandlibGLX, rather than the legacylibGL. The link line names those two with libX11 and libXext; under the tree’s--as-needed,libGLX.so.0is the one that stays a run-time dependency, since GLEW resolves every GL entry point throughglXGetProcAddressARB.
Programs: glewinfo, visualinfo.
Libraries: libGLEW.so.
Directories: /usr/lib/cmake/glew, /usr/share/licenses/glew.
GLEW’s CMake project is in build/cmake, not at the top of the tree, and build.sh changes into it first. It is used rather than the top-level Makefile because it installs into lib rather than lib64 and writes a glew.pc with the real library directory.
The installed glew.pc says Requires: glu, so glu is in depends although the library is compiled with GLEW_NO_GLU and links no GLU itself: without glu.pc in the root, every consumer’s pkg-config glew would fail.