summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2002-11-20 22:13:21 +0000
committerjlam <jlam@pkgsrc.org>2002-11-20 22:13:21 +0000
commit9377a2aeabafeafde3f781576b83104d6c992d54 (patch)
tree325fd76bed1623994564db2a38a1cb0f9329f2a2 /graphics
parentd2a9be46aec50fbe033122f9d97a04412f9c1363 (diff)
downloadpkgsrc-9377a2aeabafeafde3f781576b83104d6c992d54.tar.gz
Compute version of built-in Mesa without using "glxinfo", which is broken
when the capabilities of the running X11 server differ from the X11 server on the system for which the package is meant. We now try to guess the Mesa version number based on which OpenGL specification is implemented. Separate out the logic into its own file, Mesa/version.mk, and use it in MesaLib's and glu's buildlink2.mk files. Note that Mesa/version.mk should only be used by the Mesa packages and is _not_ for general use.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/Mesa/version.mk40
-rw-r--r--graphics/MesaLib/buildlink2.mk12
-rw-r--r--graphics/glu/buildlink2.mk12
3 files changed, 46 insertions, 18 deletions
diff --git a/graphics/Mesa/version.mk b/graphics/Mesa/version.mk
new file mode 100644
index 00000000000..7ac254c209d
--- /dev/null
+++ b/graphics/Mesa/version.mk
@@ -0,0 +1,40 @@
+# $NetBSD: version.mk,v 1.1 2002/11/20 22:13:21 jlam Exp $
+#
+# This file computes the version number of the Mesa distributed with
+# XFree86 and stores it in ${_MESA_VERSION}.
+#
+# Note: This file should only be used by the Mesa-related packages.
+
+.if !defined(MESA_VERSION_MK)
+MESA_VERSION_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+_GL_GLEXT_H= ${X11BASE}/include/GL/glext.h
+_MESA_GL_VERSIONS= 1.2 1.3 1.4
+.for _glvers_ in ${_MESA_GL_VERSIONS}
+_MESA_GL_VERSION_${_glvers_}!= \
+ if ${EGREP} -q "\#define[ ]*GL_VERSION_${_glvers_:S/./_/}[ ]*1" ${_GL_GLEXT_H}; then \
+ ${ECHO} YES; \
+ else \
+ ${ECHO} NO; \
+ fi
+.endfor
+#
+# According to the Mesa documentation, for stable releases:
+#
+# Mesa-5.0 implements OpenGL 1.4,
+# Mesa-4.0.4 implements OpenGL 1.3
+# Mesa-3.4.2 implements OpenGL 1.2.
+#
+.if ${_MESA_GL_VERSION_1.4} == "YES"
+_MESA_VERSION?= 5.0
+.elif ${_MESA_GL_VERSION_1.3} == "YES"
+_MESA_VERSION?= 4.0.4
+.elif ${_MESA_GL_VERSION_1.2} == "YES"
+_MESA_VERSION?= 3.4.2
+.else
+_MESA_VERSION?= 0
+.endif
+
+.endif # MESA_VERSION_MK
diff --git a/graphics/MesaLib/buildlink2.mk b/graphics/MesaLib/buildlink2.mk
index a8956eb506e..5c3b63669fe 100644
--- a/graphics/MesaLib/buildlink2.mk
+++ b/graphics/MesaLib/buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink2.mk,v 1.6 2002/11/19 09:19:36 tron Exp $
+# $NetBSD: buildlink2.mk,v 1.7 2002/11/20 22:13:22 jlam Exp $
.if !defined(MESALIB_BUILDLINK2_MK)
MESALIB_BUILDLINK2_MK= # defined
@@ -34,14 +34,8 @@ _NEED_MESALIB= YES
# BUILDLINK_DEPENDS.MesaLib to see if we need to install the pkgsrc
# Mesa or if the built-in one is sufficient.
#
-. if exists(${X11BASE}/bin/glxinfo) && defined(DISPLAY)
-_MESALIB_VERSION!= \
- ${X11BASE}/bin/glxinfo | \
- ${SED} -n "/OpenGL version string/s/.*Mesa *//p"
-. else
-_MESALIB_VERSION?= 3.4
-. endif
-_MESALIB_PKG= MesaLib-${_MESALIB_VERSION}
+. include "../../graphics/Mesa/version.mk"
+_MESALIB_PKG= MesaLib-${_MESA_VERSION}
_MESALIB_DEPENDS= ${BUILDLINK_DEPENDS.MesaLib}
_NEED_MESALIB!= \
if ${PKG_ADMIN} pmatch '${_MESALIB_DEPENDS}' ${_MESALIB_PKG}; then \
diff --git a/graphics/glu/buildlink2.mk b/graphics/glu/buildlink2.mk
index 58826b0bf5c..f46a2784a74 100644
--- a/graphics/glu/buildlink2.mk
+++ b/graphics/glu/buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink2.mk,v 1.6 2002/11/19 09:19:37 tron Exp $
+# $NetBSD: buildlink2.mk,v 1.7 2002/11/20 22:13:22 jlam Exp $
.if !defined(GLU_BUILDLINK2_MK)
GLU_BUILDLINK2_MK= # defined
@@ -34,14 +34,8 @@ _NEED_GLU= YES
# BUILDLINK_DEPENDS.glu to see if we need to install the pkgsrc Mesa/GLU
# or if the built-in one is sufficient.
#
-. if exists(${X11BASE}/bin/glxinfo) && defined(DISPLAY)
-_GLU_VERSION!= \
- ${X11BASE}/bin/glxinfo | \
- ${SED} -n "/OpenGL version string/s/.*Mesa *//p"
-. else
-_GLU_VERSION?= 3.4
-. endif
-_GLU_PKG= glu-${_GLU_VERSION}
+. include "../../graphics/Mesa/version.mk"
+_GLU_PKG= glu-${_MESA_VERSION}
_GLU_DEPENDS= ${BUILDLINK_DEPENDS.glu}
_NEED_GLU!= \
if ${PKG_ADMIN} pmatch '${_GLU_DEPENDS}' ${_GLU_PKG}; then \