[Bf-committers] Allow python interpreter callbacks OS X patch

Kester Maddock bf-committers@blender.org
Wed, 2 Jul 2003 14:57:44 +1200


--Boundary-00=_ookA/ami9fGqIlR
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello,

I have put this in a diff for someone to add..

The output of :
python -c "import distutils.sysconfig; print 
distutils.sysconfig.get_config_var('LINKFORSHARED')"
should be added to the link command.

This should make:
import math
work on OSX.

See http://www.python.org/doc/current/ext/link-reqs.html for more details.

Kester

On Wed, 25 Jun 2003 2:33, Douglas Bischoff wrote:
> Hello, all!
>
> With help from Kester Maddock, I've successfully compiled Blender (I'm
> back to NAN Makefiles since autoconf isn't keeping up... *sigh*)
> allowing callbacks from precompiled modules back to the interpreter.
> Here's the changed code from source/nan_link.mk
> ----
> ifeq ($(OS),darwin)
>      LLIBS    += -lGLU -lGL
>      LLIBS    += -lz -framework Carbon -framework AGL
>      ifeq ($(WITH_QUICKTIME), true)
> 		LLIBS += -framework QuickTime
>      endif
>      LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Libraries
>      DBG_LDFLAGS +=
> -L/System/Library/Frameworks/OpenGL.framework/Libraries
>
>      LDFLAGS += -u __dummy -u _PyMac_Error -framework System -framework
> Python -framework CoreServices -framework Foundation
>      DBG_LDFLAGS += -u __dummy -u _PyMac_Error -framework System
> -framework Python -framework CoreServices -framework Foundation
>
> endif
> ----
> The changes are simply to add to the LD Flags and DBG_LD flags the
> include information necessary to allow the callbacks. NOTE! I have
> installed Python as a framework, and the default is to install it as a
> library on OS X. This code may have to be made smarter by someone more
> experienced than I to properly detect how Python was installed for the
> -framework calls to work, but the -u __dummy -u _PyMac_Error parts
> should work fine either way.
>
> Hope this helps, and many thanks to Kester!
>
> -Bish
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers

--Boundary-00=_ookA/ami9fGqIlR
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="PyMacPatch.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="PyMacPatch.diff"

Index: Makefile.am
===================================================================
RCS file: /cvsroot/bf-blender/blender/Makefile.am,v
retrieving revision 1.14
diff -u -u -3 -b -B -r1.14 Makefile.am
--- Makefile.am	12 Jun 2003 19:06:32 -0000	1.14
+++ Makefile.am	2 Jul 2003 02:49:27 -0000
@@ -54,7 +54,7 @@
 endif
 
 blender_LDFLAGS = -framework OpenGL -framework AGL -framework Carbon \
-				  $(quicktimeldflags)
+				  $(quicktimeldflags) @PYTHON_LDFLAGS@
 
 blender_SOURCES =
 
Index: source/nan_link.mk
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/nan_link.mk,v
retrieving revision 1.13
diff -u -u -3 -b -B -r1.13 nan_link.mk
--- source/nan_link.mk	14 Jun 2003 22:47:54 -0000	1.13
+++ source/nan_link.mk	2 Jul 2003 02:49:28 -0000
@@ -63,6 +63,12 @@
     endif
     LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Libraries
     DBG_LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Libraries
+
+    # Python Exports
+    LDFLAGS += -u __dummy -u _PyMac_Error -framework System -framework Python \
+-framework CoreServices -framework Foundation
+    DBG_LDFLAGS += -u __dummy -u _PyMac_Error -framework System -framework Python \
+-framework CoreServices -framework Foundation
 endif
 
 ifeq ($(OS),freebsd)

--Boundary-00=_ookA/ami9fGqIlR--