diff -urN ccpnmr.orig/bin/analysis ccpnmr/bin/analysis
--- ccpnmr.orig/bin/analysis	1970-01-01 01:00:00.000000000 +0100
+++ ccpnmr/bin/analysis	2005-12-23 20:42:39.000000000 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+export MallocLogFile=/dev/null
+
+if [ ${SSH_TTY} ]; then
+    export LIBGL_ALWAYS_INDIRECT=1
+fi
+
+@PREFIX@/bin/python2.X -i -O @PREFIX@/lib/python2.X/site-packages/ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/AnalysisGui.py $1 $2 $3
diff -urN ccpnmr.orig/bin/formatConverter ccpnmr/bin/formatConverter
--- ccpnmr.orig/bin/formatConverter	1970-01-01 01:00:00.000000000 +0100
+++ ccpnmr/bin/formatConverter	2005-12-23 20:44:06.000000000 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+export MallocLogFile=/dev/null
+
+if [ ${SSH_TTY} ]; then
+    export LIBGL_ALWAYS_INDIRECT=1
+fi
+
+@PREFIX@/bin/python2.X -O @PREFIX@/lib/python2.X/site-packages/ccpnmr/ccpnmr1.0/python/ccpnmr/format/gui/FormatConverter.py $1
diff -urN ccpnmr.orig/ccpnmr1.0/c/environment-mesa.txt ccpnmr/ccpnmr1.0/c/environment-mesa.txt
--- ccpnmr.orig/ccpnmr1.0/c/environment-mesa.txt	1970-01-01 01:00:00.000000000 +0100
+++ ccpnmr/ccpnmr1.0/c/environment-mesa.txt	2005-12-23 21:38:16.000000000 +0000
@@ -0,0 +1,44 @@
+#Environment file for use with fink to build ccpnmr suite - environment.txt
+
+CC = gcc
+
+MALLOC_FLAG = -DDO_NOT_HAVE_MALLOC
+FPIC_FLAG = -fPIC
+CFLAGS = -O3 $(MALLOC_FLAG) $(FPIC_FLAG) -fno-common -ffast-math -mtune=970 -maltivec
+
+GL_FLAG = -DUSE_GL_TRUE
+#GL_FLAG = -DUSE_GL_FALSE
+
+GLUT_NEED_INIT =
+#GLUT_NEED_INIT = -DNEED_GLUT_INIT
+#GLUT_NOT_IN_GL = -DGLUT_IN_OWN_DIR
+GLUT_FLAG = $(GLUT_NEED_INIT) $(GLUT_NOT_IN_GL)
+
+SHARED_FLAGS = -L@PREFIX@/lib -bundle -bundle_loader @PREFIX@/bin/python2.X
+
+MATH_LIB = -lm
+
+X11_DIR = /usr/X11R6
+X11_LIB = -lX11 -lXext
+X11_INCLUDE_FLAGS = -I$(X11_DIR)/include
+X11_LIB_FLAGS = -L$(X11_DIR)/lib
+
+TCL_DIR = @PREFIX@
+TCL_LIB = -ltcl
+TCL_INCLUDE_FLAGS = -I$(TCL_DIR)/include
+#TCL_LIB_FLAGS = -L$(TCL_DIR)/lib
+
+TK_DIR = @PREFIX@
+TK_LIB = -ltk
+TK_INCLUDE_FLAGS = -I$(TK_DIR)/include
+#TK_LIB_FLAGS = -L$(TK_DIR)/lib
+
+PYTHON_DIR = @PREFIX@
+PYTHON_LIB = 
+PYTHON_INCLUDE_FLAGS = -I$(PYTHON_DIR)/include/python2.X
+PYTHON_LIB_FLAGS = 
+
+GL_DIR = @PREFIX@/share/mesa
+GL_LIB = -lglut -lGLU -lGL
+GL_INCLUDE_FLAGS = -I$(GL_DIR)/include
+GL_LIB_FLAGS = -L$(GL_DIR)/lib
diff -urN ccpnmr.orig/ccpnmr1.0/c/environment-opengl.txt ccpnmr/ccpnmr1.0/c/environment-opengl.txt
--- ccpnmr.orig/ccpnmr1.0/c/environment-opengl.txt	1970-01-01 01:00:00.000000000 +0100
+++ ccpnmr/ccpnmr1.0/c/environment-opengl.txt	2005-12-23 21:37:59.000000000 +0000
@@ -0,0 +1,44 @@
+#Environment file for use with fink to build ccpnmr suite - environment.txt
+
+CC = gcc
+
+MALLOC_FLAG = -DDO_NOT_HAVE_MALLOC
+FPIC_FLAG = -fPIC
+CFLAGS = -O3 $(MALLOC_FLAG) $(FPIC_FLAG) -fno-common -ffast-math -mtune=970 -maltivec
+
+GL_FLAG = -DUSE_GL_TRUE
+#GL_FLAG = -DUSE_GL_FALSE
+
+#GLUT_NEED_INIT =
+GLUT_NEED_INIT = -DNEED_GLUT_INIT
+#GLUT_NOT_IN_GL = -DGLUT_IN_OWN_DIR
+GLUT_FLAG = $(GLUT_NEED_INIT) $(GLUT_NOT_IN_GL)
+
+SHARED_FLAGS = -L@PREFIX@/lib -bundle -bundle_loader @PREFIX@/bin/python2.X
+
+MATH_LIB = -lm
+
+X11_DIR = /usr/X11R6
+X11_LIB = -lX11 -lXext
+X11_INCLUDE_FLAGS = -I$(X11_DIR)/include
+X11_LIB_FLAGS = -L$(X11_DIR)/lib
+
+TCL_DIR = @PREFIX@
+TCL_LIB = -ltcl
+TCL_INCLUDE_FLAGS = -I$(TCL_DIR)/include
+TCL_LIB_FLAGS = -L$(TCL_DIR)/lib
+
+TK_DIR = @PREFIX@
+TK_LIB = -ltk
+TK_INCLUDE_FLAGS = -I$(TK_DIR)/include
+TK_LIB_FLAGS = -L$(TK_DIR)/lib
+
+PYTHON_DIR = @PREFIX@
+PYTHON_LIB = 
+PYTHON_INCLUDE_FLAGS = -I$(PYTHON_DIR)/include/python2.X
+PYTHON_LIB_FLAGS = 
+
+GL_DIR = /usr/X11R6
+GL_LIB = -lfreeglut -lGLU -lGL
+GL_INCLUDE_FLAGS = -I$(GL_DIR)/include -I@PREFIX@/include
+GL_LIB_FLAGS = -L$(GL_DIR)/lib -L@PREFIX@/lib
diff -urN ccpnmr.orig/ccpnmr1.0/python/ccpnmr/analysis/Util.py ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/Util.py
--- ccpnmr.orig/ccpnmr1.0/python/ccpnmr/analysis/Util.py	2005-12-22 15:16:50.000000000 +0000
+++ ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/Util.py	2005-12-30 14:10:29.000000000 +0000
@@ -73,13 +73,13 @@
 
 graphics_handlers = []
 try:
-  import memops.c.TkHandler
-  graphics_handlers.append('Tk')
+  import memops.c.GlHandler
+  graphics_handlers.append('OpenGL')
 except:
   pass
 try:
-  import memops.c.GlHandler
-  graphics_handlers.append('OpenGL')
+  import memops.c.TkHandler
+  graphics_handlers.append('Tk')
 except:
   pass
 
diff -urN ccpnmr.orig/ccpnmr1.0/c/ccp/structure/Makefile ccpnmr/ccpnmr1.0/c/ccp/structure/Makefile
--- ccpnmr.orig/ccpnmr1.0/c/ccp/structure/Makefile	2006-01-13 21:52:17.000000000 +0000
+++ ccpnmr/ccpnmr1.0/c/ccp/structure/Makefile	2006-01-13 21:56:46.000000000 +0000
@@ -35,11 +35,11 @@
 	$(GLOBAL_DIR)/py_ps_handler.o \
 	$(GLOBAL_DIR)/py_tk_handler.o
 
-ALL_INCLUDE_FLAGS = $(GLOBAL_INCLUDE_FLAGS) $(PYTHON_INCLUDE_FLAGS) \
+ALL_INCLUDE_FLAGS = $(GL_INCLUDE_FLAGS) $(GLOBAL_INCLUDE_FLAGS) $(PYTHON_INCLUDE_FLAGS) \
 	$(X11_INCLUDE_FLAGS) \
-	$(TCL_INCLUDE_FLAGS) $(TK_INCLUDE_FLAGS) $(GL_INCLUDE_FLAGS)
+	$(TCL_INCLUDE_FLAGS) $(TK_INCLUDE_FLAGS)
 
-ALL_LIB_FLAGS = $(X11_LIB_FLAGS) $(TCL_LIB_FLAGS) $(TK_LIB_FLAGS) $(GL_LIB_FLAGS)
+ALL_LIB_FLAGS = $(GL_LIB_FLAGS) $(X11_LIB_FLAGS) $(TCL_LIB_FLAGS) $(TK_LIB_FLAGS)
 
 ALL_LIB = $(GL_LIB) $(TK_LIB) $(TCL_LIB) $(X11_LIB) $(MATH_LIB)
 
diff -urN ccpnmr.orig/ccpnmr1.0/c/ccpnmr/analysis/Makefile ccpnmr/ccpnmr1.0/c/ccpnmr/analysis/Makefile
--- ccpnmr.orig/ccpnmr1.0/c/ccpnmr/analysis/Makefile	2006-01-13 21:52:45.000000000 +0000
+++ ccpnmr/ccpnmr1.0/c/ccpnmr/analysis/Makefile	2006-01-13 21:57:29.000000000 +0000
@@ -40,11 +40,11 @@
 	$(GLOBAL_DIR)/py_ps_handler.o \
 	$(GLOBAL_DIR)/py_tk_handler.o
 
-ALL_INCLUDE_FLAGS = $(GLOBAL_INCLUDE_FLAGS) $(PYTHON_INCLUDE_FLAGS) \
+ALL_INCLUDE_FLAGS = $(GL_INCLUDE_FLAGS) $(GLOBAL_INCLUDE_FLAGS) $(PYTHON_INCLUDE_FLAGS) \
 	$(X11_INCLUDE_FLAGS) \
-	$(TCL_INCLUDE_FLAGS) $(TK_INCLUDE_FLAGS) $(GL_INCLUDE_FLAGS)
+	$(TCL_INCLUDE_FLAGS) $(TK_INCLUDE_FLAGS)
 
-ALL_LIB_FLAGS = $(X11_LIB_FLAGS) $(TCL_LIB_FLAGS) $(TK_LIB_FLAGS) $(GL_LIB_FLAGS)
+ALL_LIB_FLAGS = $(GL_LIB_FLAGS) $(X11_LIB_FLAGS) $(TCL_LIB_FLAGS) $(TK_LIB_FLAGS)
 
 ALL_LIB = $(GL_LIB) $(TK_LIB) $(TCL_LIB) $(X11_LIB) $(MATH_LIB)
 
diff -urN ccpnmr.orig/ccpnmr1.0/c/memops/global/Makefile ccpnmr/ccpnmr1.0/c/memops/global/Makefile
--- ccpnmr.orig/ccpnmr1.0/c/memops/global/Makefile	2006-01-13 20:57:07.000000000 +0000
+++ ccpnmr/ccpnmr1.0/c/memops/global/Makefile	2006-01-13 20:59:57.000000000 +0000
@@ -99,10 +99,10 @@
 
 TCLTK_LIB = $(TK_LIB) $(TCL_LIB) $(X11_LIB) $(MATH_LIB)
 
-ALL_INCLUDE_FLAGS = $(PYTHON_INCLUDE_FLAGS) $(X11_INCLUDE_FLAGS) \
-	$(TCL_INCLUDE_FLAGS) $(TK_INCLUDE_FLAGS) $(GL_INCLUDE_FLAGS)
+ALL_INCLUDE_FLAGS = $(GL_INCLUDE_FLAGS) $(PYTHON_INCLUDE_FLAGS) $(X11_INCLUDE_FLAGS) \
+	$(TCL_INCLUDE_FLAGS) $(TK_INCLUDE_FLAGS)
 
-ALL_LIB_FLAGS = $(X11_LIB_FLAGS) $(TCL_LIB_FLAGS) $(TK_LIB_FLAGS) $(GL_LIB_FLAGS)
+ALL_LIB_FLAGS = $(GL_LIB_FLAGS) $(X11_LIB_FLAGS) $(TCL_LIB_FLAGS) $(TK_LIB_FLAGS)
 
 ALL_LIB = $(GL_LIB) $(TK_LIB) $(TCL_LIB) $(X11_LIB) $(MATH_LIB)
 
diff -urN ccpnmr.orig/ccpnmr1.0/c/memops/global/gl_handler.c ccpnmr/ccpnmr1.0/c/memops/global/gl_handler.c 
--- ccpnmr.orig/ccpnmr1.0/c/memops/global/gl_handler.c  2006-08-03 15:33:15.000000000 +0100
+++ ccpnmr/ccpnmr1.0/c/memops/global/gl_handler.c       2006-08-25 11:30:36.000000000 +0100
@@ -378,8 +378,8 @@
         return NULL;
     hGLRC = wglCreateContext(hDC);
 
-    if (!(glGetError() == GL_NO_ERROR))
-      return NULL;
+/*    if (!(glGetError() == GL_NO_ERROR))
+      return NULL; */
 #else
     if (!glXQueryExtension(display, &dummy, &dummy))
       return NULL; /* check that OpenGL's GLX extension supported */
@@ -390,7 +390,8 @@
 
     context = glXCreateContext(display, visual, None, direct ? GL_TRUE : GL_FALSE);
 
-    if (!context || !(glGetError() == GL_NO_ERROR))
+ /*    if (!context || !(glGetError() == GL_NO_ERROR)) */
+    if (!context)
       return NULL;
 #endif
 
@@ -655,7 +656,8 @@
 /*
     glDrawBuffer(GL_BACK);
 */
-    if (!ok || !(glGetError() == GL_NO_ERROR))
+    /*    if (!ok || !(glGetError() == GL_NO_ERROR)) */
+    if (!ok)
       return CCPN_FALSE;
 
     return CCPN_TRUE;
diff -urN ccpnmr.orig/bin/ccpnmr-postupdate ccpnmr/bin/ccpnmr-postupdate
--- ccpnmr.orig/bin/ccpnmr-postupdate	1970-01-01 01:00:00.000000000 +0100
+++ ccpnmr/bin/ccpnmr-postupdate	2006-12-04 19:56:48.000000000 +0000
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+cd @PREFIX@/lib/python2.X/site-packages/ccpnmr/ccpnmr1.0/
+sudo find . -name \*.pyo -delete
+sudo find . -name \*.pyc -delete
+
+cd @PREFIX@/lib/python2.X/site-packages/ccpnmr/ccpnmr1.0/c
+sudo make clean; sudo make; sudo make links
+
+cd @PREFIX@/lib/python2.X/site-packages
+sudo @PREFIX@/bin/python2.X -O @PREFIX@/lib/python2.X/compileall.py ccpnmr/ccpnmr1.0
+
+echo "Your CcpNmr (analysis) updates are now activated!"

 	  	 
