* on OS X the 'blender$PROGSUFFIX' caused problems due to SCons expanding it too...
[blender-staging.git] / SConstruct
1 import string
2 import os
3 import time
4 import sys
5 from distutils import sysconfig
6 import SCons.Script
7
8 if sys.hexversion < 0x2030000:
9         print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
10         print
11         print "You need at least Python 2.3 to build Blender with SCons"
12         print
13         print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
14         sys.exit()
15
16 if sys.platform != 'win32':
17         sys.stdout = os.popen("tee build.log", "w")
18         sys.stderr = sys.stdout
19
20 # This is a flag to determine whether to read all sconscripts and
21 # set up the build environments or not
22 # when issuing 'scons clean' this is set to 1
23 # and all reading is skipped and a 'clean' target
24 # will clean the root_build_dir from all
25 # object files
26 enable_clean = 0
27
28 all_args = sys.argv[1:]
29 parser =  SCons.Script.OptParser()
30 options, targets = parser.parse_args(all_args)
31 if ('clean' in targets):
32         enable_clean = 1
33         
34 # Build directory.
35 root_build_dir = '..' + os.sep + 'build' + os.sep + sys.platform + os.sep
36
37 # Create the build directory. SCons does this automatically, but since we
38 # don't want to put scons-generated .sconsign files in the source tree, but in
39 # the root_build_dir, we have to create that dir ourselves before SCons tries
40 # to access/create the file containing .sconsign data.
41 if os.path.isdir (root_build_dir) == 0:
42     os.makedirs (root_build_dir)
43
44 # User configurable options file. This can be controlled by the user by running
45 # scons with the following argument: CONFIG=user_config_options_file
46 config_file = ARGUMENTS.get('CONFIG', 'config.opts')
47
48 # Blender version.
49 version='2.33a'
50 shortversion = '233a' # for wininst target -> nsis installer creation
51
52 sdl_env = Environment ()
53 freetype_env = Environment ()
54 env = Environment ()
55
56 if sys.platform == 'linux2' or sys.platform == 'linux-i386':
57     use_international = 'false'
58     use_gameengine = 'true'
59     use_openal = 'false'
60     use_fmod = 'false'
61     use_quicktime = 'false'
62     use_sumo = 'true'
63     use_ode = 'false'
64     use_buildinfo = 'true'
65     build_blender_dynamic = 'true'
66     build_blender_static = 'false'
67     build_blender_player = 'true'
68     build_blender_plugin = 'false'
69     release_flags = ['-O2']
70     debug_flags = ['-O2', '-g']
71     extra_flags = ['-pipe', '-funsigned-char']
72     cxxflags = []
73     defines = []
74     warn_flags = ['-Wall', '-W']
75     window_system = 'X11'
76     platform_libs = ['m', 'util', 'stdc++']
77     platform_libpath = []
78     platform_linkflags = ['-pthread']
79     extra_includes = []
80     # z library information
81     z_lib = ['z']
82     z_libpath = ['/usr/lib']
83     z_include = ['/usr/include']
84     # png library information
85     png_lib = ['png']
86     png_libpath = ['/usr/lib']
87     png_include = ['/usr/include']
88     # jpeg library information
89     jpeg_lib = ['jpeg']
90     jpeg_libpath = ['/usr/lib']
91     jpeg_include = ['/usr/include']
92     # OpenGL library information
93     opengl_lib = ['GL', 'GLU']
94     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
95     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
96     opengl_include = ['/usr/include']
97     # SDL library information
98     sdl_env.ParseConfig ('sdl-config --cflags --libs')
99     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
100     sdl_include = sdl_env.Dictionary()['CPPPATH']
101     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
102     sdl_lib = sdl_env.Dictionary()['LIBS']
103     # SOLID library information
104     solid_lib = []                                              # TODO
105     solid_libpath = []                                          # TODO
106     solid_include = ['#extern/solid']
107     qhull_lib = []                                              # TODO
108     qhull_libpath = []                                          # TODO
109     qhull_include = ['#extern/qhull/include']
110     # ODE library information
111     ode_lib = ['ode']
112     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
113     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
114     # Python library information
115     python_lib = ['python%d.%d' % sys.version_info[0:2]]
116     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
117     python_include = [sysconfig.get_python_inc ()]
118     python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
119     # International support information
120     ftgl_lib = ['ftgl']
121     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
122     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
123     freetype_env.ParseConfig ('pkg-config --cflags --libs freetype2 2>/dev/null || freetype-config --cflags --libs 2>/dev/null')
124     freetype_lib = freetype_env.Dictionary()['LIBS']
125     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
126     freetype_include = freetype_env.Dictionary()['CPPPATH']
127     gettext_lib = []
128     gettext_libpath = []
129     gettext_include = []
130     # OpenAL library information
131     openal_lib = ['openal']
132     openal_libpath = ['/usr/lib']
133     openal_include = ['/usr/include']
134
135 elif sys.platform == 'darwin':
136     use_international = 'true'
137     use_gameengine = 'true'
138     use_openal = 'true'
139     use_fmod = 'false'
140     use_quicktime = 'true'
141     use_precomp = 'true'
142     use_sumo = 'true'
143     use_ode = 'false'
144     use_buildinfo = 'true'
145     build_blender_dynamic = 'true'
146     build_blender_static = 'false'
147     build_blender_player = 'true'
148     build_blender_plugin = 'false'
149     # TODO: replace darwin-6.1-powerpc with the actual directiory on the
150     #       build machine
151     # darwin-6.1 is the name of cvs precomp folder
152     # a symbolic link named darwin-X.Y-powerpc must be manually done
153     #for now. X-Y is darwin kernel rev number
154     darwin_precomp = '#../lib/darwin-6.1-powerpc/'
155     fink_path = '/sw/'
156     # TODO : try -mpowerpc -mpowerpc-gopt -mpowerpc-gfxopt optims
157     #           doing actual profiling
158     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-ffast-math']
159     cxxflags = []
160     defines = ['_THREAD_SAFE', 'MT_NDEBUG']
161     if use_quicktime == 'true':
162         defines += ['WITH_QUICKTIME']
163     warn_flags = ['-Wall', '-W']
164     release_flags = ['-O3']
165     debug_flags = ['-g']
166     window_system = 'CARBON'
167     # z library information
168     z_lib = ['z']
169     z_libpath = []
170     z_include = []
171     # TODO : add a flag to allow each lib to be build from fink or precomp
172     #        without having to have to specify the path manually in config.opts.    
173     # png library information
174     png_lib = ['libpng']
175     png_libpath = [darwin_precomp + 'png/lib']
176     png_include = [darwin_precomp + 'png/include']
177     # jpeg library information
178     jpeg_lib = ['libjpeg']
179     jpeg_libpath = [darwin_precomp + 'jpeg/lib']
180     jpeg_include = [darwin_precomp + 'jpeg/include']
181     # OpenGL library information
182     opengl_lib = ['GL', 'GLU']
183     opengl_static = []
184     opengl_libpath = []
185     opengl_include = []
186     # SDL specific stuff.
187     sdl_env.ParseConfig ('sdl-config --cflags --libs')
188     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
189     # Want to use precompiled libraries?
190     if use_precomp == 'true':
191         sdl_include = [darwin_precomp + 'sdl/include']
192         sdl_libpath = [darwin_precomp + 'sdl/lib']
193         sdl_lib = ['libSDL.a']
194     platform_libs = ['stdc++'] 
195     extra_includes = ['/sw/include']
196     platform_libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries']
197     platform_linkflags = []
198     # SOLID library information
199     solid_lib = ['libsolid']                                          
200     solid_libpath = [darwin_precomp + 'solid/lib']                                          
201     solid_include = [darwin_precomp + 'solid/include']
202     qhull_lib = ['libqhull']                                          
203     qhull_libpath = [darwin_precomp + 'qhull/lib']                                          
204     qhull_include = [darwin_precomp + 'qhull/include']
205     # ODE library information
206     ode_lib = ['libode']                                             
207     ode_libpath = [darwin_precomp + 'ode/lib']                                          
208     ode_include = [darwin_precomp + 'ode/include/ode']
209     # Python variables.
210     # TODO : fill vars differently if we are on 10.2 or 10.3
211     # python_lib = ['python%d.%d' % sys.version_info[0:2]]
212     # python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
213     # python_include = [sysconfig.get_python_inc ()]
214     # python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
215     python_lib = []
216     python_libpath = ['/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config']
217     python_include = ['/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3']
218     python_linkflags = ['-u', '__dummy', '-u', '_PyMac_Error', 
219                         '-framework', 'System',
220                         '-framework', 'Python',
221                         '-framework', 'CoreServices',
222                         '-framework', 'Foundation']
223     # International stuff
224     ftgl_lib = ['ftgl']
225     ftgl_libpath = [darwin_precomp + 'ftgl/lib']
226     ftgl_include = [darwin_precomp + 'ftgl/include']
227     freetype_lib = ['libfreetype']
228     freetype_libpath = [darwin_precomp + 'freetype/lib']
229     freetype_include = [darwin_precomp + 'freetype/include']
230     gettext_lib = ['libintl']
231     gettext_libpath = [darwin_precomp + 'gettext/lib']
232     gettext_include = [darwin_precomp + 'gettext/include']
233     # OpenAL library information
234     openal_lib = ['libopenal']
235     openal_libpath = [darwin_precomp + 'openal/lib']
236     openal_include = [darwin_precomp + 'openal/include']
237
238 elif sys.platform == 'cygwin':
239     use_international = 'false'
240     use_gameengine = 'false'
241     use_openal = 'false'
242     use_fmod = 'false'
243     use_quicktime = 'false'
244     use_sumo = 'false'
245     use_ode = 'false'
246     use_buildinfo = 'false'
247     build_blender_dynamic = 'true'
248     build_blender_static = 'false'
249     build_blender_player = 'false'
250     build_blender_plugin = 'false'
251     release_flags = ['-O2']
252     debug_flags = ['-O2', '-g']
253     extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
254     cxxflags = []
255     defines = ['FREE_WINDOWS', 'NDEBUG']
256     warn_flags = ['-Wall', '-Wno-char-subscripts']
257     platform_libs = ['png', 'jpeg', 'netapi32',
258                      'opengl32', 'glu32', 'winmm',
259                      'mingw32']
260     platform_libpath = ['/usr/lib/w32api', '/lib/w32api']
261     platform_linkflags = ['-mwindows', '-mno-cygwin', '-mconsole']
262     window_system = 'WIN32'
263     extra_includes = []
264     # z library information
265     z_lib = ['z']
266     z_libpath = ['#../lib/windows/zlib/lib']
267     z_include = ['#../lib/windows/zlib/include']
268     # png library information
269     png_lib = ['png']
270     png_libpath = ['#../lib/windows/png/lib']
271     png_include = ['#../lib/windows/png/include']
272     # jpeg library information
273     jpeg_lib = ['jpeg']
274     jpeg_libpath = ['#../lib/windows/jpeg/lib']
275     jpeg_include = ['#../lib/windows/jpeg/include']
276     # OpenGL library information
277     opengl_lib = ['opengl32', 'glu32']
278     opengl_static = []
279     opengl_libpath = []
280     opengl_include = []
281     # SDL specific stuff.
282     sdl_include = ['#../lib/windows/sdl/include']
283     sdl_libpath = ['#../lib/windows/sdl/lib']
284     sdl_lib = ['SDL']
285     sdl_cflags = []
286     #sdl_cflags = '-DWIN32'
287     # SOLID library information
288     solid_lib = []                                              # TODO
289     solid_libpath = []                                          # TODO
290     solid_include = ['#extern/solid']
291     qhull_lib = []                                              # TODO
292     qhull_libpath = []                                          # TODO
293     qhull_include = ['#extern/qhull/include']
294     # ODE library information
295     ode_lib = ['ode']
296     ode_libpath = ['#../lib/windows/gcc/ode/lib']
297     ode_include = ['#../lib/windows/gcc/ode/include']
298     # Python library information
299     python_include = ['#../lib/windows/python/include/python2.2']
300     python_libpath = ['#../lib/windows/python/lib']
301     python_lib = ['python22']
302     python_linkflags = []
303     # International stuff
304     ftgl_lib = ['ftgl']
305     ftgl_libpath = ['#../lib/windows/gcc/ftgl/lib']
306     ftgl_include = ['#../lib/windows/gcc/ftgl/include']
307     freetype_lib = ['freetype']
308     freetype_libpath = ['#../lib/windows/gcc/freetype/lib']
309     freetype_include = ['#../lib/windows/gcc/freetype/include']
310     gettext_lib = []
311     gettext_libpath = []
312     gettext_include = []
313     # OpenAL library information
314     openal_lib = []
315     openal_libpath = []
316     openal_include = []
317
318 elif sys.platform == 'win32':
319     use_international = 'true'
320     use_gameengine = 'true'
321     use_openal = 'true'
322     use_fmod = 'false'
323     use_quicktime = 'true'
324     use_sumo = 'true'
325     use_ode = 'false'
326     use_buildinfo = 'true'
327     build_blender_dynamic = 'true'
328     build_blender_static = 'false'
329     build_blender_player = 'true'
330     build_blender_plugin = 'false'
331     release_flags = ['/Og', '/Ot', '/Ob1', '/Op', '/G6']
332     debug_flags = ['/Zi', '/Fr${TARGET.base}.sbr']
333     extra_flags = ['/EHsc', '/J', '/W3', '/Gd', '/MT']
334     cxxflags = []
335     defines = ['WIN32', '_CONSOLE']
336     defines += ['WITH_QUICKTIME']
337     defines += ['_LIB', 'USE_OPENAL']
338     defines += ['FTGL_LIBRARY_STATIC']
339     warn_flags = []
340     platform_libs = [ 'qtmlClient', 'soundsystem',
341                      'ws2_32', 'dxguid', 'vfw32', 'winmm',
342                      'iconv', 'kernel32', 'user32', 'gdi32',
343                      'winspool', 'comdlg32', 'advapi32', 'shell32',
344                      'ole32', 'oleaut32', 'uuid', 'odbc32', 'odbccp32',
345                      'libcmt', 'libc']
346     platform_libpath = ['#../lib/windows/iconv/lib',
347                         '#../lib/windows/QTDevWin/Libraries']
348     platform_linkflags = [
349                         '/SUBSYSTEM:CONSOLE',
350                         '/MACHINE:IX86',
351                         '/ENTRY:mainCRTStartup',
352                         '/INCREMENTAL:NO',
353                         '/NODEFAULTLIB:"msvcprt.lib"',
354                         '/NODEFAULTLIB:"glut32.lib"',
355                         '/NODEFAULTLIB:"libcd.lib"',
356                         #'/NODEFAULTLIB:"libc.lib"',
357                         '/NODEFAULTLIB:"libcpd.lib"',
358                         '/NODEFAULTLIB:"libcp.lib"',
359                         '/NODEFAULTLIB:"libcmtd.lib"',
360                         ]
361     window_system = 'WIN32'
362     extra_includes = []
363     if use_quicktime == 'true':
364         extra_includes += ['#../lib/windows/QTDevWin/CIncludes']
365     # z library information
366     z_lib = ['libz_st']
367     z_libpath = ['#../lib/windows/zlib/lib']
368     z_include = ['#../lib/windows/zlib/include']
369     # png library information
370     png_lib = ['libpng_st']
371     png_libpath = ['#../lib/windows/png/lib']
372     png_include = ['#../lib/windows/png/include']
373     # jpeg library information
374     jpeg_lib = ['libjpeg']
375     jpeg_libpath = ['#../lib/windows/jpeg/lib']
376     jpeg_include = ['#../lib/windows/jpeg/include']
377     # OpenGL library information
378     opengl_lib = ['opengl32', 'glu32']
379     opengl_static = []
380     opengl_libpath = []
381     opengl_include = ['/usr/include']
382     # SDL library information
383     sdl_include = ['#../lib/windows/sdl/include']
384     sdl_libpath = ['#../lib/windows/sdl/lib']
385     sdl_lib = ['SDL']
386     sdl_cflags = []
387     window_system = 'WIN32'
388     # SOLID library information
389     solid_lib = ['extern/solid']
390     solid_libpath = ['#../lib/windows/solid/lib']
391     solid_include = ['#extern/solid']
392     qhull_lib = ['qhull']
393     qhull_libpath = ['#../lib/windows/qhull/lib']
394     qhull_include = ['#extern/qhull/include']
395     # ODE library information
396     ode_lib = []                                                # TODO
397     ode_libpath = ['#../lib/windows/ode/lib']
398     ode_include = ['#../lib/windows/ode/include']
399     # Python lib name
400     python_include = ['#../lib/windows/python/include/python2.3']
401     python_libpath = ['#../lib/windows/python/lib']
402     python_lib = ['python23']
403     python_linkflags = []
404     # International stuff
405     ftgl_lib = ['ftgl_static_ST']
406     ftgl_libpath = ['#../lib/windows/ftgl/lib']
407     ftgl_include = ['#../lib/windows/ftgl/include']
408     freetype_lib = ['freetype2ST']
409     freetype_libpath = ['#../lib/windows/freetype/lib']
410     freetype_include = ['#../lib/windows/freetype/include']
411     gettext_lib = ['gnu_gettext']
412     gettext_libpath = ['#../lib/windows/gettext/lib']
413     gettext_include = ['#../lib/windows/gettext/include']
414     # OpenAL library information
415     openal_lib = ['openal_static']
416     openal_libpath = ['#../lib/windows/openal/lib']
417     openal_include = ['#../lib/windows/openal/include']
418
419 elif string.find (sys.platform, 'sunos') != -1:
420     use_international = 'true'
421     use_gameengine = 'false'
422     use_openal = 'false'
423     use_fmod = 'false'
424     use_quicktime = 'false'
425     use_sumo = 'false'
426     use_ode = 'false'
427     use_buildinfo = 'false'
428     build_blender_dynamic = 'true'
429     build_blender_static = 'false'
430     build_blender_player = 'false'
431     build_blender_plugin = 'false'
432     release_flags = ['-O2']
433     debug_flags = ['-O2', '-g']
434     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-DSUN_OGL_NO_VERTEX_MACROS']
435     cxxflags = []
436     defines = []
437     warn_flags = ['-Wall', '-W']
438     window_system = 'X11'
439     platform_libs = ['stdc++', 'dl', 'm']
440     platform_libpath = []
441     platform_linkflags = []
442     extra_includes = []
443     # z library information
444     z_lib = ['z']
445     z_libpath = []
446     z_include = []
447     # png library information
448     png_lib = ['png']
449     png_libpath = []
450     png_include = []
451     # jpeg library information
452     jpeg_lib = ['jpeg']
453     jpeg_libpath = []
454     jpeg_include = []
455     # OpenGL library information
456     opengl_lib = ['GL', 'GLU', 'X11']
457     opengl_static = []
458     opengl_libpath = ['/usr/openwin/include']
459     opengl_include = ['/usr/openwin/lib']
460     # SDL library information
461     sdl_env.ParseConfig ('sdl-config --cflags --libs')
462     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
463     sdl_include = sdl_env.Dictionary()['CPPPATH']
464     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
465     sdl_lib = sdl_env.Dictionary()['LIBS']
466     # SOLID library information
467     solid_lib = []                                              # TODO
468     solid_libpath = []                                          # TODO
469     solid_include = ['#extern/solid']
470     qhull_lib = []                                              # TODO
471     qhull_libpath = []                                          # TODO
472     qhull_include = ['#extern/qhull/include']
473     # ODE library information
474     ode_lib = []                                                # TODO
475     ode_libpath = []                                            # TODO
476     ode_include = ['#extern/ode/dist/include/ode']
477     # Python variables.
478     python_lib = ['python%d.%d' % sys.version_info[0:2]]
479     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
480     python_include = [sysconfig.get_python_inc ()]
481     python_linkflags = []
482     # International support information
483     ftgl_lib = ['ftgl']
484     ftgl_libpath = ['#../lib/solaris-2.8-sparc/ftgl/lib']
485     ftgl_include = ['#../lib/solaris-2.8-sparc/ftgl/include']
486     freetype_lib = ['freetype']
487     freetype_libpath = ['#../lib/solaris-2.8-sparc/freetype/lib']
488     freetype_include = ['#../lib/solaris-2.8-sparc/freetype/include']
489     gettext_lib = []
490     gettext_libpath = []
491     gettext_include = []
492     # OpenAL library information
493     openal_lib = []
494     openal_libpath = []
495     openal_include = []
496
497 elif string.find (sys.platform, 'irix') != -1:
498     use_international = 'false'
499     use_gameengine = 'false'
500     use_openal = 'false'
501     use_fmod = 'false'
502     use_quicktime = 'false'
503     use_sumo = 'false'
504     use_ode = 'false'
505     use_buildinfo = 'false'
506     build_blender_dynamic = 'true'
507     build_blender_static = 'false'
508     build_blender_player = 'false'
509     build_blender_plugin = 'false'
510     irix_precomp = '#../lib/irix-6.5-mips'
511     extra_flags = ['-n32', '-mips3', '-Xcpluscomm']
512     cxxflags = ['-n32', '-mips3', '-Xcpluscomm', '-LANG:std']
513     cxxflags += ['-LANG:libc_in_namespace_std=off']
514     
515     window_system = 'X11'
516     release_flags = ['-O2', '-OPT:Olimit=0']
517     debug_flags = ['-O2', '-g']
518     defines = []
519     warn_flags = ['-fullwarn', '-woff', '1001,1110,1201,1209,1355,1424,1681,3201']
520     platform_libs = ['movieGL', 'Xmu', 'Xext', 'X11',
521                      'c', 'm', 'dmedia', 'cl', 'audio',
522                      'Cio', 'pthread']
523     platform_libpath = ['/usr/lib32/mips3',
524                         '/lib/freeware/lib32',
525                         '/usr/lib32']
526     platform_linkflags = ['-mips3', '-n32']
527     extra_includes = ['/usr/freeware/include',
528                       '/usr/include']
529     # z library information
530     z_lib = ['z']
531     z_libpath = []
532     z_include = []
533     # png library information
534     png_lib = ['png']
535     png_libpath = [irix_precomp + '/png/lib']
536     png_include = [irix_precomp + '/png/include']
537     # jpeg library information
538     jpeg_lib = ['jpeg']
539     jpeg_libpath = [irix_precomp + '/jpeg/lib']
540     jpeg_include = [irix_precomp + '/jpeg/include']
541     # OpenGL library information
542     opengl_lib = ['GL', 'GLU']
543     opengl_static = []
544     opengl_libpath = []
545     opengl_include = []
546     # SDL library information
547     sdl_cflags = []
548     sdl_include = [irix_precomp + '/sdl/include/SDL']
549     sdl_libpath = [irix_precomp + '/sdl/lib']
550     sdl_lib = ['SDL', 'libSDL.a']
551     # SOLID library information
552     solid_lib = []                                              # TODO
553     solid_libpath = []                                          # TODO
554     solid_include = [irix_precomp + '/solid/include']
555     qhull_lib = []                                              # TODO
556     qhull_libpath = []                                          # TODO
557     qhull_include = ['#extern/qhull/include']
558     # ODE library information
559     ode_lib = []                                                # TODO
560     ode_libpath = []                                            # TODO
561     ode_include = [irix_precomp + '/ode/include']
562     # Python library information
563     python_libpath = [irix_precomp + '/python/lib/python2.2/config']
564     python_include = [irix_precomp + '/python/include/python2.2']
565     python_lib = ['python2.2']
566     python_linkflags = []
567     # International support information
568     ftgl_lib = ['ftgl']
569     ftgl_libpath = [irix_precomp + '/ftgl/lib']
570     ftgl_include = [irix_precomp + '/ftgl/include']
571     freetype_lib = ['freetype']
572     freetype_libpath = [irix_precomp + '/freetype/lib']
573     freetype_include = [irix_precomp + '/freetype/include']
574     gettext_lib = []
575     gettext_libpath = []
576     gettext_include = []
577     # OpenAL library information
578     openal_lib = []
579     openal_libpath = []
580     openal_include = []
581
582 elif string.find (sys.platform, 'hp-ux') != -1:
583     window_system = 'X11'
584     defines = []
585
586 elif sys.platform=='openbsd3':
587     print "Building for OpenBSD 3.x"
588     use_international = 'false'
589     use_gameengine = 'false'
590     use_openal = 'false'
591     use_fmod = 'false'
592     use_quicktime = 'false'
593     use_sumo = 'false'
594     use_ode = 'false'
595     use_buildinfo = 'true'
596     build_blender_dynamic = 'true'
597     build_blender_static = 'false'
598     build_blender_player = 'false'
599     build_blender_plugin = 'false'
600     release_flags = ['-O2']
601     debug_flags = ['-O2', '-g']
602     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
603     cxxflags = []
604     defines = []
605     warn_flags = ['-Wall','-W']
606     window_system = 'X11'
607     platform_libs = ['m', 'stdc++', 'pthread', 'util']
608     platform_libpath = []
609     platform_linkflags = []
610     extra_includes = []
611     z_lib = ['z']
612     z_libpath = ['/usr/lib']
613     z_include = ['/usr/include']
614     # png library information
615     png_lib = ['png']
616     png_libpath = ['/usr/local/lib']
617     png_include = ['/usr/local/include']
618     # jpeg library information
619     jpeg_lib = ['jpeg']
620     jpeg_libpath = ['/usr/local/lib']
621     jpeg_include = ['/usr/local/include']
622     # OpenGL library information
623     opengl_lib = ['GL', 'GLU']
624     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
625     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
626     opengl_include = ['/usr/X11R6/include/']
627     # SDL library information
628     sdl_env.ParseConfig ('sdl-config --cflags --libs')
629     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
630     sdl_include = sdl_env.Dictionary()['CPPPATH']
631     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
632     sdl_lib = sdl_env.Dictionary()['LIBS']
633     # SOLID library information
634     solid_lib = []                     # TODO
635     solid_libpath = []        # TODO
636     solid_include = ['#extern/solid']
637     qhull_lib = []       # TODO
638     qhull_libpath = []  # TODO
639     qhull_include = ['#extern/qhull/include']
640     # ODE library information
641     ode_lib = ['ode']
642     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
643     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
644     # Python library information
645     python_lib = ['python%d.%d' % sys.version_info[0:2]]
646     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
647     python_include = [sysconfig.get_python_inc ()]
648     python_linkflags = []
649     # International support information
650     ftgl_lib = ['ftgl']
651     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
652     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
653     freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
654     freetype_lib = freetype_env.Dictionary()['LIBS']
655     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
656     freetype_include = freetype_env.Dictionary()['CPPPATH']
657     gettext_lib = []
658     gettext_libpath = []
659     gettext_include = []
660     # OpenAL library information
661     openal_lib = ['openal']
662     openal_libpath = ['/usr/lib']
663     openal_include = ['/usr/include']
664
665 else:
666     print "Unknown platform %s"%sys.platform
667     exit
668
669 #-----------------------------------------------------------------------------
670 # End of platform specific section
671 #-----------------------------------------------------------------------------
672
673 #-----------------------------------------------------------------------------
674 # User configurable options to be saved in a config file.
675 #-----------------------------------------------------------------------------
676 # Checking for an existing config file - use that one if it exists,
677 # otherwise create one.
678 my_defines = []
679 my_ccflags = []
680 my_cxxflags = []
681 my_ldflags = []
682 if os.path.exists (config_file):
683     print "Using config file: " + config_file
684 else:
685     print "Creating new config file: " + config_file
686     env_dict = env.Dictionary()
687     config=open (config_file, 'w')
688     config.write ("# Configuration file containing user definable options.\n")
689     config.write ("VERSION = '2.33-cvs'\n")
690     config.write ("BUILD_BINARY = 'release'\n")
691     config.write ("USE_BUILDINFO = %r\n"%(use_buildinfo))
692     config.write ("BUILD_BLENDER_DYNAMIC = %r\n"%(build_blender_dynamic))
693     config.write ("BUILD_BLENDER_STATIC = %r\n"%(build_blender_static))
694     config.write ("BUILD_BLENDER_PLAYER = %r\n"%(build_blender_player))
695     config.write ("BUILD_BLENDER_PLUGIN = %r\n"%(build_blender_plugin))
696     config.write ("BUILD_DIR = %r\n"%(root_build_dir))
697     
698     config.write ("\n# Extra compiler flags can be defined here.\n")
699     config.write ("DEFINES = %s\n"%(my_defines))
700     config.write ("CCFLAGS = %s\n"%(my_ccflags))
701     config.write ("CXXFLAGS = %s\n"%(my_cxxflags))
702     config.write ("LDFLAGS = %s\n"%(my_ldflags))
703
704     config.write ("USE_INTERNATIONAL = %r\n"%(use_international))
705     config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
706     if use_ode == 'true':
707         config.write ("USE_PHYSICS = 'ode'\n")
708     else:
709         config.write ("USE_PHYSICS = 'solid'\n")
710     config.write ("USE_OPENAL = %r\n"%(use_openal))
711     config.write ("USE_FMOD = %r\n"%(use_fmod))
712     config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
713     config.write ("\n# Compiler information.\n")
714     config.write ("HOST_CC = %r\n"%(env_dict['CC']))
715     config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
716     config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
717     config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
718     config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
719     config.write ("PATH = %r\n"%(os.environ['PATH']))
720     config.write ("\n# External library information.\n")
721     config.write ("PLATFORM_LIBS = %r\n"%(platform_libs))
722     config.write ("PLATFORM_LIBPATH = %r\n"%(platform_libpath))
723     config.write ("PLATFORM_LINKFLAGS = %r\n"%(platform_linkflags))
724     config.write ("PYTHON_INCLUDE = %r\n"%(python_include))
725     config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath))
726     config.write ("PYTHON_LIBRARY = %r\n"%(python_lib))
727     config.write ("PYTHON_LINKFLAGS = %r\n"%(python_linkflags))
728     config.write ("SDL_CFLAGS = %r\n"%(sdl_cflags))
729     config.write ("SDL_INCLUDE = %r\n"%(sdl_include))
730     config.write ("SDL_LIBPATH = %r\n"%(sdl_libpath))
731     config.write ("SDL_LIBRARY = %r\n"%(sdl_lib))
732     config.write ("Z_INCLUDE = %r\n"%(z_include))
733     config.write ("Z_LIBPATH = %r\n"%(z_libpath))
734     config.write ("Z_LIBRARY = %r\n"%(z_lib))
735     config.write ("PNG_INCLUDE = %r\n"%(png_include))
736     config.write ("PNG_LIBPATH = %r\n"%(png_libpath))
737     config.write ("PNG_LIBRARY = %r\n"%(png_lib))
738     config.write ("JPEG_INCLUDE = %r\n"%(jpeg_include))
739     config.write ("JPEG_LIBPATH = %r\n"%(jpeg_libpath))
740     config.write ("JPEG_LIBRARY = %r\n"%(jpeg_lib))
741     config.write ("OPENGL_INCLUDE = %r\n"%(opengl_include))
742     config.write ("OPENGL_LIBPATH = %r\n"%(opengl_libpath))
743     config.write ("OPENGL_LIBRARY = %r\n"%(opengl_lib))
744     config.write ("OPENGL_STATIC = %r\n"%(opengl_static))
745     config.write ("\n# The following information is only necessary when you've enabled support for\n")
746     config.write ("# the game engine.\n")
747     config.write ("SOLID_INCLUDE = %r\n"%(solid_include))
748     config.write ("SOLID_LIBPATH = %r\n"%(solid_libpath))
749     config.write ("SOLID_LIBRARY = %r\n"%(solid_lib))
750     config.write ("QHULL_INCLUDE = %r\n"%(qhull_include))
751     config.write ("QHULL_LIBPATH = %r\n"%(qhull_libpath))
752     config.write ("QHULL_LIBRARY = %r\n"%(qhull_lib))
753     config.write ("ODE_INCLUDE = %r\n"%(ode_include))
754     config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
755     config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
756     config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
757     config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
758     config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
759     config.write ("\n# The following information is only necessary when building with\n")
760     config.write ("# internationalization support.\n");
761     config.write ("FTGL_INCLUDE = %r\n"%(ftgl_include))
762     config.write ("FTGL_LIBPATH = %r\n"%(ftgl_libpath))
763     config.write ("FTGL_LIBRARY = %r\n"%(ftgl_lib))
764     config.write ("FREETYPE_INCLUDE = %r\n"%(freetype_include))
765     config.write ("FREETYPE_LIBPATH = %r\n"%(freetype_libpath))
766     config.write ("FREETYPE_LIBRARY = %r\n"%(freetype_lib))
767     config.write ("GETTEXT_INCLUDE = %r\n"%(gettext_include))
768     config.write ("GETTEXT_LIBPATH = %r\n"%(gettext_libpath))
769     config.write ("GETTEXT_LIBRARY = %r\n"%(gettext_lib))
770     config.close ()
771
772 #-----------------------------------------------------------------------------
773 # Read the options from the config file and update the various necessary flags
774 #-----------------------------------------------------------------------------
775 list_opts = []
776 user_options_env = Environment ()
777 user_options = Options (config_file)
778 user_options.AddOptions (
779         ('VERSION', 'Blender version', version),
780         (EnumOption ('BUILD_BINARY', 'release',
781                      'Select a release or debug binary.',
782                      allowed_values = ('release', 'debug'))),
783         (BoolOption ('USE_BUILDINFO',
784                      'Set to 1 if you want to add build information.',
785                      'false')),
786         (BoolOption ('BUILD_BLENDER_DYNAMIC',
787                      'Set to 1 if you want to build blender with hardware accellerated OpenGL support.',
788                      'true')),
789         (BoolOption ('BUILD_BLENDER_STATIC',
790                      'Set to 1 if you want to build blender with software OpenGL support.',
791                      'false')),
792         (BoolOption ('BUILD_BLENDER_PLAYER',
793                      'Set to 1 if you want to build the blender player.',
794                      'false')),
795         (BoolOption ('BUILD_BLENDER_PLUGIN',
796                      'Set to 1 if you want to build the blender plugin.',
797                      'false')),
798         ('BUILD_DIR', 'Target directory for intermediate files.',
799                      root_build_dir),
800         (BoolOption ('USE_INTERNATIONAL',
801                      'Set to 1 to have international support.',
802                      'false')),
803         (EnumOption ('USE_PHYSICS', 'solid',
804                      'Select which physics engine to use.',
805                      allowed_values = ('ode', 'solid'))),
806         (BoolOption ('BUILD_GAMEENGINE',
807                      'Set to 1 to build blender with game engine support.',
808                      'false')),
809         (BoolOption ('USE_OPENAL',
810                      'Set to 1 to build the game engine with OpenAL support.',
811                      'false')),
812         (BoolOption ('USE_FMOD',
813                      'Set to 1 to build the game engine with FMod support.',
814                      'false')),
815         (BoolOption ('USE_QUICKTIME',
816                      'Set to 1 to add support for QuickTime.',
817                      'false')),
818         ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
819         ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
820         ('TARGET_CC', 'C compiler for the target platform.'),
821         ('TARGET_CXX', 'C++ compiler for the target platform.'),
822         ('TARGET_AR', 'Linker command for linking libraries.'),
823         ('PATH', 'Standard search path'),
824         ('PLATFORM_LIBS', 'Platform specific libraries.'),
825         ('PLATFORM_LIBPATH', 'Platform specific library link path.'),
826         ('PLATFORM_LINKFLAGS', 'Platform specific linkflags'),
827         ('PYTHON_INCLUDE', 'Include directory for Python header files.'),
828         ('PYTHON_LIBPATH', 'Library path where the Python lib is located.'),
829         ('PYTHON_LIBRARY', 'Python library name.'),
830         ('PYTHON_LINKFLAGS', 'Python specific linkflags.'),
831         ('SDL_CFLAGS', 'Necessary CFLAGS when using sdl functionality.'),
832         ('SDL_INCLUDE', 'Include directory for SDL header files.'),
833         ('SDL_LIBPATH', 'Library path where the SDL library is located.'),
834         ('SDL_LIBRARY', 'SDL library name.'),
835         ('Z_INCLUDE', 'Include directory for zlib header files.'),
836         ('Z_LIBPATH', 'Library path where the zlib library is located.'),
837         ('Z_LIBRARY', 'Z library name.'),
838         ('PNG_INCLUDE', 'Include directory for png header files.'),
839         ('PNG_LIBPATH', 'Library path where the png library is located.'),
840         ('PNG_LIBRARY', 'png library name.'),
841         ('JPEG_INCLUDE', 'Include directory for jpeg header files.'),
842         ('JPEG_LIBPATH', 'Library path where the jpeg library is located.'),
843         ('JPEG_LIBRARY', 'jpeg library name.'),
844         ('OPENGL_INCLUDE', 'Include directory for OpenGL header files.'),
845         ('OPENGL_LIBPATH', 'Library path where the OpenGL libraries are located.'),
846         ('OPENGL_LIBRARY', 'OpenGL library names.'),
847         ('OPENGL_STATIC', 'Linker flags for static linking of Open GL.'),
848         ('SOLID_INCLUDE', 'Include directory for SOLID header files.'),
849         ('SOLID_LIBPATH', 'Library path where the SOLID library is located.'),
850         ('SOLID_LIBRARY', 'SOLID library name.'),
851         ('QHULL_INCLUDE', 'Include directory for QHULL header files.'),
852         ('QHULL_LIBPATH', 'Library path where the QHULL library is located.'),
853         ('QHULL_LIBRARY', 'QHULL library name.'),
854         ('ODE_INCLUDE', 'Include directory for ODE header files.'),
855         ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
856         ('ODE_LIBRARY', 'ODE library name.'),
857         ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
858         ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
859         ('OPENAL_LIBRARY', 'OpenAL library name.'),
860         ('FTGL_INCLUDE', 'Include directory for ftgl header files.'),
861         ('FTGL_LIBPATH', 'Library path where the ftgl library is located.'),
862         ('FTGL_LIBRARY', 'ftgl library name.'),
863         ('FREETYPE_INCLUDE', 'Include directory for freetype2 header files.'),
864         ('FREETYPE_LIBPATH', 'Library path where the freetype2 library is located.'),
865         ('FREETYPE_LIBRARY', 'Freetype2 library name.'),
866         ('GETTEXT_INCLUDE', 'Include directory for gettext header files.'),
867         ('GETTEXT_LIBPATH', 'Library path where the gettext library is located.'),
868         ('GETTEXT_LIBRARY', 'gettext library name.'),
869
870         ('DEFINES', 'Extra Preprocessor defines.'),
871         ('CCFLAGS', 'Extra C Compiler flags.'),
872         ('CXXFLAGS','Extra C++ Compiler flags.'),
873         ('LDFLAGS', 'Extra Linker flags.')
874     )
875 user_options.Update (user_options_env)
876 user_options_dict = user_options_env.Dictionary()
877
878 root_build_dir = user_options_dict['BUILD_DIR']
879     
880 if user_options_dict['BUILD_GAMEENGINE'] == 1:
881     defines += ['GAMEBLENDER=1']
882     if user_options_dict['USE_PHYSICS'] == 'ode':
883         defines += ['USE_ODE']
884     else:
885         defines += ['USE_SUMO_SOLID']
886 else:
887     defines += ['GAMEBLENDER=0']
888
889 if user_options_dict['BUILD_BINARY'] == 'release':
890     cflags = extra_flags + release_flags + warn_flags
891     if sys.platform == 'win32':
892         defines += ['NDEBUG']
893 else:
894     cflags = extra_flags + debug_flags + warn_flags
895     if sys.platform == 'win32':
896         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
897         platform_linkflags += ['/DEBUG','/PDB:blender.pdb']
898
899 defines += user_options_dict['DEFINES']
900 cflags += user_options_dict['CCFLAGS']
901 cxxflags += user_options_dict['CXXFLAGS']
902 platform_linkflags += user_options_dict['LDFLAGS']
903
904 #-----------------------------------------------------------------------------
905 # Generic library generation environment. This one is the basis for each
906 # library.
907 #-----------------------------------------------------------------------------
908 library_env = env.Copy ()
909 library_env.Replace (CC = user_options_dict['TARGET_CC'])
910 library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
911 library_env.Replace (PATH = user_options_dict['PATH'])
912 library_env.Replace (AR = user_options_dict['TARGET_AR'])
913 library_env.Append (CCFLAGS = cflags)
914 library_env.Append (CXXFLAGS = cxxflags)
915 library_env.Append (CPPDEFINES = defines)
916 library_env.SConsignFile (root_build_dir+'scons-signatures')
917
918 #-----------------------------------------------------------------------------
919 # Settings to be exported to other SConscript files
920 #-----------------------------------------------------------------------------
921
922 if enable_clean==0: # only read SConscripts when not cleaning, this to cut overhead
923         Export ('cflags')
924         Export ('defines')
925         Export ('window_system')
926         Export ('extra_includes')
927         Export ('user_options_dict')
928         Export ('library_env')
929         
930         BuildDir (root_build_dir+'/extern', 'extern', duplicate=0)
931         SConscript (root_build_dir+'extern/SConscript')
932         BuildDir (root_build_dir+'/intern', 'intern', duplicate=0)
933         SConscript (root_build_dir+'intern/SConscript')
934         BuildDir (root_build_dir+'/source', 'source', duplicate=0)
935         SConscript (root_build_dir+'source/SConscript')
936         
937         libpath = (['#'+root_build_dir+'/lib'])
938         
939         link_env = library_env.Copy ()
940         link_env.Append (LIBPATH=libpath)
941
942 def common_libs(env):
943         """
944         Append to env all libraries that are common to Blender and Blenderplayer
945         """
946         env.Append (LIBS=[
947                 'blender_blenloader',
948                 'blender_readblenfile',
949                 'blender_img',
950                 'blender_blenkernel',
951                 'blender_blenpluginapi',
952                 'blender_imbuf',
953                 'blender_avi',
954                 'blender_blenlib',
955                 'blender_makesdna',
956                 'blender_kernel',
957                 'blender_GHOST',
958                 'blender_STR',
959                 'blender_guardedalloc',
960                 'blender_CTR',
961                 'blender_MEM',
962                 'blender_MT',
963                 'blender_BMF',
964                 'soundsystem'])
965         if user_options_dict['USE_QUICKTIME'] == 1:
966                 env.Append (LIBS=['blender_quicktime'])
967
968
969 def international_libs(env):
970         """
971         Append international font support libraries
972         """
973         if user_options_dict['USE_INTERNATIONAL'] == 1:
974                 env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
975                 env.Append (LIBPATH=user_options_dict['FREETYPE_LIBPATH'])
976                 env.Append (LIBS=['blender_FTF'])
977                 env.Append (LIBS=user_options_dict['FTGL_LIBRARY'])
978                 env.Append (LIBPATH=user_options_dict['FTGL_LIBPATH'])
979                 env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
980
981 def blender_libs(env):
982         """
983         Blender only libs (not in player)
984         """
985         env.Append( LIBS=['blender_creator',
986                 'blender_blendersrc',
987                 'blender_render',
988                 'blender_yafray',
989                 'blender_renderconverter',
990                 'blender_radiosity',
991                 'blender_LOD',
992                 'blender_BSP',
993                 'blender_blenkernel',
994                 'blender_IK',
995                 'blender_ONL'])
996
997 def ketsji_libs(env):
998         """
999         Game Engine libs
1000         """
1001         if user_options_dict['BUILD_GAMEENGINE'] == 1:
1002                 env.Append (LIBS=['KX_blenderhook',
1003                                 'KX_converter',
1004                                 'PHY_Dummy',
1005                                 'PHY_Physics',
1006                                 'KX_ketsji',
1007                                 'SCA_GameLogic',
1008                                 'RAS_rasterizer',
1009                                 'RAS_OpenGLRasterizer',
1010                                 'blender_expressions',
1011                                 'SG_SceneGraph',
1012                                 'blender_MT',
1013                                 'KX_blenderhook',
1014                                 'KX_network',
1015                                 'blender_kernel',
1016                                 'NG_network',
1017                                 'NG_loopbacknetwork'])
1018                 if user_options_dict['USE_PHYSICS'] == 'solid':
1019                         env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
1020                 else:
1021                         env.Append (LIBS=['PHY_Ode',
1022                                         'PHY_Physics'])
1023                         env.Append (LIBS=user_options_dict['ODE_LIBRARY'])
1024                         env.Append (LIBPATH=user_options_dict['ODE_LIBPATH'])
1025
1026 def player_libs(env):
1027         """
1028         Player libraries
1029         """
1030         env.Append (LIBS=['GPG_ghost',
1031                         'GPC_common'])
1032
1033 def player_libs2(env):
1034         """
1035         Link order shenannigans: these libs are added after common_libs
1036         """
1037         env.Append (LIBS=['blender_blenkernel_blc',
1038                         'soundsystem'])
1039
1040 def winblenderres(env):
1041         """
1042         build the windows icon resource file
1043         """
1044         if sys.platform == 'win32':
1045                 env.RES(['source/icons/winblender.rc'])
1046
1047 def system_libs(env):
1048         """
1049         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
1050         """
1051         env.Append (LIBS=['blender_python'])
1052         env.Append (LIBS=user_options_dict['PYTHON_LIBRARY'])
1053         env.Append (LIBPATH=user_options_dict['PYTHON_LIBPATH'])
1054         env.Append (LINKFLAGS=user_options_dict['PYTHON_LINKFLAGS'])
1055         env.Append (LIBS=user_options_dict['SDL_LIBRARY'])
1056         env.Append (LIBPATH=user_options_dict['SDL_LIBPATH'])
1057         env.Append (LIBS=user_options_dict['PNG_LIBRARY'])
1058         env.Append (LIBPATH=user_options_dict['PNG_LIBPATH'])
1059         env.Append (LIBS=user_options_dict['JPEG_LIBRARY'])
1060         env.Append (LIBPATH=user_options_dict['JPEG_LIBPATH'])
1061         env.Append (LIBS=user_options_dict['GETTEXT_LIBRARY'])
1062         env.Append (LIBPATH=user_options_dict['GETTEXT_LIBPATH'])
1063         env.Append (LIBS=user_options_dict['Z_LIBRARY'])
1064         env.Append (LIBPATH=user_options_dict['Z_LIBPATH'])
1065         if user_options_dict['USE_OPENAL'] == 1:
1066                 env.Append (LIBS=user_options_dict['OPENAL_LIBRARY'])
1067                 env.Append (LIBPATH=user_options_dict['OPENAL_LIBPATH'])
1068         env.Append (LIBS=user_options_dict['PLATFORM_LIBS'])
1069         env.Append (LIBPATH=user_options_dict['PLATFORM_LIBPATH'])
1070         if sys.platform == 'darwin':
1071                 env.Append (LINKFLAGS='-framework')
1072                 env.Append (LINKFLAGS='Carbon')
1073                 env.Append (LINKFLAGS='-framework')
1074                 env.Append (LINKFLAGS='AGL')
1075                 env.Append (LINKFLAGS='-framework')
1076                 env.Append (LINKFLAGS='AudioUnit')
1077                 env.Append (LINKFLAGS='-framework')
1078                 env.Append (LINKFLAGS='AudioToolbox')
1079                 env.Append (LINKFLAGS='-framework')
1080                 env.Append (LINKFLAGS='CoreAudio')
1081                 if user_options_dict['USE_QUICKTIME'] == 1:
1082                         env.Append (LINKFLAGS='-framework')
1083                         env.Append (LINKFLAGS='QuickTime')
1084         else:
1085                 env.Append (LINKFLAGS=user_options_dict['PLATFORM_LINKFLAGS'])
1086         env.BuildDir (root_build_dir, '.', duplicate=0)
1087
1088 def buildinfo(env, build_type):
1089         """
1090         Generate a buildinfo object
1091         """
1092         build_date = time.strftime ("%Y-%m-%d")
1093         build_time = time.strftime ("%H:%M:%S")
1094         obj = []
1095         if user_options_dict['USE_BUILDINFO'] == 1:
1096                 if sys.platform=='win32':
1097                         build_info_file = open("source/creator/winbuildinfo.h", 'w')
1098                         build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1099                         build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1100                         build_info_file.write("char *build_platform=\"win32\";\n")
1101                         build_info_file.write("char *build_type=\"%s\";\n"%build_type)
1102                         build_info_file.close()
1103                         env.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1104                 else:
1105                         env.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1106                                                         'BUILD_DATE=\'"%s"\''%(build_date),
1107                                                         'BUILD_TYPE=\'"dynamic"\'',
1108                                                         'NAN_BUILDINFO',
1109                                                         'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1110                 obj = [env.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type,
1111                                                 [root_build_dir+'source/creator/buildinfo.c'])]
1112         return obj
1113         
1114 def cleanCVS():
1115         """
1116         walks the dist dir and removes all CVS dirs
1117         """
1118         
1119         try:
1120                 import shutil
1121         except:
1122                 print "no shutil available"
1123                 print "make sure you use python 2.3"
1124                 print
1125                 return 0
1126         
1127         startdir = os.getcwd()
1128         
1129         for root, dirs, files in os.walk("dist", topdown=False):
1130                 for name in dirs:
1131                         if name in ['CVS']:
1132                                 if os.path.isdir(root + "/" + name):
1133                                         shutil.rmtree(root + "/" + name)
1134         
1135         os.chdir(startdir)
1136         
1137         return 1
1138
1139 def preparedist():
1140         """
1141         Prepare a directory for creating either archives or the installer
1142         """
1143         
1144         try:
1145                 import shutil
1146         except:
1147                 print "no shutil available"
1148                 print "make sure you use python 2.3"
1149                 print
1150                 return 0
1151         
1152         startdir = os.getcwd()
1153         
1154         if os.path.isdir("dist") == 0:
1155                 os.makedirs("dist")
1156         else:
1157                 shutil.rmtree("dist") # make sure we don't get old cruft
1158                 os.makedirs("dist")
1159         
1160         # first copy binaries
1161         
1162         if sys.platform == 'win32':
1163                 shutil.copy("blender.exe", "dist/blender.exe")
1164                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1165                         shutil.copy("blenderplayer.exe", "dist/blenderplayer.exe")
1166                 shutil.copy("../lib/windows/python/lib/python23.dll", "dist/python23.dll")
1167                 shutil.copy("../lib/windows/sdl/lib/SDL.dll", "dist/SDL.dll")
1168                 shutil.copy("../lib/windows/gettext/lib/gnu_gettext.dll", "dist/gnu_gettext.dll")
1169         elif sys.platform in ['linux2', 'linux-i386']:
1170                 shutil.copy("blender", "dist/blender")
1171                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1172                         shutil.copy("blenderplayer", "dist/blenderplayer")
1173         else:
1174                 print "update preparedist() for your platform!"
1175                 return 0
1176         
1177         # now copy .blender and necessary extras for it
1178         if os.path.isdir("dist/.blender"):
1179                 shutil.rmtree("dist/.blender")
1180         os.chdir("bin")
1181         shutil.copytree(".blender/", "../dist/.blender")
1182         os.chdir(startdir)
1183         if os.path.isdir("dist/.blender/scripts"):
1184                 shutil.rmtree("dist/.blender/scripts")
1185         if os.path.isdir("dist/.blender/bpydata"):
1186                 shutil.rmtree("dist/.blender/bpydata")
1187                 
1188         os.makedirs("dist/.blender/bpydata")
1189         shutil.copy("release/bpydata/readme.txt", "dist/.blender/bpydata/readme.txt")
1190         
1191         os.chdir("release")
1192         shutil.copytree("scripts/", "../dist/.blender/scripts")
1193         
1194         # finally copy auxiliaries (readme, license, etc.)
1195         if sys.platform == 'win32':
1196                 shutil.copy("windows/extra/Help.url", "../dist/Help.url")
1197         shutil.copy("text/copyright.txt", "../dist/copyright.txt")
1198         shutil.copy("text/blender.html", "../dist/blender.html")
1199         shutil.copy("text/GPL-license.txt", "../dist/GPL-license.txt")
1200         shutil.copy("text/Python-license.txt", "../dist/Python-lisence.txt")
1201         
1202         reltext = "release_" + string.join(version.split("."), '') + ".txt"
1203         shutil.copy("text/" + reltext, "../dist/" + reltext)
1204         
1205         os.chdir(startdir)
1206         
1207         if cleanCVS()==0:
1208                 return 0
1209
1210         return 1
1211
1212 def finalisedist(zipname):
1213         """
1214         Fetch the package created and remove temp dir
1215         """
1216         
1217         try:
1218                 import shutil
1219         except:
1220                 print "no shutil available"
1221                 print "make sure you use python 2.3"
1222                 print
1223                 return 0
1224         
1225         shutil.copy("dist/" + zipname, zipname)
1226         shutil.rmtree("dist")
1227         
1228         return 1
1229
1230 def add2arc(arc, file):
1231         if sys.platform == 'win32':
1232                 arc.write(file)
1233         else:
1234                 arc.add(file)
1235
1236 def zipit(env, target, source):
1237         try:
1238                 if sys.platform == 'win32':
1239                         import zipfile
1240                 else:
1241                         import tarfile
1242         except:
1243                 if sys.platform == 'win32':
1244                         print "no zipfile module found"
1245                 else:
1246                         print "no tarfile module found"
1247                         print "make sure you use python 2.3"
1248                 print
1249                 return
1250         
1251         import glob
1252         import time
1253         
1254         startdir = os.getcwd()
1255         pf=""
1256         zipext = ""
1257         zipname = ""
1258         
1259         today = time.strftime("%Y%m%d", time.gmtime()) # get time in the form 20040714
1260         
1261         if preparedist()==0:
1262                 print "check output for error"
1263                 return
1264         
1265         os.chdir(startdir + "/dist")
1266         
1267         if sys.platform == 'win32':
1268                 zipext += ".zip"
1269                 pf = "windows"
1270         elif sys.platform == 'linux2' or sys.platform == 'linux-i386':
1271                 zipext += ".tar.gz"
1272                 pf = "linux"
1273         
1274         zipname = "bf_blender_" + pf+ "_" + today + zipext
1275         
1276         print
1277         if sys.platform == 'win32':
1278                 print "Create the zip!"
1279         elif sys.platform == 'linux2' or sys.platform == 'linux-i386':
1280                 print "Create the tarball!"
1281         print
1282         
1283         if sys.platform == 'win32':
1284                 thezip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
1285         else:
1286                 thezip = tarfile.open(zipname, 'w:gz')
1287         
1288         for root, dirs, files in os.walk(".", topdown=False):
1289                 for name in files:
1290                         if name in [zipname]:
1291                                 print "skipping self"
1292                         else:
1293                                 file = root + "/" + name
1294                                 print "adding: " + file
1295                                 add2arc(thezip, file)
1296         
1297         thezip.close()
1298         
1299         os.chdir(startdir)
1300         
1301         if finalisedist(zipname)==0:
1302                 print "encountered an error in finalisedist"
1303                 print
1304                 return
1305         
1306         print
1307         print "Blender has been successfully packaged"
1308         print "You can find the file %s in the root source directory"%zipname
1309         print
1310         
1311
1312 def printadd(env, target, source):
1313         """
1314         Print warning message if platform hasn't been added to zipit() yet
1315         """
1316         
1317         print
1318         print "############"
1319         print 
1320         print "Make sure zipit() works for your platform:"
1321         print "  - binaries to copy (naming?)"
1322         print "  - possible libraries?"
1323         print "  - archive format?"
1324         print
1325         print "After you've corrected zipit() for your"
1326         print "platform, be sure to add a proper elif"
1327         print "at the end of BlenderRelease"
1328         print
1329         print "Blender is now ready and can be found in"
1330         print "root of the source distribution, but it"
1331         print "hasn't been packaged neatly. Make sure you"
1332         print "get the right files"
1333         print
1334         print "/jesterKing"
1335         print
1336         
1337
1338 def noaction(env, target, source):
1339         print "Empty action"
1340
1341 def DoClean(dir2clean):
1342         """
1343         Do a removal of the root_build_dir the fast way
1344         """
1345         
1346         import shutil
1347         print
1348         print "start the clean"
1349         dirs = os.listdir(dir2clean)
1350         for dir in dirs:
1351                 if os.path.isdir(dir2clean + "/" + dir) == 1:
1352                         print "clean dir %s"%(dir2clean+"/" + dir)
1353                         shutil.rmtree(dir2clean+"/" + dir)
1354         print "done"
1355
1356 def BlenderDefault(target):
1357         """
1358         The default Blender build.
1359         """
1360         def_env = Environment()
1361         default = def_env.Command('nozip', 'blender$PROGSUFFIX', noaction)
1362         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1363                 def_env.Depends(default, 'blenderplayer$PROGSUFFIX')
1364         def_env.Alias(".", default)
1365
1366 def donsis(env, target, source):
1367         """
1368         Create a Windows installer with NSIS
1369         """
1370         print
1371         print "Creating the Windows installer"
1372         print
1373         
1374         startdir = os.getcwd()
1375         
1376         if preparedist()==0:
1377                 print "check output for error"
1378                 return
1379         
1380         os.chdir("release/windows/installer")
1381         
1382         nsis = open("00.sconsblender.nsi", 'r')
1383         nsis_cnt = str(nsis.read())
1384         nsis.close()
1385         
1386         # do root
1387         rootlist = []
1388         rootdir = os.listdir(startdir + "\\dist")
1389         for rootitem in rootdir:
1390                 if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
1391                         rootlist.append("File " + startdir + "\\dist\\" + rootitem)
1392         rootstring = string.join(rootlist, "\n  ")
1393         rootstring += "\n\n"
1394         nsis_cnt = string.replace(nsis_cnt, "[ROOTDIRCONTS]", rootstring)
1395         
1396         # do scripts
1397         scriptlist = []
1398         scriptdir = os.listdir(startdir + "\\dist\\.blender\\scripts")
1399         for scriptitem in scriptdir:
1400                 if os.path.isdir(startdir + "\\dist\\.blender\\scripts\\" + scriptitem) == 0:
1401                         scriptlist.append("File " + startdir + "\\dist\\.blender\\scripts\\" + scriptitem)
1402         scriptstring = string.join(scriptlist, "\n  ")
1403         scriptstring += "\n\n"
1404         nsis_cnt = string.replace(nsis_cnt, "[SCRIPTCONTS]", scriptstring)
1405         
1406         # do dotblender
1407         dotblendlist = []
1408         dotblenddir = os.listdir(startdir+"\\dist\\.blender")
1409         for dotblenditem in dotblenddir:
1410                 if os.path.isdir(startdir + "\\dist\\.blender\\" + dotblenditem) == 0:
1411                         dotblendlist.append("File " + startdir + "\\dist\\.blender\\" + dotblenditem)
1412         dotblendstring = string.join(dotblendlist, "\n  ")
1413         dotblendstring += "\n\n"
1414         nsis_cnt = string.replace(nsis_cnt, "[DOTBLENDERCONTS]", dotblendstring)
1415         
1416         # do language files
1417         langlist = []
1418         langdir = os.listdir(startdir + "\\dist\\.blender\\locale")
1419         for langitem in langdir:
1420                 if os.path.isdir(startdir + "\\dist\\.blender\\locale\\" + langitem) == 1:
1421                         langlist.append("File " + startdir + "\\dist\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
1422         langstring = string.join(langlist, "\n  ")
1423         langstring += "\n\n"
1424         nsis_cnt = string.replace(nsis_cnt, "[LANGUAGECONTS]", langstring)
1425         
1426         # var replacements
1427         nsis_cnt = string.replace(nsis_cnt, "DISTDIR", startdir + "\\dist")
1428         nsis_cnt = string.replace(nsis_cnt, "SHORTVER", shortversion)
1429         nsis_cnt = string.replace(nsis_cnt, "VERSION", version)
1430         
1431         new_nsis = open("00.blender_tmp.nsi", 'w')
1432         new_nsis.write(nsis_cnt)
1433         new_nsis.close()
1434         
1435         sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
1436         
1437         os.chdir(startdir)
1438         
1439         
1440 def BlenderNSIS(target):
1441         """
1442         Entry for creating Windows installer
1443         """
1444         if sys.platform == 'win32':
1445                 inst_env = Environment()
1446                 nsis_inst = inst_env.Command('nsisinstaller', 'blender$PROGSUFFIX', donsis)
1447                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1448                         inst_env.Depends(nsis_inst, 'blenderplayer$PROGSUFFIX')
1449                 inst_env.Alias("wininst", nsis_inst)
1450         else:
1451                 print "This target is for the win32 platform only"
1452
1453 def BlenderRelease(target):
1454         """
1455         Make a Release package (tarball, zip, bundle).
1456         
1457         target = Name of package to make (string)
1458         eg: BlenderRelease('blender')
1459         """
1460         if sys.platform == 'darwin':
1461                 bundle = Environment ()
1462                 target = 'blender'
1463                 blender_app = target
1464                 bundle.Depends ('#/%s.app/Contents/Info.plist'%target, blender_app)
1465                 bundle.Command ('#/%s.app/Contents/Info.plist'%target,
1466                                 '#/source/darwin/%s.app/Contents/Info.plist'%target,
1467                                 "rm -rf %s.app && "%target + \
1468                                 "cp -R source/darwin/%s.app . && "%target +
1469                                 "cat $SOURCE | sed s/VERSION/`cat release/VERSION`/ | \
1470                                                 sed s/DATE/`date +'%Y-%b-%d'`/ \
1471                                                 > $TARGET && " + \
1472                                 'cp -p %s %s.app/Contents/MacOS/%s && '%(target, target, target) + \
1473                                 'strip -u -r %s.app/Contents/MacOS/%s && '%(target, target) + \
1474                                 'cp bin/.blender/.bfont.ttf %s.app/Contents/Resources/ && '%target + \
1475                                 'cp bin/.blender/.Blanguages %s.app/Contents/Resources/ && '%target + \
1476                                 'cp -R bin/.blender/locale %s.app/Contents/Resources/ && '%target + \
1477                                 'cp -R release/bpydata %s.app/Contents/Resources/ && '%target + \
1478                                 'cp -R release/scripts %s.app/Contents/Resources/ && '%target + \
1479                                 'cp -R release/plugins %s.app/Contents/Resources/ && '%target + \
1480                                 'chmod +x $TARGET && ' + \
1481                                 'find %s.app -name CVS -prune -exec rm -rf {} \; && '%target +
1482                                 'find %s.app -name .DS_Store -exec rm -rf {} \;'%target)
1483         elif sys.platform in ['win32', 'linux2', 'linux-i386']:
1484                 release_env = Environment()
1485                 releaseit = release_env.Command('blenderrelease', 'blender$PROGSUFFIX', zipit)
1486                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1487                         release_env.Depends(releaseit, 'blenderplayer$PROGSUFFIX')
1488                 release_env.Alias("release", releaseit)
1489         else:
1490                 release_env = Environment()
1491                 releaseit = release_env.Command('blender.tar.gz', 'blender$PROGSUFFIX', printadd)
1492                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1493                         release_env.Depends(releaseit, 'blenderplayer$PROGSUFFIX')
1494                 release_env.Alias("release", releaseit)
1495
1496 if enable_clean == 0:
1497         if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
1498                 dy_blender = link_env.Copy ()
1499                 if sys.platform=='win32':
1500                         winblenderres(dy_blender)
1501                 blender_libs(dy_blender)
1502                 common_libs(dy_blender)
1503                 international_libs(dy_blender)
1504                 ketsji_libs(dy_blender)
1505                 system_libs(dy_blender)
1506                 dy_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1507                 dy_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1508                 dy_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1509                 d_obj = buildinfo(dy_blender, "dynamic")
1510                 if sys.platform == 'win32':
1511                         dy_blender.Program (target='blender',
1512                                                 source=d_obj + ['source/icons/winblender.res'])
1513                 else:
1514                         if sys.platform == 'cygwin':
1515                                 dy_blender.Replace (CC='g++')
1516                         dy_blender.Program (target='blender', source=d_obj)
1517         
1518         if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
1519                 st_blender = link_env.Copy ()
1520                 if sys.platform=='win32':
1521                         winblenderres(st_blender)
1522                 blender_libs(st_blender)
1523                 common_libs(st_blender)
1524                 international_libs(st_blender)
1525                 ketsji_libs(st_blender)
1526                 system_libs(st_blender)
1527                 # The next line is to make sure that the LINKFLAGS are appended at the end
1528                 # of the link command. This 'trick' is needed because the GL and GLU static
1529                 # libraries need to be at the end of the command.
1530                 st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
1531                 s_obj = buildinfo(st_blender, "static")
1532                 st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
1533                 st_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1534                 st_blender.Prepend (LIBPATH=['/usr/lib/opengl/xfree/lib'])
1535                 st_blender.Program (target='blenderstatic', source=s_obj)
1536         
1537         if sys.platform=='win32':
1538                 if user_options_dict['BUILD_BINARY']=='debug':
1539                         browser = Environment()
1540                         browser_tmp = root_build_dir+'bscmake.tmp'
1541                         browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
1542                                 ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1543                                  'bscmake /nologo /n /oblender.bsc @'+browser_tmp,
1544                                  'del '+browser_tmp])
1545         
1546         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1 and user_options_dict['BUILD_GAMEENGINE'] == 1:
1547                 player_blender = link_env.Copy()
1548                 player_libs(player_blender)
1549                 common_libs(player_blender)
1550                 international_libs(player_blender)
1551                 ketsji_libs(player_blender)
1552                 player_libs2(player_blender)
1553                 system_libs(player_blender)
1554                 player_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1555                 player_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1556                 player_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1557                 d_obj = buildinfo(player_blender, "player")
1558                 if sys.platform == 'win32':
1559                         player_blender.Program (target='blenderplayer',
1560                                                 source=d_obj + ['source/icons/winblender.res'])
1561                 else:
1562                         if sys.platform == 'cygwin':
1563                                 player_blender.Replace (CC='g++')
1564                         player_blender.Program (target='blenderplayer', source=d_obj)
1565                 if sys.platform=='win32':
1566                         if user_options_dict['BUILD_BINARY']=='debug':
1567                                 browser = Environment()
1568                                 browser_tmp = root_build_dir+'bscmake.tmp'
1569                                 browser.Command ('blenderplayer.bsc', 'blenderplayer$PROGSUFFIX',
1570                                 ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1571                                 'bscmake /nologo /n /oblenderplayer.bsc @'+browser_tmp,
1572                                 'del '+browser_tmp])
1573
1574         release_target = env.Alias("release", BlenderRelease('blender$PROGSUFFIX'))
1575         default_target = env.Alias("default", BlenderDefault('blender$PROGSUFFIX'))
1576         wininst_target = env.Alias("winist", BlenderNSIS('blender$PROGSUFFIX'))
1577 else: # only clean target to prevent any building
1578         clean_target = env.Alias("clean", DoClean(root_build_dir))
1579         Default("clean")
1580
1581 if enable_clean == 0: # only set up dependencies when not cleaning
1582         Default("default")
1583
1584         if sys.platform == 'win32':
1585                 if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1586                         env.Depends(wininst_target, 'blenderplayer$PROGSUFFIX')
1587                 env.Depends(wininst_target, 'blender$PROGSUFFIX')
1588         
1589         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1590                 env.Depends(release_target, 'blenderplayer$PROGSUFFIX')
1591         env.Depends(release_target, 'blender$PROGSUFFIX')
1592         
1593         if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
1594                 env.Depends(default_target, 'blenderplayer$PROGSUFFIX')
1595         env.Depends(default_target, 'blender$PROGSUFFIX')