OSX: additionally choice to link against python-framework again
authorJens Verwiebe <info@jensverwiebe.de>
Tue, 30 Aug 2011 23:52:12 +0000 (23:52 +0000)
committerJens Verwiebe <info@jensverwiebe.de>
Tue, 30 Aug 2011 23:52:12 +0000 (23:52 +0000)
build_files/scons/config/darwin-config.py
build_files/scons/tools/Blender.py

index 06abaf4..c09f326 100644 (file)
@@ -104,14 +104,26 @@ BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
 #bz2 is a standard osx dynlib
 
-# python 3.1 uses precompiled libraries in bf svn /lib by default
 BF_PYTHON_VERSION = '3.2'
-BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
-# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
-BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
-BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
-# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
+WITH_BF_STATICPYTHON ='True'
+
+if BF_PYTHON_VERSION=='3.2' and WITH_BF_STATICPYTHON =='True':
+       # python 3.2 uses precompiled libraries in bf svn /lib by default
+
+       BF_PYTHON = LIBDIR + '/python'
+       BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+       # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+       BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
+       BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
+       # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
+else:
+       # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
+       
+       BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+       BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
+       BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
+       #BF_PYTHON_LIB = ''
+       BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
        
 WITH_BF_OPENAL = True
 #different lib must be used  following version of gcc
@@ -315,6 +327,10 @@ if WITH_BF_QUICKTIME:
        else:
                PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
 
+if WITH_BF_STATICPYTHON == 'False':
+               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
+
+
 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding the SystemStubs.a lib from 10.4
 #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
 if MACOSX_DEPLOYMENT_TARGET == '10.7':
index 94d0973..50486da 100644 (file)
@@ -536,7 +536,10 @@ def AppIt(target=None, source=None, env=None):
     print("Installing to %s"%(installdir))
     # TODO, use tar.
     python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip
-    print("unzipping to app-bundle: %s"%(python_zip))
+    if env['WITH_BF_STATICPYTHON'] == 'True':
+        print("unzipping to app-bundle: %s"%(python_zip))
+    else:
+        print("dynamic build - make sure to have python3.x-framework installed")
     bldroot = env.Dir('.').abspath
     binary = env['BINARYKIND']
      
@@ -569,9 +572,13 @@ def AppIt(target=None, source=None, env=None):
     commands.getoutput(cmd)
     cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
     commands.getoutput(cmd)
-    cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
-    commands.getoutput(cmd)
-    cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION)
+    if env['WITH_BF_STATICPYTHON'] == 'True':
+        cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(builddir,binary, VERSION)
+        commands.getoutput(cmd)
+        cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,builddir,binary,VERSION)
+        commands.getoutput(cmd) 
+
+    cmd = 'cp -R -L %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
     commands.getoutput(cmd)
 
     if binary == 'blender':#not copy everything for blenderplayer