== FFMPEG ==
[blender.git] / SConstruct
index 813942c29e5eb8e157ba9a96ef72a64712826340..2cacb91d10342114d1b9ef5d2baf5fbd853b863f 100644 (file)
@@ -52,6 +52,7 @@ B = tools.Blender
 platform = sys.platform
 quickie = None
 quickdebug = None
+nsis_build = None
 
 ##### BEGIN SETUP #####
 
@@ -70,6 +71,11 @@ if platform=='win32':
 
 if not use_color=='1':
     B.bc.disable()
+    
+ #on defaut white Os X terminal, some colors are totally unlegible
+if platform=='darwin':
+    B.bc.OKGREEN = '\033[34m'
+    B.bc.WARNING = '\033[36m'
 
 # arguments
 print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
@@ -100,7 +106,7 @@ if quickie:
     B.quickie=string.split(quickie,',')
 else:
     B.quickie=[]
-
+    
 toolset = B.arguments.get('BF_TOOLSET', None)
 if toolset:
     print "Using " + toolset
@@ -109,6 +115,8 @@ if toolset:
         env.Tool('mstoolkit', ['tools'])
     else:
         env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
+        if env:
+            btools.SetupSpawn(env)
 else:
     env = BlenderEnvironment(ENV = os.environ)
 
@@ -116,7 +124,7 @@ if not env:
     print "Could not create a build environment"
     Exit()
 
-env.SConscriptChdir(0)
+
 cc = B.arguments.get('CC', None)
 cxx = B.arguments.get('CXX', None)
 if cc:
@@ -129,6 +137,8 @@ if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
 elif env['CC'] in ['gcc'] and sys.platform=='win32':
     platform = 'win32-mingw'
 
+env.SConscriptChdir(0)
+
 crossbuild = B.arguments.get('BF_CROSS', None)
 if crossbuild and platform!='win32':
     platform = 'linuxcross'
@@ -223,7 +233,7 @@ B.root_build_dir = env['BF_BUILDDIR']
 env['BUILDDIR'] = B.root_build_dir
 if not B.root_build_dir[-1]==os.sep:
     B.root_build_dir += os.sep
-
+    
 # We do a shortcut for clean when no quicklist is given: just delete
 # builddir without reading in SConscripts
 do_clean = None
@@ -231,13 +241,16 @@ if 'clean' in B.targets:
     do_clean = True
 
 if not quickie and do_clean:
-    print B.bc.HEADER+'Cleaning...'+B.bc.ENDC
-    dirs = os.listdir(B.root_build_dir)
-    for dir in dirs:
-        if os.path.isdir(B.root_build_dir + dir) == 1:
-            print "clean dir %s"%(B.root_build_dir+dir)
-            shutil.rmtree(B.root_build_dir+dir)
-    print B.bc.OKGREEN+'...done'+B.bc.ENDC
+    if os.path.exists(B.root_build_dir):
+        print B.bc.HEADER+'Cleaning...'+B.bc.ENDC
+        dirs = os.listdir(B.root_build_dir)
+        for dir in dirs:
+            if os.path.isdir(B.root_build_dir + dir) == 1:
+                print "clean dir %s"%(B.root_build_dir+dir)
+                shutil.rmtree(B.root_build_dir+dir)
+        print B.bc.OKGREEN+'...done'+B.bc.ENDC
+    else:
+        print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
     Exit()
 
 if not os.path.isdir ( B.root_build_dir):
@@ -266,8 +279,6 @@ B.init_lib_dict()
 ##### END SETUP ##########
 
 Export('env')
-#Export('root_build_dir') # this one is still needed for makesdna
-##TODO: improve makesdna usage
 
 BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
 SConscript(B.root_build_dir+'/intern/SConscript')
@@ -301,7 +312,22 @@ if env['WITH_BF_PLAYER']:
 
 #------------ INSTALL
 
-blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
+#-- binaries
+blenderinstall = []
+if  env['OURPLATFORM']=='darwin':
+    for prg in B.program_list:
+        bundle = '%s.app' % prg[0]
+        bundledir = os.path.dirname(bundle)
+        for dp, dn, df in os.walk(bundle):
+            if 'CVS' in dn:
+                dn.remove('CVS')
+            if '.svn' in dn:
+                dn.remove('.svn')
+            dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
+            source=[dp+os.sep+f for f in df]
+            blenderinstall.append(env.Install(dir=dir,source=source))
+else:
+    blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
 
 #-- .blender
 dotblendlist = []
@@ -309,6 +335,8 @@ dottargetlist = []
 for dp, dn, df in os.walk('bin/.blender'):
     if 'CVS' in dn:
         dn.remove('CVS')
+    if '.svn' in dn:
+        dn.remove('.svn')
     for f in df:
         dotblendlist.append(dp+os.sep+f)
         dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
@@ -324,6 +352,8 @@ scriptpath='release/scripts'
 for dp, dn, df in os.walk(scriptpath):
     if 'CVS' in dn:
         dn.remove('CVS')
+    if '.svn' in dn:
+        dn.remove('.svn')
     dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
     source=[dp+os.sep+f for f in df]
     scriptinstall.append(env.Install(dir=dir,source=source))
@@ -334,6 +364,8 @@ plugtargetlist = []
 for tp, tn, tf in os.walk('release/plugins'):
     if 'CVS' in tn:
         tn.remove('CVS')
+    if '.svn' in tn:
+        tn.remove('.svn')
     for f in tf:
         pluglist.append(tp+os.sep+f)
         plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
@@ -348,6 +380,8 @@ texttargetlist = []
 for tp, tn, tf in os.walk('release/text'):
     if 'CVS' in tn:
         tn.remove('CVS')
+    if '.svn' in tn:
+        tn.remove('.svn')
     for f in tf:
         textlist.append(tp+os.sep+f)
 
@@ -358,15 +392,15 @@ allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, t
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
     dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
                         '${LCGDIR}/png/lib/libpng.dll',
-                        '#release/windows/extra/python24.zip',
+                        '#release/windows/extra/python25.zip',
                         '#release/windows/extra/zlib.pyd',
                         '${LCGDIR}/sdl/lib/SDL.dll',
                         '${LCGDIR}/zlib/lib/zlib.dll',
                         '${LCGDIR}/tiff/lib/libtiff.dll']
     if env['BF_DEBUG']:
-        dllsources.append('${LCGDIR}/python/lib/python24_d.dll')
+        dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
     else:
-        dllsources.append('${LCGDIR}/python/lib/python24.dll')
+        dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
     if env['OURPLATFORM'] == 'win32-mingw':
         dllsources += ['${LCGDIR}/pthreads/lib/pthreadGC2.dll']
     else:
@@ -376,24 +410,17 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
     if env['WITH_BF_FFMPEG']:
         dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
                         '${LCGDIR}/ffmpeg/lib/avformat-51.dll',
-                        '${LCGDIR}/ffmpeg/lib/avutil-49.dll',
-                        '${LCGDIR}/ffmpeg/lib/libdts.dll',
-                        '${LCGDIR}/ffmpeg/lib/libfaac.dll',
-                        '${LCGDIR}/ffmpeg/lib/libfaad.dll',
-                        '${LCGDIR}/ffmpeg/lib/libgsm.dll',
-                        '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
-                        '${LCGDIR}/ffmpeg/lib/libogg-0.dll',
-                        '${LCGDIR}/ffmpeg/lib/libvorbis-0.dll',
-                        '${LCGDIR}/ffmpeg/lib/libvorbisenc-2.dll',
-                        '${LCGDIR}/ffmpeg/lib/libx264-54.dll',
-                        '${LCGDIR}/ffmpeg/lib/postproc-51.dll',
-                        '${LCGDIR}/ffmpeg/lib/xvidcore.dll']
+                        '${LCGDIR}/ffmpeg/lib/avutil-49.dll']
     windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
     allinstall += windlls
 
 installtarget = env.Alias('install', allinstall)
 bininstalltarget = env.Alias('install-bin', blenderinstall)
 
+nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
+nsiscmd = env.Command('nsisinstaller', None, nsisaction)
+nsisalias = env.Alias('nsis', nsiscmd)
+
 if env['WITH_BF_PLAYER']:
     blenderplayer = env.Alias('blenderplayer', B.program_list)
     Depends(blenderplayer,installtarget)
@@ -402,8 +429,12 @@ if not env['WITH_BF_GAMEENGINE']:
     blendernogame = env.Alias('blendernogame', B.program_list)
     Depends(blendernogame,installtarget)
 
+Depends(nsiscmd, allinstall)
+
 Default(B.program_list)
-Default(installtarget)
+
+if not env['WITHOUT_BF_INSTALL']:
+       Default(installtarget)
 
 #------------ RELEASE
 # TODO: zipup the installation