Currently there is no reliable and simple way to configure for and develop
with the Mesa OpenGL libraries. This is especially true if there are multiple
GL installations. The pkg-config utility makes these problems much easier to
deal with.
This is an initial patch to export information for the GL, GLU, GLw and glut
libraries. Several improvements could be made, such as including the backend
dependent requirements of the libraries.
An example usage would be:
cc `pkg-config --cflags --libs gl` -o myglapp myglapp.c
---
Dan
Note that this sort of depends on the previous DESTDIR patch. Without it,
if you try to do a DESTDIR style install by setting INSTALL_DIR=/temppath/usr,
the pkg-config files will be incorrect.
.gitignore | 1 +
src/glu/Makefile | 12 +++++++++++-
src/glu/glu.pc.in | 11 +++++++++++
src/glut/glx/Makefile | 12 +++++++++++-
src/glut/glx/glut.pc.in | 11 +++++++++++
src/glw/Makefile | 12 +++++++++++-
src/glw/glw.pc.in | 11 +++++++++++
src/mesa/Makefile | 13 ++++++++++++-
src/mesa/gl.pc.in | 11 +++++++++++
9 files changed, 90 insertions(+), 4 deletions(-)
create mode 100644 src/glu/glu.pc.in
create mode 100644 src/glut/glx/glut.pc.in
create mode 100644 src/glw/glw.pc.in
create mode 100644 src/mesa/gl.pc.in
diff --git a/.gitignore b/.gitignore
index 033e6e1..c128ba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
*.o
*.so
*.sw[a-z]
+*.pc
*~
depend
depend.bak
diff --git a/src/glu/Makefile b/src/glu/Makefile
index b8c55db..836baa6 100644
--- a/src/glu/Makefile
+++ b/src/glu/Makefile
@@ -13,9 +13,19 @@ default: $(TOP)/configs/current
(cd $$dir ; $(MAKE)) ; \
done
-install:
+# GLU pkg-config file
+pcedit = sed \
+ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+ -e 's,@LIB_DIR@,$(LIB_DIR),' \
+ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
+glu.pc: glu.pc.in
+ $(pcedit) $< > $@
+
+install: glu.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.*
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
clean:
@for dir in $(SUBDIRS) ; do \
diff --git a/src/glu/glu.pc.in b/src/glu/glu.pc.in
new file mode 100644
index 0000000..5d6e52a
--- /dev/null
+++ b/src/glu/glu.pc.in
@@ -0,0 +1,11 @@
[EMAIL PROTECTED]@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIB_DIR@
+includedir=${prefix}/include
+
+Name: glu
+Description: Mesa OpenGL Utility library
+Requires: gl
+Version: @VERSION@
+Libs: -L${libdir} -lGLU
+Cflags: -I${includedir}
diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile
index b236c6f..5a224c9 100644
--- a/src/glut/glx/Makefile
+++ b/src/glut/glx/Makefile
@@ -96,11 +96,21 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
$(GLUT_LIB_DEPS) $(OBJECTS)
-install:
+# glut pkgconfig file
+pcedit = sed \
+ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+ -e 's,@LIB_DIR@,$(LIB_DIR),' \
+ -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
+glut.pc: glut.pc.in
+ $(pcedit) $< > $@
+
+install: glut.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h
$(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut*
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
clean:
diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in
new file mode 100644
index 0000000..f732f29
--- /dev/null
+++ b/src/glut/glx/glut.pc.in
@@ -0,0 +1,11 @@
[EMAIL PROTECTED]@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIB_DIR@
+includedir=${prefix}/include
+
+Name: glut
+Description: Mesa OpenGL Utility Toolkit library
+Requires: gl glu
+Version: @VERSION@
+Libs: -L${libdir} -lglut
+Cflags: -I${includedir}
diff --git a/src/glw/Makefile b/src/glw/Makefile
index 778ffb0..c32fc0c 100644
--- a/src/glw/Makefile
+++ b/src/glw/Makefile
@@ -25,11 +25,21 @@ OBJECTS = $(GLW_SOURCES:.c=.o)
default: $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME)
-install:
+# GLU pkg-config file
+pcedit = sed \
+ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+ -e 's,@LIB_DIR@,$(LIB_DIR),' \
+ -e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),'
+glw.pc: glw.pc.in
+ $(pcedit) $< > $@
+
+install: glw.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.*
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
clean:
-rm depend depend.bak
diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in
new file mode 100644
index 0000000..951e2dc
--- /dev/null
+++ b/src/glw/glw.pc.in
@@ -0,0 +1,11 @@
[EMAIL PROTECTED]@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIB_DIR@
+includedir=${prefix}/include
+
+Name: glw
+Description: Mesa OpenGL widget library
+Requires: gl
+Version: @VERSION@
+Libs: -L${libdir} -lGLU
+Cflags: -I${includedir}
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index a50e826..c05b195 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -134,6 +134,15 @@ $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME):
$(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECT
######################################################################
+# libGL pkg-config file
+pcedit = sed \
+ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+ -e 's,@LIB_DIR@,$(LIB_DIR),' \
+ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
+gl.pc: gl.pc.in
+ $(pcedit) $< > $@
+
+######################################################################
# Generic stuff
depend: $(ALL_SOURCES)
@@ -148,13 +157,15 @@ subdirs:
@ (cd x86-64 ; $(MAKE))
-install: default
+install: default gl.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
$(INSTALL) -m 644 $(TOP)/include/GL/*.h
$(DESTDIR)$(INSTALL_DIR)/include/GL
@if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
$(INSTALL) $(TOP)/$(LIB_DIR)/libGL*
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
fi
+ $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
@if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa*
$(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
fi
diff --git a/src/mesa/gl.pc.in b/src/mesa/gl.pc.in
new file mode 100644
index 0000000..4b144ff
--- /dev/null
+++ b/src/mesa/gl.pc.in
@@ -0,0 +1,11 @@
[EMAIL PROTECTED]@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIB_DIR@
+includedir=${prefix}/include
+
+Name: gl
+Description: Mesa OpenGL library
+Requires:
+Version: @VERSION@
+Libs: -L${libdir} -lGL
+Cflags: -I${includedir}
--
1.5.2.4
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev