GLUT 2.7.0.10 → 2.7.0.11
raw patch · 4 files changed
+37/−27 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- GLUT.cabal +2/−2
- README.md +4/−1
- cbits/HsGLUT.c +27/−24
CHANGELOG.md view
@@ -1,3 +1,7 @@+2.7.0.11+--------+* Linux: Try to load versioned GLUT library, too, because the unversioned one is often in *-dev packages only.+ 2.7.0.10 -------- * Mac OS X: Search public frameworks first, then system frameworks.
GLUT.cabal view
@@ -1,5 +1,5 @@ name: GLUT-version: 2.7.0.10+version: 2.7.0.11 synopsis: A binding for the OpenGL Utility Toolkit description: A Haskell binding for the OpenGL Utility Toolkit, a window system independent@@ -22,7 +22,7 @@ GHC == 7.6.3 GHC == 7.8.4 GHC == 7.10.3- GHC == 8.0.1+ GHC == 8.0.2 GHC == 8.1 cabal-version: >= 1.10 extra-source-files:
README.md view
@@ -1,1 +1,4 @@-[](https://hackage.haskell.org/package/GLUT) [](https://travis-ci.org/haskell-opengl/GLUT)+[](https://hackage.haskell.org/package/GLUT)+[](https://www.stackage.org/lts/package/GLUT)+[](https://www.stackage.org/nightly/package/GLUT)+[](https://travis-ci.org/haskell-opengl/GLUT)
cbits/HsGLUT.c view
@@ -15,6 +15,16 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +static LPCTSTR libNames[] = {+ /* Try to load freeglut first, it has a few extra features compared to classic+ GLUT. */+ TEXT("freeglut"),+ /* The MinGW-w64 version of freeglut prefixes "lib" onto the DLL name. */+ TEXT("libfreeglut"),+ /* If no freeglut version is found, try plain old glut32 instead. */+ TEXT("glut32")+};+ void* hs_GLUT_getProcAddress(const char *name) {@@ -22,20 +32,10 @@ static HMODULE handle = NULL; if (firstTime) {+ int i, numNames = (int)(sizeof(libNames) / sizeof(libNames[0])); firstTime = 0;-- /* Try to load freeglut first, it has a few extra features compared to- classic GLUT. */- handle = LoadLibrary(TEXT("freeglut"));-- /* The MinGW-w64 version of freeglut prefixes "lib" onto the DLL name. */- if (!handle) {- handle = LoadLibrary(TEXT("libfreeglut"));- }-- /* If no freeglut version is found, try plain old glut32 instead. */- if (!handle) {- handle = LoadLibrary(TEXT("glut32"));+ for (i = 0; (!handle) && (i < numNames); ++i) {+ handle = LoadLibrary(libNames[i]); } } @@ -48,6 +48,17 @@ #include <stdlib.h> #include <dlfcn.h> +static const char* libNames[] = {+#ifdef __APPLE__+ /* Try public framework path first. */+ "/Library/Frameworks/GLUT.framework/GLUT",+ /* If the public path failed, try the system framework path. */+ "/System/Library/Frameworks/GLUT.framework/GLUT"+#else+ "libglut.so", "libglut.so.3"+#endif+};+ void* hs_GLUT_getProcAddress(const char *name) {@@ -55,19 +66,11 @@ static void *handle = NULL; if (firstTime) {+ int i, numNames = (int)(sizeof(libNames) / sizeof(libNames[0])); firstTime = 0;--#ifdef __APPLE__- /* Try public framework path first. */- handle = dlopen("/Library/Frameworks/GLUT.framework/GLUT", RTLD_LAZY | RTLD_GLOBAL);-- /* If the public path failed, try the system framework path. */- if (!handle) {- handle = dlopen("/System/Library/Frameworks/GLUT.framework/GLUT", RTLD_LAZY | RTLD_GLOBAL);+ for (i = 0; (!handle) && (i < numNames); ++i) {+ handle = dlopen(libNames[i], RTLD_LAZY | RTLD_GLOBAL); }-#else- handle = dlopen("libglut.so", RTLD_LAZY | RTLD_GLOBAL);-#endif } return handle ? dlsym(handle, name) : NULL;