Mesa (master): Fix glut to work with -fvisibility=hidden

Kristian Høgsberg krh at kemper.freedesktop.org
Mon Jan 4 02:02:33 UTC 2010


Module: Mesa
Branch: master
Commit: b8326b011d9b16dcc502507a52bd747a4b709399
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8326b011d9b16dcc502507a52bd747a4b709399

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Sun Jan  3 20:59:52 2010 -0500

Fix glut to work with -fvisibility=hidden

The GLUTAPI #define used in the header file to mark the font structs
visible wasn't kicking in because of the #define glutBitmap9By15 XXX
prior to #include <GL/glut.h>.  High quality code... worked around by
copying the GLUTAPI specifier to the invidual C files.

---

 src/glut/glx/capturexfont.c |    1 +
 src/glut/glx/glut_8x13.c    |    1 +
 src/glut/glx/glut_9x15.c    |    1 +
 src/glut/glx/glut_hel10.c   |    1 +
 src/glut/glx/glut_hel12.c   |    1 +
 src/glut/glx/glut_hel18.c   |    1 +
 src/glut/glx/glut_mroman.c  |    5 ++++-
 src/glut/glx/glut_roman.c   |    5 ++++-
 src/glut/glx/glut_tr10.c    |    1 +
 src/glut/glx/glut_tr24.c    |    1 +
 src/glut/glx/glutstroke.h   |    4 ++++
 11 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/glut/glx/capturexfont.c b/src/glut/glx/capturexfont.c
index b99e793..fd63fb7 100644
--- a/src/glut/glx/capturexfont.c
+++ b/src/glut/glx/capturexfont.c
@@ -321,6 +321,7 @@ captureXFont(Display * dpy, Font font, char *xfont, char *name)
     }
   }
   printf("};\n\n");
+  printf("GLUTAPI const BitmapFontRec %s;\n", name);
   printf("const BitmapFontRec %s = {\n", name);
   printf("\"%s\",\n", xfont);
   printf("%d,\n", last - first + 1);
diff --git a/src/glut/glx/glut_8x13.c b/src/glut/glx/glut_8x13.c
index 843c63d..f4e18eb 100644
--- a/src/glut/glx/glut_8x13.c
+++ b/src/glut/glx/glut_8x13.c
@@ -2064,6 +2064,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmap8By13;
 const BitmapFontRec glutBitmap8By13 = {
 "-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1",
 256,
diff --git a/src/glut/glx/glut_9x15.c b/src/glut/glx/glut_9x15.c
index 2d5c004..7dbec12 100644
--- a/src/glut/glx/glut_9x15.c
+++ b/src/glut/glx/glut_9x15.c
@@ -2066,6 +2066,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmap9By15;
 const BitmapFontRec glutBitmap9By15 = {
 "-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1",
 256,
diff --git a/src/glut/glx/glut_hel10.c b/src/glut/glx/glut_hel10.c
index 703cef3..3de1750 100644
--- a/src/glut/glx/glut_hel10.c
+++ b/src/glut/glx/glut_hel10.c
@@ -1769,6 +1769,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmapHelvetica10;
 const BitmapFontRec glutBitmapHelvetica10 = {
 "-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1",
 224,
diff --git a/src/glut/glx/glut_hel12.c b/src/glut/glx/glut_hel12.c
index 68aed8a..e6f1bbb 100644
--- a/src/glut/glx/glut_hel12.c
+++ b/src/glut/glx/glut_hel12.c
@@ -1779,6 +1779,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmapHelvetica12;
 const BitmapFontRec glutBitmapHelvetica12 = {
 "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1",
 224,
diff --git a/src/glut/glx/glut_hel18.c b/src/glut/glx/glut_hel18.c
index f080084..3ddcefd 100644
--- a/src/glut/glx/glut_hel18.c
+++ b/src/glut/glx/glut_hel18.c
@@ -1888,6 +1888,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmapHelvetica18;
 const BitmapFontRec glutBitmapHelvetica18 = {
 "-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1",
 224,
diff --git a/src/glut/glx/glut_mroman.c b/src/glut/glx/glut_mroman.c
index a29f043..08f879a 100644
--- a/src/glut/glx/glut_mroman.c
+++ b/src/glut/glx/glut_mroman.c
@@ -1,7 +1,9 @@
 
 /* GENERATED FILE -- DO NOT MODIFY */
 
+#define glutStrokeMonoRoman XXX
 #include "glutstroke.h"
+#undef glutStrokeMonoRoman
 
 /* char: 33 '!' */
 
@@ -2447,5 +2449,6 @@ static const StrokeCharRec chars[] = {
     { 2, char127, 52.381, 104.762 },
 };
 
-StrokeFontRec glutStrokeMonoRoman = { "Roman", 128, chars, 119.048, -33.3333 };
+GLUTAPI const StrokeFontRec glutStrokeMonoRoman;
+const StrokeFontRec glutStrokeMonoRoman = { "Roman", 128, chars, 119.048, -33.3333 };
 
diff --git a/src/glut/glx/glut_roman.c b/src/glut/glx/glut_roman.c
index af2b4ec..95b9f81 100644
--- a/src/glut/glx/glut_roman.c
+++ b/src/glut/glx/glut_roman.c
@@ -1,7 +1,9 @@
 
 /* GENERATED FILE -- DO NOT MODIFY */
 
+#define glutStrokeRoman XXX
 #include "glutstroke.h"
+#undef glutStrokeRoman
 
 /* char: 33 '!' */
 
@@ -2447,5 +2449,6 @@ static const StrokeCharRec chars[] = {
     { 2, char127, 33.3333, 66.6667 },
 };
 
-StrokeFontRec glutStrokeRoman = { "Roman", 128, chars, 119.048, -33.3333 };
+GLUTAPI const StrokeFontRec glutStrokeRoman;
+const StrokeFontRec glutStrokeRoman = { "Roman", 128, chars, 119.048, -33.3333 };
 
diff --git a/src/glut/glx/glut_tr10.c b/src/glut/glx/glut_tr10.c
index 0fac807..dbf5ebd 100644
--- a/src/glut/glx/glut_tr10.c
+++ b/src/glut/glx/glut_tr10.c
@@ -1768,6 +1768,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmapTimesRoman10;
 const BitmapFontRec glutBitmapTimesRoman10 = {
 "-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1",
 224,
diff --git a/src/glut/glx/glut_tr24.c b/src/glut/glx/glut_tr24.c
index 22b0e51..5db9d36 100644
--- a/src/glut/glx/glut_tr24.c
+++ b/src/glut/glx/glut_tr24.c
@@ -2051,6 +2051,7 @@ static const BitmapCharRec * const chars[] = {
 &ch255,
 };
 
+GLUTAPI const BitmapFontRec glutBitmapTimesRoman24;
 const BitmapFontRec glutBitmapTimesRoman24 = {
 "-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1",
 224,
diff --git a/src/glut/glx/glutstroke.h b/src/glut/glx/glutstroke.h
index 74b6031..d6eac7a 100644
--- a/src/glut/glx/glutstroke.h
+++ b/src/glut/glx/glutstroke.h
@@ -7,6 +7,10 @@
    and is provided without guarantee or warrantee expressed or 
    implied. This program is -not- in the public domain. */
 
+#define GLUT_NO_LIB_PRAGMA  /* Avoid auto library linking when building
+                               the GLUT library itself. */
+#include <GL/glut.h>
+
 #if defined(_MSC_VER)
 #pragma warning (disable:4244)  /* disable bogus conversion warnings */
 #pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */




More information about the mesa-commit mailing list