From 78edf4e227e82c6d42ece01fbc52515a17d9dee6 Mon Sep 17 00:00:00 2001 From: jdolan Date: Thu, 27 Jun 2013 16:02:47 -0400 Subject: [PATCH] Make Radiant honor GDK_GL_LIBGL_PATH. This way Radiant and GtkGLExt can use the same instance of libGL.dylib. Failure to do this results in unpredictable and wrong behavior from GL. --- apple/GtkRadiant.app/Contents/MacOS/radiant | 8 ++- apple/Makefile | 59 ++++++++++----------- radiant/main.cpp | 24 ++++----- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/apple/GtkRadiant.app/Contents/MacOS/radiant b/apple/GtkRadiant.app/Contents/MacOS/radiant index 8d06d233..0ef3a975 100755 --- a/apple/GtkRadiant.app/Contents/MacOS/radiant +++ b/apple/GtkRadiant.app/Contents/MacOS/radiant @@ -11,8 +11,14 @@ set -x resources="${RADIANT_HOME}/Contents/Resources" +export GDK_GL_LIBGL_PATH="${resources}/lib/libGL.1.dylib" +export GDK_GL_LIBGLU_PATH="${resources}/lib/libGLU.1.dylib" + +export GDK_PATH="${resources}" export GDK_PIXBUF_MODULE_FILE="${resources}/etc/gtk-2.0/gdk-pixbuf.loaders" +export GOBJECT_PATH="${resources}" + export GTK_DATA_PREFIX="${resources}" export GTK_EXE_PREFIX="${resources}" export GTK_PATH="${resources}" @@ -21,6 +27,6 @@ export PANGO_SYSCONFDIR="${resources}/etc" export PANGO_LIBDIR="${resources}/lib" cd "${resources}/install" -./radiant.bin +./radiant.bin & set +x \ No newline at end of file diff --git a/apple/Makefile b/apple/Makefile index 6aec233c..b706c837 100644 --- a/apple/Makefile +++ b/apple/Makefile @@ -12,62 +12,59 @@ VERSION = 1.6.4 DMG = $(TARGET)/GtkRadiant-$(VERSION).dmg VOLUME_NAME = "GtkRadiant $(VERSION)" -all: install gtk-runtime bundle +all: install bundle -pre-install: +-pre-install: install -d $(TARGET) cp -r GtkRadiant.app $(TARGET) find $(TARGET) -name .turd -delete - -install: pre-install - cp -r $(INSTALL) $(RESOURCES) - rm -rf `find $(INSTDIR)/installs -type d -name .svn` - -gtk-runtime: + +-gtk-runtime-gdk-pixbuf-2.0: + cp -r /opt/local/lib/gdk-pixbuf-2.0 $(LIBDIR) + find $(LIBDIR)/gdk-pixbuf-2.0 -type f ! -name "*.so" -delete + gdk-pixbuf-query-loaders | sed $(PREFIX_SED_EXPR) > \ $(CONFDIR)/gtk-2.0/gdk-pixbuf.loaders - - gtk-query-immodules-2.0 | sed $(PREFIX_SED_EXPR) > \ - $(CONFDIR)/gtk-2.0/gtk.immodules - + +-gtk-runtime-pango: + cp -r /opt/local/lib/pango $(LIBDIR) + find $(LIBDIR)/pango -type f ! -name "*.so" -delete + pango-querymodules | sed $(PREFIX_SED_EXPR) > \ $(CONFDIR)/pango/pango.modules - cp -r /opt/local/lib/gdk-pixbuf-2.0 $(LIBDIR) +-gtk-runtime: -gtk-runtime-gdk-pixbuf-2.0 -gtk-runtime-pango cp -r /opt/local/lib/gtk-2.0 $(LIBDIR) - cp -r /opt/local/lib/pango $(LIBDIR) - - find $(LIBDIR)/gdk-pixbuf-2.0 -type f ! -name "*.so" -delete find $(LIBDIR)/gtk-2.0 -type f ! -name "*.so" -delete - find $(LIBDIR)/pango -type f ! -name "*.so" -delete rm -rf $(LIBDIR)/gtk-2.0/{includes,modules} rm -rf $(LIBDIR)/gtk-2.0/*/printbackends - dylibbundler -b \ - `find $(LIBDIR)/gdk-pixbuf-2.0 -type f | xargs -I {} echo -x {}` \ - `find $(LIBDIR)/gtk-2.0 -type f | xargs -I {} echo -x {}` \ - `find $(LIBDIR)/pango -type f | xargs -I {} echo -x {}` \ - -d $(LIBDIR) -of -p @executable_path/../lib - cp -r /opt/local/share/themes/Default $(RESOURCES)/share + + gtk-query-immodules-2.0 | sed $(PREFIX_SED_EXPR) > \ + $(CONFDIR)/gtk-2.0/gtk.immodules + +install: -pre-install -gtk-runtime + cp -r $(INSTALL) $(RESOURCES) + rm -rf `find $(INSTDIR)/installs -type d -name .svn` bundle: + + # The Radiant plugins (modules) are a little funky + # Some of them are actually linked against the build directory + + ln -s ../build ./build + dylibbundler -b \ -x $(INSTDIR)/radiant.bin \ -x $(INSTDIR)/q3map2 \ -x $(INSTDIR)/q3map2_urt \ -x $(INSTDIR)/q3data \ + `find $(INSTDIR)/modules -name "*.so" | xargs -I {} echo -x {}` \ + `find $(LIBDIR) -name "*.so" | xargs -I {} echo -x {}` \ -d $(LIBDIR) -of -p @executable_path/../lib - # The Radiant plugins (modules) are a little funky - # Some of them are actually linked against the build directory - ln -s ../build ./build - - dylibbundler -b \ - `find $(INSTDIR)/modules -name "*.so" | xargs -I {} echo -x {}` \ - -d $(LIBDIR) -of -p @executable_path/../lib - rm -f build image: diff --git a/radiant/main.cpp b/radiant/main.cpp index 5ba7b518..d41b77e1 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -463,19 +463,17 @@ int main( int argc, char* argv[] ) { */ putenv( "LC_NUMERIC=C" ); -#ifdef _WIN32 - libgl = "opengl32.dll"; -#endif - -#if defined ( __linux__ ) - libgl = "libGL.so.1"; -#endif - -#ifdef __APPLE__ - // libgl = "/usr/X11R6/lib/libGL.dylib"; - // libgl = "/usr/X11/lib/libGL.dylib"; - libgl = "/opt/local/lib/libGL.dylib"; -#endif + // Use the same environment variable for resolving libGL as libgtkglext does. + libgl = getenv("GDK_GL_LIBGL_PATH"); + if ( libgl == NULL ) { + #if defined ( _WIN32 ) + libgl = "opengl32.dll"; + #elif defined ( __linux__ ) + libgl = "libGL.so.1"; + #elif defined ( __APPLE__ ) + libgl = "/opt/local/lib/libGL.dylib"; + #endif + } #if defined ( __linux__ ) || defined ( __APPLE__ ) // Give away unnecessary root privileges.