From e3f9bd20fe8e7aac901e0fb6030f5511cbd1745c Mon Sep 17 00:00:00 2001 From: Sven Panne Date: Thu, 12 May 2016 14:06:03 +0200 Subject: [PATCH] Trial balloon: Use full path to GLUT framework on Apple platforms. --- CHANGELOG.md | 2 +- GLUT.cabal | 2 -- cbits/HsGLUT.c | 8 +++++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 006acf7..b83ad90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ 2.7.0.9 -------- -* Windows/Linux: The GLUT package compiles without any additional GLUT library now. +* The GLUT package compiles without any additional library/framework now. * Windows: We search for a native freeglut DLL, a MinGW freeglut DLL and a classic GLUT DLL, in that order. 2.7.0.8 diff --git a/GLUT.cabal b/GLUT.cabal index d0a544c..f280025 100644 --- a/GLUT.cabal +++ b/GLUT.cabal @@ -103,8 +103,6 @@ library else cpp-options: "-DCALLCONV=ccall" cc-options: "-DUSE_DLSYM" - if os(darwin) - frameworks: GLUT executable BOGLGP01-OnYourOwn1 if !flag(BuildExamples) diff --git a/cbits/HsGLUT.c b/cbits/HsGLUT.c index d77cf41..95d0e0f 100644 --- a/cbits/HsGLUT.c +++ b/cbits/HsGLUT.c @@ -48,6 +48,12 @@ hs_GLUT_getProcAddress(const char *name) #include #include +#ifdef __APPLE__ +#define FILENAME "/System/Library/Frameworks/GLUT.framework/GLUT" +#else +#define FILENAME "libglut.so" +#endif + void* hs_GLUT_getProcAddress(const char *name) { @@ -56,7 +62,7 @@ hs_GLUT_getProcAddress(const char *name) if (firstTime) { firstTime = 0; - handle = dlopen("libglut.so", RTLD_LAZY); + handle = dlopen(FILENAME, RTLD_LAZY | RTLD_GLOBAL); } return handle ? dlsym(handle, name) : NULL;