Skip to content

Commit a4a3924

Browse files
committed
Mac OS X: Serach public frameworks first, then system frameworks.
1 parent e3f9bd2 commit a4a3924

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.7.0.10
2+
--------
3+
* Mac OS X: Search public frameworks first, then system frameworks.
4+
15
2.7.0.9
26
--------
37
* The GLUT package compiles without any additional library/framework now.

GLUT.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: GLUT
2-
version: 2.7.0.9
2+
version: 2.7.0.10
33
synopsis: A binding for the OpenGL Utility Toolkit
44
description:
55
A Haskell binding for the OpenGL Utility Toolkit, a window system independent

cbits/HsGLUT.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ hs_GLUT_getProcAddress(const char *name)
4848
#include <stdlib.h>
4949
#include <dlfcn.h>
5050

51-
#ifdef __APPLE__
52-
#define FILENAME "/System/Library/Frameworks/GLUT.framework/GLUT"
53-
#else
54-
#define FILENAME "libglut.so"
55-
#endif
56-
5751
void*
5852
hs_GLUT_getProcAddress(const char *name)
5953
{
@@ -62,7 +56,18 @@ hs_GLUT_getProcAddress(const char *name)
6256

6357
if (firstTime) {
6458
firstTime = 0;
65-
handle = dlopen(FILENAME, RTLD_LAZY | RTLD_GLOBAL);
59+
60+
#ifdef __APPLE__
61+
/* Try public framework path first. */
62+
handle = dlopen("/Library/Frameworks/GLUT.framework/GLUT", RTLD_LAZY | RTLD_GLOBAL);
63+
64+
/* If the public path failed, try the system framework path. */
65+
if (!handle) {
66+
handle = dlopen("/System/Library/Frameworks/GLUT.framework/GLUT", RTLD_LAZY | RTLD_GLOBAL);
67+
}
68+
#else
69+
handle = dlopen("libglut.so", RTLD_LAZY | RTLD_GLOBAL);
70+
#endif
6671
}
6772

6873
return handle ? dlsym(handle, name) : NULL;

0 commit comments

Comments
 (0)