packaging in bundle of the Os X binary. result in the bin of build dir
authorJean-Luc Peurière <jlp@nerim.net>
Sun, 5 Feb 2006 11:28:28 +0000 (11:28 +0000)
committerJean-Luc Peurière <jlp@nerim.net>
Sun, 5 Feb 2006 11:28:28 +0000 (11:28 +0000)
Important note, the install target install only the binary not the
packaged bunde for the moment

SConstruct
config/darwin-config.py
tools/Blender.py

index cd63bc5fd360eb924bc3f77646e91361564411eb..82473f086adcf610f05f8c1ef47b8220720a744c 100644 (file)
@@ -57,6 +57,7 @@ B.possible_types = ['core', 'common', 'blender', 'intern',
                     'international', 'game', 'game2',
                     'player', 'player2', 'system']
 
+B.binarykind = ['blender' , 'blenderplayer']
 ##################################
 # target and argument validation #
 ##################################
@@ -223,7 +224,7 @@ dobj = B.buildinfo(env, "dynamic")
 thestatlibs, thelibincs = B.setup_staticlibs(env)
 thesyslibs = B.setup_syslibs(env)
 
-env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs)
+env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
 if env['WITH_BF_PLAYER']:
     playerlist = B.create_blender_liblist(env, 'player')
     playerlist += B.create_blender_liblist(env, 'core')
@@ -233,7 +234,7 @@ if env['WITH_BF_PLAYER']:
     playerlist += B.create_blender_liblist(env, 'game')
     playerlist += B.create_blender_liblist(env, 'game2')
     playerlist += B.create_blender_liblist(env, 'player2')
-    env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs)
+    env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
 
 ##### Now define some targets
 
index 64ede2286709fe6df7082f55fd97dde130dc672a..5450897b431ad55f797ab83d03e95c791ea90538 100644 (file)
@@ -62,7 +62,8 @@ BF_FTGL = '#extern/bFTGL'
 BF_FTGL_INC = BF_FTGL + '/include'
 BF_FTGL_LIB = 'extern_ftgl'
 
-WITH_BF_GAMEENGINE='false'
+WITH_BF_GAMEENGINE='true'
+WITH_BF_PLAYER='false'
 
 WITH_BF_ODE = 'false'
 BF_ODE = LCGDIR + '/ode'
index e3d4740d0e5671c5f8310a7096e4e4f10afd1382..54780738b9b3968ceb14db42469d0f6d92d1fd4f 100644 (file)
@@ -259,11 +259,57 @@ def set_quiet_output(env):
     env['BUILDERS']['Library'] = static_lib
     env['BUILDERS']['Program'] = program
 
+def  my_appit_print(target, source, env):
+       a = '%s' % (target[0])
+       d, f = os.path.split(a)
+       return "making bundle for " + f
+
+def AppIt(target=None, source=None, env=None):
+    import shutil
+    import commands
+    import os.path
+    
+    a = '%s' % (target[0])
+    builddir, b = os.path.split(a)
+    bldroot = env.Dir('.').abspath
+    binary = env['BINARYKIND']
+    
+    sourcedir = bldroot + '/source/darwin/%s.app'%binary
+    sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary
+    targetinfo = builddir +'/' + "%s.app/Contents/Info.plist"%binary
+    cmd = builddir + '/' +'%s.app'%binary
+    
+    if os.path.isdir(cmd):
+        shutil.rmtree(cmd)
+    shutil.copytree(sourcedir, cmd)
+    cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo)
+    commands.getoutput(cmd)
+    cmd = 'cp %s/%s %s/%s.app/Contents/MacOS/%s'%(builddir, binary,builddir, binary, binary)
+    commands.getoutput(cmd)
+    cmd = 'mkdir %s/%s.app/Contents/MacOS/.blender/'%(builddir, binary)
+    print cmd
+    commands.getoutput(cmd)
+    cmd = builddir + '/%s.app/Contents/MacOS/.blender'%binary
+    shutil.copy(bldroot + '/bin/.blender/.bfont.ttf', cmd)
+    shutil.copy(bldroot + '/bin/.blender/.Blanguages', cmd)
+    cmd = 'cp -R %s/bin/.blender/locale %s/%s.app/Contents/Resources/'%(bldroot,builddir,binary)
+    commands.getoutput(cmd)    
+    cmd = 'cp -R %s/bin/.blender/locale %s/%s.app/Contents/MacOS/.blender/'%(bldroot,builddir,binary)
+    commands.getoutput(cmd)    
+    cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/.blender/'%(bldroot,builddir,binary)
+    commands.getoutput(cmd)
+    cmd = 'chmod +x  %s/%s.app/Contents/MacOS/%s'%(builddir,binary, binary)
+    commands.getoutput(cmd)
+    cmd = 'find %s/%s.app -name CVS -prune -exec rm -rf {} \;'%(builddir, binary)
+    commands.getoutput(cmd)
+    cmd = 'find %s/%s.app -name .DS_Store -exec rm -rf {} \;'%(builddir, binary)
+    commands.getoutput(cmd)
 
 #### END ACTION STUFF #########
 
 class BlenderEnvironment(SConsEnvironment):
 
+
     def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None):
         if not self or not libname or not sources:
             print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC
@@ -293,7 +339,7 @@ class BlenderEnvironment(SConsEnvironment):
         # note: libs is a global
         add_lib_to_dict(libs, libtype, libname, priority)
 
-    def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None):
+    def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None, binarykind=''):
         print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
         lenv = self.Copy()
         if lenv['OURPLATFORM']=='win32-vc':
@@ -311,6 +357,9 @@ class BlenderEnvironment(SConsEnvironment):
         prog = lenv.Program(target=builddir+'bin/'+progname, source=sources)
         SConsEnvironment.Default(self, prog)
         program_list.append(prog)
+        if  lenv['OURPLATFORM']=='darwin':
+               lenv['BINARYKIND'] = binarykind
+               lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
 
 ## TODO: have register for libs/programs, so that we test only that
 #  which have expressed their need to be tested in their own sconscript