* add space_file sconscript reference too.
[blender-staging.git] / tools / Blender.py
1 #!/usr/bin/env python
2
3 """
4 tools.BlenderEnvironment
5
6 This environment builds on SCons.Script.SConscript.SConsEnvironment
7
8 * library repository
9 * custom printout
10 * wrapper functions
11
12 TODO: clean up and sanitise code - crosscheck with btools and SConstruct
13 to kill any code duplication
14
15 """
16
17 import os.path
18 import string
19 import glob
20 import time
21 import sys
22
23 from SCons.Script.SConscript import SConsEnvironment
24 import SCons.Action
25 import SCons.Util
26 import SCons.Builder
27 import SCons.Tool
28 import bcolors
29 bc = bcolors.bcolors()
30
31 Split = SCons.Util.Split
32 Action = SCons.Action.Action
33 Builder = SCons.Builder.Builder
34 GetBuildPath = SConsEnvironment.GetBuildPath
35
36 # a few globals
37 root_build_dir = ''
38 doc_build_dir = ''
39 quickie = None # Anything else than None if BF_QUICK has been passed
40 quicklist = [] # The list of libraries/programs to compile during a quickie
41 program_list = [] # A list holding Nodes to final binaries, used to create installs
42 arguments = None
43 targets = None
44 resources = []
45
46 #some internals
47 blenderdeps = [] # don't manipulate this one outside this module!
48
49 ##### LIB STUFF ##########
50
51 possible_types = ['core'] # can be set in ie. SConstruct
52 libs = {}
53
54 def getresources():
55         return resources
56
57 def init_lib_dict():
58         for pt in possible_types:
59                 libs[pt] = {}
60
61 # helper func for add_lib_to_dict
62 def internal_lib_to_dict(dict = None, libtype = None, libname = None, priority = 100):
63         if not libname in dict[libtype]:
64                 done = None
65                 while not done:
66                         if dict[libtype].has_key(priority):
67                                 priority = priority + 1
68                         else:
69                                 done = True
70                 dict[libtype][priority] = libname
71
72 # libtype and priority can both be lists, for defining lib in multiple places
73 def add_lib_to_dict(env, dict = None, libtype = None, libname = None, priority = 100):
74         if not dict or not libtype or not libname:
75                 print "Passed wrong arg"
76                 env.Exit()
77
78         if type(libtype) is str and type(priority) is int:
79                 internal_lib_to_dict(dict, libtype, libname, priority)
80         elif type(libtype) is list and type(priority) is list:
81                 if len(libtype)==len(priority):
82                         for lt, p in zip(libtype, priority):
83                                 internal_lib_to_dict(dict, lt, libname, p)
84                 else:
85                         print "libtype and priority lists are unequal in length"
86                         env.Exit()
87         else:
88                 print "Wrong type combinations for libtype and priority. Only str and int or list and list"
89                 env.Exit()
90
91 def create_blender_liblist(lenv = None, libtype = None):
92         if not lenv or not libtype:
93                 print "missing arg"
94
95         lst = []
96         if libtype in possible_types:
97                 curlib = libs[libtype]
98                 sortlist = curlib.keys()
99                 sortlist.sort()
100                 for sk in sortlist:
101                         v = curlib[sk]
102                         target = root_build_dir + 'lib/'+lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']
103                         if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
104                                 target = '#'+target
105                         lst.append(target)
106
107         return lst
108
109 ## TODO: static linking
110 def setup_staticlibs(lenv):
111         statlibs = [
112                 #here libs for static linking
113         ]
114         libincs = [
115                 '/usr/lib',
116                 lenv['BF_OPENGL_LIBPATH'],
117                 lenv['BF_JPEG_LIBPATH'],
118                 lenv['BF_PNG_LIBPATH'],
119                 lenv['BF_ZLIB_LIBPATH'],
120                 lenv['BF_ICONV_LIBPATH']
121                 ]
122
123         if lenv['WITH_BF_PYTHON']:
124                 libincs += Split(lenv['BF_PYTHON_LIBPATH'])
125         if lenv['WITH_BF_SDL']:
126                 libincs += Split(lenv['BF_SDL_LIBPATH'])
127         if lenv['WITH_BF_FFMPEG']:
128                 libincs += Split(lenv['BF_FFMPEG_LIBPATH'])
129         if lenv['WITH_BF_STATICCXX']:
130                 statlibs += Split(lenv['BF_CXX_LIB_STATIC'])
131         if lenv['WITH_BF_OPENEXR']:
132                 libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
133                 if lenv['WITH_BF_STATICOPENEXR']:
134                         statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
135         if lenv['WITH_BF_INTERNATIONAL']:
136                 libincs += Split(lenv['BF_GETTEXT_LIBPATH'])
137                 libincs += Split(lenv['BF_FREETYPE_LIBPATH'])
138         if lenv['WITH_BF_OPENAL']:
139                 libincs += Split(lenv['BF_OPENAL_LIBPATH'])
140                 if lenv['WITH_BF_STATICOPENAL']:
141                         statlibs += Split(lenv['BF_OPENAL_LIB_STATIC'])
142         if lenv['WITH_BF_STATICOPENGL']:
143                 statlibs += Split(lenv['BF_OPENGL_LIB_STATIC'])
144
145         if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']:
146                 statlibs += Split(lenv['BF_PYTHON_LIB_STATIC'])
147
148         if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'):
149                 libincs += Split(lenv['BF_PTHREADS_LIBPATH'])
150
151         return statlibs, libincs
152
153 def setup_syslibs(lenv):
154         syslibs = [
155                 
156                 lenv['BF_JPEG_LIB'],
157                 lenv['BF_PNG_LIB'],
158                 lenv['BF_ZLIB_LIB']
159                 ]
160
161         if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']:
162                 if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc'):
163                         syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
164                 else:
165                         syslibs.append(lenv['BF_PYTHON_LIB'])
166         if lenv['WITH_BF_INTERNATIONAL']:
167                 syslibs += Split(lenv['BF_FREETYPE_LIB'])
168                 syslibs += Split(lenv['BF_GETTEXT_LIB'])
169         if lenv['WITH_BF_OPENAL']:
170                 if not lenv['WITH_BF_STATICOPENAL']:
171                         syslibs += Split(lenv['BF_OPENAL_LIB'])
172         if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc':
173                 if lenv['CC'] == 'cl.exe':
174                         syslibs += ['vcomp']
175                 else:
176                         syslibs += ['gomp']
177         if lenv['WITH_BF_ICONV']:
178                 syslibs += Split(lenv['BF_ICONV_LIB'])
179         if lenv['WITH_BF_OPENEXR']:
180                 if not lenv['WITH_BF_STATICOPENEXR']:
181                         syslibs += Split(lenv['BF_OPENEXR_LIB'])
182         if lenv['WITH_BF_FFMPEG']:
183                 syslibs += Split(lenv['BF_FFMPEG_LIB'])
184                 if lenv['WITH_BF_OGG']:
185                         syslibs += Split(lenv['BF_OGG_LIB'])
186         if lenv['WITH_BF_SDL']:
187                 syslibs += Split(lenv['BF_SDL_LIB'])
188         if not lenv['WITH_BF_STATICOPENGL']:
189                 syslibs += Split(lenv['BF_OPENGL_LIB'])
190         if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross'):
191                 syslibs += Split(lenv['BF_PTHREADS_LIB'])
192
193         syslibs += Split(lenv['LLIBS'])
194
195         return syslibs
196
197 def propose_priorities():
198         print bc.OKBLUE+"Priorities:"+bc.ENDC
199         for t in possible_types:
200                 print bc.OKGREEN+"\t"+t+bc.ENDC
201                 new_priority = 0
202                 curlib = libs[t]
203                 sortlist = curlib.keys()
204                 sortlist.sort()
205
206                 for sk in sortlist:
207                         v = curlib[sk]
208                         #for p,v in sorted(libs[t].iteritems()):
209                         print "\t\t",new_priority, v
210                         new_priority += 5
211
212 ## TODO: see if this can be made in an emitter
213 def buildinfo(lenv, build_type):
214         """
215         Generate a buildinfo object
216         """
217         build_date = time.strftime ("%Y-%m-%d")
218         build_time = time.strftime ("%H:%M:%S")
219         build_rev = os.popen('svnversion').read()[:-1] # remove \n
220
221         obj = []
222         if lenv['BF_BUILDINFO']:
223                 if sys.platform=='win32':
224                         build_info_file = open("source/creator/winbuildinfo.h", 'w')
225                         build_info_file.write("char *build_date=\"%s\";\n"%build_date)
226                         build_info_file.write("char *build_time=\"%s\";\n"%build_time)
227                         build_info_file.write("char *build_rev=\"%s\";\n"%build_rev)
228                         build_info_file.write("char *build_platform=\"win32\";\n")
229                         build_info_file.write("char *build_type=\"dynamic\";\n")
230                         build_info_file.close()
231                         lenv.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
232                 else:
233                         lenv.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
234                                                                                 'BUILD_DATE=\'"%s"\''%(build_date),
235                                                                                 'BUILD_TYPE=\'"dynamic"\'',
236                                                                                 'BUILD_REV=\'"%s"\''%(build_rev),
237                                                                                 'NAN_BUILDINFO',
238                                                                                 'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
239                 obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type,
240                                                 [root_build_dir+'source/creator/buildinfo.c'])]
241         return obj
242
243 ##### END LIB STUFF ############
244
245 ##### ACTION STUFF #############
246
247 def my_compile_print(target, source, env):
248         a = '%s' % (source[0])
249         d, f = os.path.split(a)
250         return bc.OKBLUE+"Compiling"+bc.ENDC +" ==> '"+bc.OKGREEN+"%s" % (f) + "'"+bc.ENDC
251
252 def my_moc_print(target, source, env):
253         a = '%s' % (source[0])
254         d, f = os.path.split(a)
255         return bc.OKBLUE+"Creating MOC"+bc.ENDC+ " ==> '"+bc.OKGREEN+"%s" %(f) + "'"+bc.ENDC
256
257 def my_linking_print(target, source, env):
258         t = '%s' % (target[0])
259         d, f = os.path.split(t)
260         return bc.OKBLUE+"Linking library"+bc.ENDC +" ==> '"+bc.OKGREEN+"%s" % (f) + "'"+bc.ENDC
261
262 def my_program_print(target, source, env):
263         t = '%s' % (target[0])
264         d, f = os.path.split(t)
265         return bc.OKBLUE+"Linking program"+bc.ENDC +" ==> '"+bc.OKGREEN+"%s" % (f) + "'"+bc.ENDC
266
267 def msvc_hack(env):
268         static_lib = SCons.Tool.createStaticLibBuilder(env)
269         program = SCons.Tool.createProgBuilder(env)
270         
271         env['BUILDERS']['Library'] = static_lib
272         env['BUILDERS']['StaticLibrary'] = static_lib
273         env['BUILDERS']['Program'] = program
274                 
275 def set_quiet_output(env):
276         mycaction = Action("$CCCOM", strfunction=my_compile_print)
277         myshcaction = Action("$SHCCCOM", strfunction=my_compile_print)
278         mycppaction = Action("$CXXCOM", strfunction=my_compile_print)
279         myshcppaction = Action("$SHCXXCOM", strfunction=my_compile_print)
280         mylibaction = Action("$ARCOM", strfunction=my_linking_print)
281         mylinkaction = Action("$LINKCOM", strfunction=my_program_print)
282
283         static_ob, shared_ob = SCons.Tool.createObjBuilders(env)
284         static_ob.add_action('.c', mycaction)
285         static_ob.add_action('.cpp', mycppaction)
286         shared_ob.add_action('.c', myshcaction)
287         shared_ob.add_action('.cpp', myshcppaction)
288
289         static_lib = SCons.Builder.Builder(action = mylibaction,
290                                                                            emitter = '$LIBEMITTER',
291                                                                            prefix = '$LIBPREFIX',
292                                                                            suffix = '$LIBSUFFIX',
293                                                                            src_suffix = '$OBJSUFFIX',
294                                                                            src_builder = 'StaticObject')
295
296         program = SCons.Builder.Builder(action = mylinkaction,
297                                                                         emitter = '$PROGEMITTER',
298                                                                         prefix = '$PROGPREFIX',
299                                                                         suffix = '$PROGSUFFIX',
300                                                                         src_suffix = '$OBJSUFFIX',
301                                                                         src_builder = 'Object',
302                                                                         target_scanner = SCons.Defaults.ProgScan)
303
304         env['BUILDERS']['Object'] = static_ob
305         env['BUILDERS']['StaticObject'] = static_ob
306         env['BUILDERS']['StaticLibrary'] = static_lib
307         env['BUILDERS']['Library'] = static_lib
308         env['BUILDERS']['Program'] = program
309
310 def  my_appit_print(target, source, env):
311         a = '%s' % (target[0])
312         d, f = os.path.split(a)
313         return "making bundle for " + f
314
315 def AppIt(target=None, source=None, env=None):
316         import shutil
317         import commands
318         import os.path
319         
320         
321         a = '%s' % (target[0])
322         builddir, b = os.path.split(a)
323
324         bldroot = env.Dir('.').abspath
325         binary = env['BINARYKIND']
326          
327         if b=='verse':
328                 print bc.OKBLUE+"no bundle for verse"+bc.ENDC 
329                 return 0
330         
331         sourcedir = bldroot + '/source/darwin/%s.app'%binary
332         sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary
333         targetinfo = builddir +'/' + "%s.app/Contents/Info.plist"%binary
334         cmd = builddir + '/' +'%s.app'%binary
335         
336         if os.path.isdir(cmd):
337                 shutil.rmtree(cmd)
338         shutil.copytree(sourcedir, cmd)
339         cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo)
340         commands.getoutput(cmd)
341         cmd = 'cp %s/%s %s/%s.app/Contents/MacOS/%s'%(builddir, binary,builddir, binary, binary)
342         commands.getoutput(cmd)
343         cmd = 'mkdir %s/%s.app/Contents/MacOS/.blender/'%(builddir, binary)
344         print cmd
345         commands.getoutput(cmd)
346         cmd = builddir + '/%s.app/Contents/MacOS/.blender'%binary
347         shutil.copy(bldroot + '/bin/.blender/.bfont.ttf', cmd)
348         shutil.copy(bldroot + '/bin/.blender/.Blanguages', cmd)
349         cmd = 'cp -R %s/bin/.blender/locale %s/%s.app/Contents/Resources/'%(bldroot,builddir,binary)
350         commands.getoutput(cmd) 
351         cmd = 'cp -R %s/bin/.blender/locale %s/%s.app/Contents/MacOS/.blender/'%(bldroot,builddir,binary)
352         commands.getoutput(cmd) 
353         cmd = 'cp %s/bin/.blender/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,builddir,binary)
354         commands.getoutput(cmd) 
355         cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/.blender/'%(bldroot,builddir,binary)
356         commands.getoutput(cmd)
357         cmd = 'chmod +x  %s/%s.app/Contents/MacOS/%s'%(builddir,binary, binary)
358         commands.getoutput(cmd)
359         cmd = 'find %s/%s.app -name .svn -prune -exec rm -rf {} \;'%(builddir, binary)
360         commands.getoutput(cmd)
361         cmd = 'find %s/%s.app -name .DS_Store -exec rm -rf {} \;'%(builddir, binary)
362         commands.getoutput(cmd)
363
364 #### END ACTION STUFF #########
365
366 def bsc(env, target, source):
367         
368         bd = os.path.dirname(target[0].abspath)
369         bscfile = '\"'+target[0].abspath+'\"'
370         bscpathcollect = '\"'+bd + os.sep + '*.sbr\"'
371         bscpathtmp = '\"'+bd + os.sep + 'bscmake.tmp\"'
372
373         os.system('dir /b/s '+bscpathcollect+' >'+bscpathtmp)
374
375         myfile = open(bscpathtmp[1:-1], 'r')
376         lines = myfile.readlines()
377         myfile.close()
378
379         newfile = open(bscpathtmp[1:-1], 'w')
380         for l in lines:
381                 newfile.write('\"'+l[:-1]+'\"\n')
382         newfile.close()
383                                 
384         os.system('bscmake /nologo /n /o'+bscfile+' @'+bscpathtmp)
385         os.system('del '+bscpathtmp)
386
387 class BlenderEnvironment(SConsEnvironment):
388
389         def BlenderRes(self=None, libname=None, source=None, libtype=['core'], priority=[100]):
390                 global libs
391                 if not self or not libname or not source:
392                         print bc.FAIL+'Cannot continue.  Missing argument for BlenderRes '+libname+bc.ENDC
393                         self.Exit()
394                 if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross'):
395                         print bc.FAIL+'BlenderRes is for windows only!'+bc.END
396                         self.Exit()
397                 
398                 print bc.HEADER+'Configuring resource '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC
399                 lenv = self.Clone()
400                 res = lenv.RES('#'+root_build_dir+'lib/'+libname, source)
401                 
402                 SConsEnvironment.Default(self, res)
403                 resources.append(res)
404
405         def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None):          
406                 if not self or not libname or not sources:
407                         print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC
408                         self.Exit()
409
410                 def list_substring(quickie, libname):
411                         for q in quickie:
412                                 if libname.find(q) != -1:
413                                         return True
414                         return False
415
416                 if list_substring(quickie, libname) or len(quickie)==0:
417                         if list_substring(quickdebug, libname):
418                                 print bc.HEADER+'Configuring library '+bc.ENDC+bc.OKGREEN+libname +bc.ENDC+bc.OKBLUE+ " (debug mode)" + bc.ENDC
419                         else:
420                                 print bc.HEADER+'Configuring library '+bc.ENDC+bc.OKGREEN+libname + bc.ENDC
421                         lenv = self.Clone()
422                         lenv.Append(CPPPATH=includes)
423                         lenv.Append(CPPDEFINES=defines)
424                         if lenv['BF_DEBUG'] or (libname in quickdebug):
425                                         lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
426                                         lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
427                                         lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
428                         else:
429                                         lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
430                                         lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
431                                         lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
432                         if lenv['BF_PROFILE']:
433                                         lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
434                                         lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
435                                         lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
436                         if compileflags:
437                                 lenv.Append(CFLAGS = compileflags)
438                         if cc_compileflags:
439                                 lenv.Append(CCFLAGS = cc_compileflags)
440                         if cxx_compileflags:
441                                 lenv.Append(CXXFLAGS = cxx_compileflags)
442                         lenv.Append(CFLAGS = lenv['C_WARN'])
443                         lenv.Append(CCFLAGS = lenv['CC_WARN'])
444                         lenv.Append(CXXFLAGS = lenv['CXX_WARN'])
445                         
446                         targetdir = root_build_dir+'lib/' + libname
447                         if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
448                                 targetdir = '#'+targetdir
449                         lib = lenv.Library(target= targetdir, source=sources)
450                         SConsEnvironment.Default(self, lib) # we add to default target, because this way we get some kind of progress info during build
451                 else:
452                         print bc.WARNING+'Not building '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC+' for '+bc.OKBLUE+'BF_QUICK'+bc.ENDC
453                 # note: libs is a global
454                 add_lib_to_dict(self, libs, libtype, libname, priority)
455
456         def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None, binarykind=''):
457                 print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
458                 lenv = self.Clone()
459                 if lenv['OURPLATFORM'] in ['win32-vc', 'cygwin']:
460                         lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
461                         if lenv['BF_DEBUG']:
462                                 lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb'])
463                 if  lenv['OURPLATFORM']=='linux2':
464                         lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
465                         if lenv['WITH_BF_PYTHON']:
466                                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
467                 if  lenv['OURPLATFORM']=='sunos5':
468                         lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
469                         if lenv['WITH_BF_PYTHON']:
470                                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
471                         if lenv['CXX'].endswith('CC'):
472                                  lenv.Replace(LINK = '$CXX')
473                 if  lenv['OURPLATFORM']=='darwin':
474                         lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
475                         if lenv['WITH_BF_PYTHON']:
476                                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
477                         lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS'])
478                 if lenv['BF_PROFILE']:
479                                 lenv.Append(LINKFLAGS = lenv['BF_PROFILE_FLAGS'])
480                 lenv.Append(CPPPATH=includes)
481                 if root_build_dir[0]==os.sep or root_build_dir[1]==':':
482                         lenv.Append(LIBPATH=root_build_dir + '/lib')
483                 lenv.Append(LIBPATH=libpath)
484                 lenv.Append(LIBS=libs)
485                 if lenv['WITH_BF_QUICKTIME']:
486                          lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
487                          lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
488                 prog = lenv.Program(target=builddir+'bin/'+progname, source=sources)
489                 if lenv['BF_DEBUG'] and lenv['OURPLATFORM']=='win32-vc' and lenv['BF_BSC']:
490                         f = lenv.File(progname + '.bsc', builddir)
491                         brs = lenv.Command(f, prog, [bsc])
492                         SConsEnvironment.Default(self, brs)
493                 SConsEnvironment.Default(self, prog)
494                 program_list.append(prog)
495                 if  lenv['OURPLATFORM']=='darwin':
496                         lenv['BINARYKIND'] = binarykind
497                         lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
498                 return prog
499
500         def Glob(lenv, pattern):
501                 path = string.replace(GetBuildPath(lenv,'SConscript'),'SConscript', '')
502                 files = []
503                 for i in glob.glob(path + pattern):
504                         files.append(string.replace(i, path, ''))
505                 return files