--- Makefile	2007-07-03 13:16:51.000000000 -0400
+++ Makefile.macports	2009-10-11 19:14:37.000000000 -0400
@@ -25,10 +25,10 @@
 INSTALL		= \cp
 INSTALLDIR	= \cp -R
 
-SPARKY		= /usr/local/src/sparky
+SPARKY		= @BUILDDIR@
 SPARKY_SRC	= $(SPARKY)/c++
 SPARKY_OBJ	= $(SPARKY)/c++
-SPARKY_INSTALL	= /usr/local/sparky
+SPARKY_INSTALL	= @DESTDIR@@PREFIX@/lib/sparky
 SPARKY_SCRIPT	= sparky
 SCRIPT_SUFFIX	=
 
@@ -38,7 +38,7 @@
 		  bruk2ucsf$(EXE_SUFFIX) peaks2ucsf$(EXE_SUFFIX) \
 		  matrix2ucsf$(EXE_SUFFIX)
 
-PYTHON_VERSION	= 2.5
+PYTHON_VERSION	= 2.6
 PYTHON_DIR	= 
 
 PYMOD_SUFFIX	= .so
@@ -51,10 +51,12 @@
 Makefile.dep TAGS: force
 	cd $(SPARKY_SRC) && $(MAKE) -f Makefile -e $@
 
-install: install-nopython $(SPARKY_INSTALL) install-python
+install: install-nopython $(SPARKY_INSTALL) 
 	cd $(SPARKY_OBJ) && \
 	$(MAKE) -f $(SPARKY_SRC)/Makefile -e install-python
 	cd $(SPARKY)/python && $(MAKE) -f Makefile -e install
+	cp $(SPARKY_SRC)/_tkinter.so $(SPARKY_INSTALL)/python/lib-tk
+	cp $(SPARKY_SRC)/spy.so $(SPARKY_INSTALL)/python/sparky
 
 install-nopython: install-bin install-example install-lib \
 		  install-man install-misc
@@ -79,17 +81,10 @@
 	cd $(SPARKY) ; $(INSTALL) LICENSE README $(SPARKY_INSTALL)
 	cd $(SPARKY_INSTALL) ; chmod 644 LICENSE README
 
-install-python: $(SPARKY_INSTALL) $(SPARKY_INSTALL)/python$(PYTHON_VERSION)
-ifdef PYTHON_DIR
-	$(INSTALLDIR) $(PYTHON_DIR)/* $(SPARKY_INSTALL)/python$(PYTHON_VERSION)
-else
-	echo "Not packaging Python with Sparky."
-endif
-
 install-mac:
 	cd $(SPARKY)/mac && $(MAKE) -f Makefile -e install
 
-$(SPARKY_INSTALL) $(SPARKY_INSTALL)/bin $(SPARKY_INSTALL)/python$(PYTHON_VERSION):
+$(SPARKY_INSTALL) $(SPARKY_INSTALL)/bin:
 	mkdir $@
 	chmod 755 $@
 
--- bin/sparky	2007-07-03 13:20:18.000000000 -0400
+++ bin/sparky.macports	2009-10-11 19:13:37.000000000 -0400
@@ -25,20 +25,20 @@
 # If Python is available start Sparky as a Python extension.
 # Otherwise the standalone version of Sparky is started.
 #
-set PYTHON = "$SPARKY_INSTALL/python2.5/bin/python2.5"
+set PYTHON = "@PREFIX@/bin/python2.6"
 if (! -e "$PYTHON") then
-  set PYTHON = python2.5
+  set PYTHON = python2.6
 endif
 
 # -----------------------------------------------------------------------------
 # Where to find Tcl/Tk shared libraries and resources.
 #
-setenv TCLTK_LIB		"$SPARKY_INSTALL/lib"
+setenv TCLTK_LIB		"@PREFIX@/lib"
 setenv LD_LIBRARY_PATH		"$TCLTK_LIB"
 setenv LD_LIBRARYN32_PATH	"$TCLTK_LIB"
 setenv DYLD_LIBRARY_PATH	"$TCLTK_LIB"
-setenv TK_LIBRARY		"$TCLTK_LIB/tk8.4"
-setenv TCL_LIBRARY		"$TCLTK_LIB/tcl8.4"
+setenv TK_LIBRARY		"$TCLTK_LIB/tk8.5"
+setenv TCL_LIBRARY		"$TCLTK_LIB/tcl8.5"
 
 # -----------------------------------------------------------------------------
 # Other programs Sparky can use.
--- c++/Makefile	2007-07-03 15:46:13.000000000 -0400
+++ c++/Makefile.macports	2009-10-11 19:16:08.000000000 -0400
@@ -15,32 +15,33 @@
 INSTALL		= \cp
 REMOVE		= \rm -f
 
-SPARKY		= /usr/local/src/sparky
+SPARKY		= @BUILDDIR@
 SPARKY_SRC	= $(SPARKY)/c++
-PYTHON_VERSION	= 2.5
-PY_VER_WIN32	= 25
-PYTHON_PREFIX	= /usr/local
+SPARKY_INSTALL = @DESTDIR@@PREFIX@/lib/sparky
+PYTHON_VERSION	= 2.6
+PY_VER_WIN32	= 26
+PYTHON_PREFIX	= @PREFIX@/Library/Frameworks/Python.framework/Versions/$(PYTHON_VERSION)
 PYTHON_LIB	= $(PYTHON_PREFIX)/lib/python$(PYTHON_VERSION)
 PYTHON_INC	= $(PYTHON_PREFIX)/include/python$(PYTHON_VERSION)
-TCLTK_VERSION	= 8.4
-TCLTK_VER_WIN32	= 84
-TK_PREFIX	= /usr/local
+TCLTK_VERSION	= 8.5
+TCLTK_VER_WIN32	= 85
+TK_PREFIX	= @PREFIX@
 TK_LIBNAME	= tk$(TCLTK_VERSION)
 TCL_LIBNAME	= tcl$(TCLTK_VERSION)
 PLATFORM	= unix
 
 CXX		= g++
-CXXFLAGS	= 
+CXXFLAGS	= -O3 -ffast-math -fno-common 
 CC		= gcc
-CFLAGS		=
+CFLAGS		= -O3 -ffast-math -fno-common
 PYFLAGS		= -I$(PYTHON_INC) -I$(PYTHON_LIB)/config
-TKFLAGS		= -I$(TK_PREFIX)/include
-TKLIBS		= -L$(TK_PREFIX)/lib -l$(TK_LIBNAME) -l$(TCL_LIBNAME) -lX11
+TKFLAGS                = -I$(TK_PREFIX)/include -I@PREFIX@/include
+TKLIBS		= -L$(TK_PREFIX)/lib -l$(TK_LIBNAME) -l$(TCL_LIBNAME) -L@PREFIX@/lib -lX11
 EXTRALIBS	= 
 SYSLIBS		= -lm
 LDLIBS		= $(TKLIBS) $(SYSLIBS) $(EXTRALIBS)
 LDFLAGS		=
-LDSHARED	= -shared
+LDSHARED	= -bundle -flat_namespace -undefined suppress 
 DEPEND		= -MM
 
 CXX_RULE_PREFIX	=
--- lib/Makefile	2004-02-18 13:53:29.000000000 -0500
+++ lib/Makefile.macports	2009-10-11 19:12:47.000000000 -0400
@@ -6,31 +6,23 @@
 INSTALL		= \cp
 INSTALLDIR	= \cp -r
 
-SPARKY_INSTALL	= /usr/local/sparky
+SPARKY_INSTALL	= @DESTDIR@@PREFIX@/lib/sparky
 
-TCLTK_VERSION	= 8.4
+TCLTK_VERSION	= 8.5
 TK_VERSION	= tk$(TCLTK_VERSION)
 TCL_VERSION	= tcl$(TCLTK_VERSION)
-TK_PREFIX	= /usr/local
+TK_PREFIX	= @PREFIX@
 TCL_TK_LIB	= $(TK_PREFIX)/lib
 TCL_TK_SHLIB	= $(TCL_TK_LIB)
-TCLTK_SHLIB_SUFFIX	= .so
+TCLTK_SHLIB_SUFFIX	= .dylib
 TCL_SHLIB	= lib$(TCL_VERSION)$(TCLTK_SHLIB_SUFFIX)
 TK_SHLIB	= lib$(TK_VERSION)$(TCLTK_SHLIB_SUFFIX)
 
-install: $(SPARKY_INSTALL)/lib install-tcl-tk
+install: $(SPARKY_INSTALL)/lib
 	$(INSTALL) Sparky print-prolog.ps $(SPARKY_INSTALL)/lib
 	cd $(SPARKY_INSTALL)/lib ; \
 	chmod 644 Sparky print-prolog.ps
 
-install-tcl-tk: $(SPARKY_INSTALL)/lib
-	$(INSTALL) $(TCL_TK_SHLIB)/$(TCL_SHLIB) $(SPARKY_INSTALL)/lib
-	$(INSTALL) $(TCL_TK_SHLIB)/$(TK_SHLIB) $(SPARKY_INSTALL)/lib
-	chmod 755 $(SPARKY_INSTALL)/lib/$(TCL_SHLIB)
-	chmod 755 $(SPARKY_INSTALL)/lib/$(TK_SHLIB)
-	$(INSTALLDIR) $(TCL_TK_LIB)/$(TCL_VERSION) $(TCL_TK_LIB)/$(TK_VERSION) \
-		$(SPARKY_INSTALL)/lib
-
 $(SPARKY_INSTALL)/lib:
 	mkdir $@
 	chmod 755 $@
--- manual/Makefile	2004-03-08 18:40:06.000000000 -0500
+++ manual/Makefile.macports	2009-10-11 19:12:47.000000000 -0400
@@ -11,7 +11,7 @@
 
 INSTALL		= \cp
 
-SPARKY_INSTALL	= /usr/local/sparky
+SPARKY_INSTALL	= @DESTDIR@@PREFIX@/lib/sparky
 MANUAL_WWW	= /usr/local/html/cgl/sparky/manual
 
 MANUAL_SECTIONS = overview.html intro.html views.html peaks.html \
--- python/Makefile	2007-07-03 13:17:37.000000000 -0400
+++ python/Makefile.macports	2009-10-11 19:17:42.000000000 -0400
@@ -4,9 +4,9 @@
 
 INSTALL		= \cp
 
-SPARKY_INSTALL	= /usr/local/sparky
-PYTHON_PREFIX	= /usr/local
-PYTHON_VERSION	= 2.5
+SPARKY_INSTALL	= @DESTDIR@@PREFIX@/lib/sparky
+PYTHON_VERSION  = 2.6
+PYTHON_PREFIX	= @PREFIX@/Library/Frameworks/Python.framework/Versions/$(PYTHON_VERSION)
 PYTHON		= $(PYTHON_PREFIX)/bin/python$(PYTHON_VERSION)
 PYTHON_LIB	= $(PYTHON_PREFIX)/lib/python$(PYTHON_VERSION)
 
@@ -35,8 +35,8 @@
 	chmod 644 $(SPARKY_INSTALL)/python/README
 	cd $(SPARKY_INSTALL)/python/sparky ; chmod 644 $(PYTHON_CODE)
 	chmod 644 $(SPARKY_INSTALL)/python/lib-tk/*.py
-	$(PYTHON) $(PYTHON_LIB)/compileall.py $(SPARKY_INSTALL)/python/sparky
-	$(PYTHON) $(PYTHON_LIB)/compileall.py $(SPARKY_INSTALL)/python/lib-tk
+	$(PYTHON) $(PYTHON_LIB)/compileall.py -d @PREFIX@/lib/sparky/python/sparky $(SPARKY_INSTALL)/python/sparky
+	$(PYTHON) $(PYTHON_LIB)/compileall.py -d @PREFIX@/lib/sparky/python/lib-tk $(SPARKY_INSTALL)/python/lib-tk
 
 $(SPARKY_INSTALL)/python $(SPARKY_INSTALL)/python/sparky \
   $(SPARKY_INSTALL)/python/lib-tk:
