From 71e208bafe9ca5e1c189fae3f251cc84034e5959 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 24 Nov 2008 11:01:57 -0800 Subject: [PATCH] Add more package metadata to the pkg-config files The pkg-config files have been filled in more thoroughly to allow users to use mesa more effectively. By adding metadata to Requires.private, Libs.private and Cflags, we can ensure that all the libraries and headers will be found in all situations. However, the full substitutions are only done when using the configure script. This also fixes the glu pkg-config file to account for using GL or OSMesa. Fixes bug 18161. --- configs/autoconf.in | 17 ++++++++++++++ configs/default | 16 +++++++++++++ configure.ac | 41 ++++++++++++++++++++++++++++++++++ src/glu/Makefile | 7 +++++- src/glu/glu.pc.in | 8 ++++--- src/glut/glx/Makefile | 5 ++++- src/glut/glx/glut.pc.in | 4 +++- src/glut/mini/Makefile | 5 ++++- src/glut/mini/glut.pc.in | 4 +++- src/glw/Makefile | 5 ++++- src/glw/glw.pc.in | 4 +++- src/mesa/Makefile | 5 ++++- src/mesa/drivers/dri/Makefile | 3 ++- src/mesa/drivers/dri/dri.pc.in | 1 + src/mesa/gl.pc.in | 5 +++-- 15 files changed, 116 insertions(+), 14 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index a3eaed5c9d0..afd9f6a0c74 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -105,3 +105,20 @@ DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ # Where libGL will look for DRI hardware drivers DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) + +# pkg-config substitutions +GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ +GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ +GL_PC_CFLAGS = @GL_PC_CFLAGS@ +DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@ +GLU_PC_REQ = @GLU_PC_REQ@ +GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@ +GLU_PC_LIB = @GLU_PC_LIB@ +GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@ +GLU_PC_CFLAGS = @GLU_PC_CFLAGS@ +GLUT_PC_REQ_PRIV = @GLUT_PC_REQ_PRIV@ +GLUT_PC_LIB_PRIV = @GLUT_PC_LIB_PRIV@ +GLUT_PC_CFLAGS = @GLUT_PC_CFLAGS@ +GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@ +GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@ +GLW_PC_CFLAGS = @GLW_PC_CFLAGS@ diff --git a/configs/default b/configs/default index 21fa0d7f9ac..52ad61cb92b 100644 --- a/configs/default +++ b/configs/default @@ -100,3 +100,19 @@ DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri # Where libGL will look for DRI hardware drivers DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) +# pkg-config substitutions +GL_PC_REQ_PRIV = +GL_PC_LIB_PRIV = +GL_PC_CFLAGS = +DRI_PC_REQ_PRIV = +GLU_PC_REQ = gl +GLU_PC_REQ_PRIV = +GLU_PC_LIB = +GLU_PC_LIB_PRIV = +GLU_PC_CFLAGS = +GLUT_PC_REQ_PRIV = +GLUT_PC_LIB_PRIV = +GLUT_PC_CFLAGS = +GLW_PC_REQ_PRIV = +GLW_PC_LIB_PRIV = +GLW_PC_CFLAGS = diff --git a/configure.ac b/configure.ac index 66e080eb8e3..8026d9dca19 100644 --- a/configure.ac +++ b/configure.ac @@ -507,14 +507,18 @@ case "$mesa_driver" in xlib) if test "$x11_pkgconfig" = yes; then PKG_CHECK_MODULES([XLIBGL], [x11 xext]) + GL_PC_REQ_PRIV="x11 xext" X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" GL_LIB_DEPS="$XLIBGL_LIBS" else # should check these... X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" GL_LIB_DEPS="$X_LIBS -lX11 -lXext" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" fi GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS" + GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS" # if static, move the external libraries to the programs # and empty the libraries for libGL @@ -532,6 +536,8 @@ dri) # Check for libdrm PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) + GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" + DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" # find the DRI deps for libGL if test "$x11_pkgconfig" = yes; then @@ -542,16 +548,20 @@ dri) fi PKG_CHECK_MODULES([DRIGL], [$dri_modules]) + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules" X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" GL_LIB_DEPS="$DRIGL_LIBS" else # should check these... X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" # XCB can only be used from pkg-config if test "$enable_xcb" = yes; then PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx]) + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx" X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" fi @@ -559,6 +569,7 @@ dri) # need DRM libs, -lpthread, etc. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS" + GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS" ;; osmesa) # No libGL for osmesa @@ -566,6 +577,10 @@ osmesa) ;; esac AC_SUBST([GL_LIB_DEPS]) +AC_SUBST([GL_PC_REQ_PRIV]) +AC_SUBST([GL_PC_LIB_PRIV]) +AC_SUBST([GL_PC_CFLAGS]) +AC_SUBST([DRI_PC_REQ_PRIV]) dnl dnl More X11 setup @@ -825,6 +840,8 @@ if test "x$enable_glu" = xyes; then # Link libGLU to libOSMesa instead of libGL GLU_LIB_DEPS="" + GLU_PC_LIB='-L$(INSTALL_LIB_DIR) -l$(OSMESA_LIB)' + GLU_PC_CFLAGS='-I$(INSTALL_INC_DIR)' if test "$enable_static" = no; then GLU_MESA_DEPS='-l$(OSMESA_LIB)' else @@ -833,6 +850,8 @@ if test "x$enable_glu" = xyes; then ;; *) # If static, empty GLU_LIB_DEPS and add libs for programs to link + GLU_PC_REQ="gl" + GLU_PC_LIB_PRIV="-lm" if test "$enable_static" = no; then GLU_LIB_DEPS="-lm" GLU_MESA_DEPS='-l$(GL_LIB)' @@ -847,8 +866,14 @@ fi if test "$enable_static" = no; then GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" fi +GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS" AC_SUBST([GLU_LIB_DEPS]) AC_SUBST([GLU_MESA_DEPS]) +AC_SUBST([GLU_PC_REQ]) +AC_SUBST([GLU_PC_REQ_PRIV]) +AC_SUBST([GLU_PC_LIB]) +AC_SUBST([GLU_PC_LIB_PRIV]) +AC_SUBST([GLU_PC_CFLAGS]) dnl dnl GLw configuration @@ -873,10 +898,13 @@ if test "x$enable_glw" = xyes; then SRC_DIRS="$SRC_DIRS glw" if test "$x11_pkgconfig" = yes; then PKG_CHECK_MODULES([GLW],[x11 xt]) + GLW_PC_REQ_PRIV="x11 xt" GLW_LIB_DEPS="$GLW_LIBS" else # should check these... GLW_LIB_DEPS="$X_LIBS -lXt -lX11" + GLW_PC_LIB_PRIV="$GLW_LIB_DEPS" + GLW_PC_CFLAGS="$X11_INCLUDES" fi GLW_SOURCES="GLwDrawA.c" @@ -895,9 +923,12 @@ if test "x$enable_glw" = xyes; then fi # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS" + GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV" + GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS" fi # If static, empty GLW_LIB_DEPS and add libs for programs to link + GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS" if test "$enable_static" = no; then GLW_MESA_DEPS='-l$(GL_LIB)' GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS" @@ -911,6 +942,9 @@ AC_SUBST([GLW_LIB_DEPS]) AC_SUBST([GLW_MESA_DEPS]) AC_SUBST([GLW_SOURCES]) AC_SUBST([MOTIF_CFLAGS]) +AC_SUBST([GLW_PC_REQ_PRIV]) +AC_SUBST([GLW_PC_LIB_PRIV]) +AC_SUBST([GLW_PC_CFLAGS]) dnl dnl GLUT configuration @@ -945,12 +979,16 @@ if test "x$enable_glut" = xyes; then fi if test "$x11_pkgconfig" = yes; then PKG_CHECK_MODULES([GLUT],[x11 xmu xi]) + GLUT_PC_REQ_PRIV="x11 xmu xi" GLUT_LIB_DEPS="$GLUT_LIBS" else # should check these... GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" + GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS" + GLUT_PC_CFLAGS="$X11_INCLUDES" fi GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS" + GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS" # If glut is available, we can build most programs if test "$with_demos" = yes; then @@ -969,6 +1007,9 @@ fi AC_SUBST([GLUT_LIB_DEPS]) AC_SUBST([GLUT_MESA_DEPS]) AC_SUBST([GLUT_CFLAGS]) +AC_SUBST([GLUT_PC_REQ_PRIV]) +AC_SUBST([GLUT_PC_LIB_PRIV]) +AC_SUBST([GLUT_PC_CFLAGS]) dnl dnl Program library dependencies diff --git a/src/glu/Makefile b/src/glu/Makefile index b025a90b675..4351d235996 100644 --- a/src/glu/Makefile +++ b/src/glu/Makefile @@ -18,7 +18,12 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@GLU_PC_REQ@,$(GLU_PC_REQ),' \ + -e 's,@GLU_PC_REQ_PRIV@,$(GLU_PC_REQ_PRIV),' \ + -e 's,@GLU_PC_LIB@,$(GLU_PC_LIB),' \ + -e 's,@GLU_PC_LIB_PRIV@,$(GLU_PC_LIB_PRIV),' \ + -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),' glu.pc: glu.pc.in $(pcedit) $< > $@ diff --git a/src/glu/glu.pc.in b/src/glu/glu.pc.in index 8606b9b222c..2c9bd955b81 100644 --- a/src/glu/glu.pc.in +++ b/src/glu/glu.pc.in @@ -5,7 +5,9 @@ includedir=@INSTALL_INC_DIR@ Name: glu Description: Mesa OpenGL Utility library -Requires: gl +Requires: @GLU_PC_REQ@ +Requires.private: @GLU_PC_REQ_PRIV@ Version: @VERSION@ -Libs: -L${libdir} -lGLU -Cflags: -I${includedir} +Libs: -L${libdir} -lGLU @GLU_PC_LIB@ +Libs.private: @GLU_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLU_PC_CFLAGS@ diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 7f886f775ab..c8f0097ebe4 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -103,7 +103,10 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' + -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ + -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ + -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ + -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' glut.pc: glut.pc.in $(pcedit) $< > $@ diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in index e8638fe1488..ae0689d7e81 100644 --- a/src/glut/glx/glut.pc.in +++ b/src/glut/glx/glut.pc.in @@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@ Name: glut Description: Mesa OpenGL Utility Toolkit library Requires: gl glu +Requires.private: @GLUT_PC_REQ_PRIV@ Version: @VERSION@ Libs: -L${libdir} -lglut -Cflags: -I${includedir} +Libs.private: @GLUT_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLUT_PC_CFLAGS@ diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile index e47d09edb71..112a250bbd8 100644 --- a/src/glut/mini/Makefile +++ b/src/glut/mini/Makefile @@ -77,7 +77,10 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' + -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ + -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ + -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ + -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' glut.pc: glut.pc.in $(pcedit) $< > $@ diff --git a/src/glut/mini/glut.pc.in b/src/glut/mini/glut.pc.in index e8638fe1488..ae0689d7e81 100644 --- a/src/glut/mini/glut.pc.in +++ b/src/glut/mini/glut.pc.in @@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@ Name: glut Description: Mesa OpenGL Utility Toolkit library Requires: gl glu +Requires.private: @GLUT_PC_REQ_PRIV@ Version: @VERSION@ Libs: -L${libdir} -lglut -Cflags: -I${includedir} +Libs.private: @GLUT_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLUT_PC_CFLAGS@ diff --git a/src/glw/Makefile b/src/glw/Makefile index 753c4b74d4a..cf412b225eb 100644 --- a/src/glw/Makefile +++ b/src/glw/Makefile @@ -30,7 +30,10 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),' + -e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),' \ + -e 's,@GLW_PC_REQ_PRIV@,$(GLW_PC_REQ_PRIV),' \ + -e 's,@GLW_PC_LIB_PRIV@,$(GLW_PC_LIB_PRIV),' \ + -e 's,@GLW_PC_CFLAGS@,$(GLW_PC_CFLAGS),' glw.pc: glw.pc.in $(pcedit) $< > $@ diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in index 25f3f73b8c6..5493093be19 100644 --- a/src/glw/glw.pc.in +++ b/src/glw/glw.pc.in @@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@ Name: glw Description: Mesa OpenGL widget library Requires: gl +Requires.private: @GLW_PC_REQ_PRIV@ Version: @VERSION@ Libs: -L${libdir} -lGLw -Cflags: -I${includedir} +Libs.private: @GLW_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLW_PC_CFLAGS@ diff --git a/src/mesa/Makefile b/src/mesa/Makefile index ba65ce695fb..42a8673f4db 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -92,7 +92,10 @@ pcedit = sed \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \ + -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \ + -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' gl.pc: gl.pc.in $(pcedit) $< > $@ diff --git a/src/mesa/drivers/dri/Makefile b/src/mesa/drivers/dri/Makefile index eef68825bc9..9e49fb16f53 100644 --- a/src/mesa/drivers/dri/Makefile +++ b/src/mesa/drivers/dri/Makefile @@ -25,7 +25,8 @@ pcedit = sed \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ - -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' + -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \ + -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),' dri.pc: dri.pc.in $(pcedit) $< > $@ diff --git a/src/mesa/drivers/dri/dri.pc.in b/src/mesa/drivers/dri/dri.pc.in index c47ee9c7e7d..695aa6cfd66 100644 --- a/src/mesa/drivers/dri/dri.pc.in +++ b/src/mesa/drivers/dri/dri.pc.in @@ -7,4 +7,5 @@ dridriverdir=@DRI_DRIVER_DIR@ Name: dri Description: Direct Rendering Infrastructure Version: @VERSION@ +Requires.private: @DRI_PC_REQ_PRIV@ Cflags: -I${includedir} diff --git a/src/mesa/gl.pc.in b/src/mesa/gl.pc.in index 1927880d5f9..0462b9fca2b 100644 --- a/src/mesa/gl.pc.in +++ b/src/mesa/gl.pc.in @@ -5,7 +5,8 @@ includedir=@INSTALL_INC_DIR@ Name: gl Description: Mesa OpenGL library -Requires: +Requires.private: @GL_PC_REQ_PRIV@ Version: @VERSION@ Libs: -L${libdir} -lGL -Cflags: -I${includedir} +Libs.private: @GL_PC_LIB_PRIV@ +Cflags: -I${includedir} @GL_PC_CFLAGS@ -- 2.30.2