[Bug 257091] graphics/cairo: cairo-1.17.4 failed to build

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 11 Apr 2022 12:11:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257091

--- Comment #9 from Evgeniy Khramtsov <evgeniy@khramtsov.org> ---
$ env -S P="/usr/ports" C="graphics/cairo" D="/tmp" BATCH=yes sh
$ make -C "$P/$C" WRKDIR="$D/$(basename $C)" extract && cd "$D"/$(basename
$C)/*
$ rg -l 'cairo-glx.pc' | sort
configure
doc/public/Makefile.in
src/Makefile.am.features
src/Makefile.in
src/Makefile.win32.features

cairo builds cairo-glx.pc if use_glx is defined to yes:

$ rg --regexp 'ac_config_files.*cairo-glx.pc' -A 3 -B 2 configure
29900-                                  if test "x$use_glx" = xyes; then :
29901-  :
29902:          ac_config_files="$ac_config_files
src/cairo-glx.pc:src/cairo-features.pc.in"
29903-
29904-
29905-fi

cairo defines use_glx to yes, then redefines it to no if GLX was not found:

$ rg --regexp 'use_glx=yes' -B 3 configure
29729-$as_echo_n "checking for cairo's GLX functions feature... " >&6; }
29730-          echo
29731-
29732:          use_glx=yes

$ rg --regexp 'test.*ac_cv_header_GL_glx_h' -A 4 -B 4 configure
29743-  if test "x$need_glx_functions" = "xyes"; then
29744-    save_CFLAGS="$CFLAGS"
29745-    CFLAGS="$CFLAGS $gl_CFLAGS $gl_NONPKGCONFIG_CFLAGS"
29746-    ac_fn_c_check_header_mongrel "$LINENO" "GL/glx.h"
"ac_cv_header_GL_glx_h" "$ac_includes_default"
29747:if test "x$ac_cv_header_GL_glx_h" = xyes; then :
29748-
29749-else
29750-  use_glx="no (GLX headers not found)"
29751-fi

GL/glx.h is provided by graphics/libglvnd when built with X11=on:

$ rg -H 'GL/glx.h' -g '**/pkg-plist' -C0 $P/
/usr/ports/graphics/libglvnd/pkg-plist
%%X11%%include/GL/glx.h

X11 is on by default for graphics/libglvnd:

$ rg 'OPTIONS_DEFAULT' "$P"/graphics/libglvnd
/usr/ports/graphics/libglvnd/Makefile
OPTIONS_DEFAULT=X11

cairo X11=on GL/glx.h dependency is bootlegged via USE_GL which pulls libglvnd:

$ rg OPENGL "$P"/$C
/usr/ports/graphics/cairo/Makefile
41:OPTIONS_RADIO_GL=    OPENGL GLESV2
43:OPTIONS_DEFAULT=OPENGL XCB GLIB X11
52:OPENGL_USES= gl
53:OPENGL_USE=  gl=egl
54:OPENGL_CONFIGURE_ENABLE=gl egl

/usr/ports/graphics/cairo/pkg-plist
5:%%OPENGL%%include/cairo/cairo-gl.h
34:%%OPENGL%%libdata/pkgconfig/cairo-egl.pc
37:%%OPENGL%%libdata/pkgconfig/cairo-gl.pc
39:%%OPENGL%%%%X11%%libdata/pkgconfig/cairo-glx.pc

$ (cd "$P"/$C ; make -V USE_GL -V LIB_DEPENDS) | xargs -n 1 | rg -i 'egl'
egl
libEGL.so:graphics/libglvnd

One may add *_DEPENDS on glx.h or libGLX.so when graphics/cairo has OPENGL,X11
on to make dependency on libglvnd with X11=on more visible to users (fail in
*-depends), but note that Uses/gl.mk doesn't have GLX component defined for
USE_GL as of now. The choice may be "uses only header contents" or "uses
symbols from libGLX".

-- 
You are receiving this mail because:
You are the assignee for the bug.