completed build for release on mac Os X, no more manual operations
[blender-staging.git] / SConstruct
1 import string
2 import os
3 import time
4 import sys
5 from distutils import sysconfig
6
7 # Build directory.
8 root_build_dir = '..' + os.sep + 'build' + os.sep + sys.platform + os.sep
9
10 # Create the build directory. SCons does this automatically, but since we
11 # don't want to put scons-generated .sconsign files in the source tree, but in
12 # the root_build_dir, we have to create that dir ourselves before SCons tries
13 # to access/create the file containing .sconsign data.
14 if os.path.isdir (root_build_dir) == 0:
15     os.makedirs (root_build_dir)
16
17 # User configurable options file. This can be controlled by the user by running
18 # scons with the following argument: CONFIG=user_config_options_file
19 config_file = ARGUMENTS.get('CONFIG', 'config.opts')
20
21 # Blender version.
22 version='2.33a'
23
24 sdl_env = Environment ()
25 freetype_env = Environment ()
26 env = Environment ()
27
28 if sys.platform == 'linux2' or sys.platform == 'linux-i386':
29     use_international = 'false'
30     use_gameengine = 'true'
31     use_openal = 'false'
32     use_fmod = 'false'
33     use_quicktime = 'false'
34     use_sumo = 'true'
35     use_ode = 'false'
36     use_buildinfo = 'false'
37     build_blender_dynamic = 'true'
38     build_blender_static = 'false'
39     build_blender_player = 'false'
40     build_blender_plugin = 'false'
41     release_flags = ['-O2']
42     debug_flags = ['-O2', '-g']
43     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
44     cxxflags = []
45     defines = []
46     warn_flags = ['-Wall']
47     window_system = 'X11'
48     platform_libs = ['m', 'util', 'stdc++']
49     platform_libpath = []
50     platform_linkflags = []
51     extra_includes = []
52     # z library information
53     z_lib = ['z']
54     z_libpath = ['/usr/lib']
55     z_include = ['/usr/include']
56     # png library information
57     png_lib = ['png']
58     png_libpath = ['/usr/lib']
59     png_include = ['/usr/include']
60     # jpeg library information
61     jpeg_lib = ['jpeg']
62     jpeg_libpath = ['/usr/lib']
63     jpeg_include = ['/usr/include']
64     # OpenGL library information
65     opengl_lib = ['GL', 'GLU']
66     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
67     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
68     opengl_include = ['/usr/include']
69     # SDL library information
70     sdl_env.ParseConfig ('sdl-config --cflags --libs')
71     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
72     sdl_include = sdl_env.Dictionary()['CPPPATH']
73     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
74     sdl_lib = sdl_env.Dictionary()['LIBS']
75     # SOLID library information
76     solid_lib = []                                              # TODO
77     solid_libpath = []                                          # TODO
78     solid_include = ['#extern/solid']
79     qhull_lib = []                                              # TODO
80     qhull_libpath = []                                          # TODO
81     qhull_include = ['#extern/qhull/include']
82     # ODE library information
83     ode_lib = ['ode']
84     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
85     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
86     # Python library information
87     python_lib = ['python%d.%d' % sys.version_info[0:2]]
88     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
89     python_include = [sysconfig.get_python_inc ()]
90     python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
91     # International support information
92     ftgl_lib = ['ftgl']
93     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
94     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
95     freetype_env.ParseConfig ('freetype-config --cflags --libs')
96     freetype_lib = freetype_env.Dictionary()['LIBS']
97     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
98     freetype_include = freetype_env.Dictionary()['CPPPATH']
99     gettext_lib = []
100     gettext_libpath = []
101     gettext_include = []
102     # OpenAL library information
103     openal_lib = ['openal']
104     openal_libpath = ['/usr/lib']
105     openal_include = ['/usr/include']
106
107 elif sys.platform == 'darwin':
108     use_international = 'true'
109     use_gameengine = 'true'
110     use_openal = 'true'
111     use_fmod = 'false'
112     use_quicktime = 'true'
113     use_precomp = 'true'
114     use_sumo = 'true'
115     use_ode = 'false'
116     use_buildinfo = 'false'
117     build_blender_dynamic = 'true'
118     build_blender_static = 'false'
119     build_blender_player = 'false'
120     build_blender_plugin = 'false'
121     # TODO: replace darwin-6.1-powerpc with the actual directiory on the
122     #       build machine
123     # darwin-6.1 is the name of cvs precomp folder
124     # a symbolic link named darwin-X.Y-powerpc must be manually done
125     #for now. X-Y is darwin kernel rev number
126     darwin_precomp = '#../lib/darwin-6.1-powerpc/'
127     fink_path = '/sw/'
128     # TODO : try -mpowerpc -mpowerpc-gopt -mpowerpc-gfxopt optims
129     #           doing actual profiling
130     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-ffast-math']
131     cxxflags = []
132     defines = ['_THREAD_SAFE', 'MT_NDEBUG']
133     if use_quicktime == 'true':
134         defines += ['WITH_QUICKTIME']
135     warn_flags = ['-Wall', '-W']
136     release_flags = ['-O3']
137     debug_flags = ['-g']
138     window_system = 'CARBON'
139     # z library information
140     z_lib = ['z']
141     z_libpath = []
142     z_include = []
143     # TODO : add a flag to allow each lib to be build from fink or precomp
144     #        without having to have to specify the path manually in config.opts.    
145     # png library information
146     png_lib = ['libpng']
147     png_libpath = [darwin_precomp + 'png/lib']
148     png_include = [darwin_precomp + 'png/include']
149     # jpeg library information
150     jpeg_lib = ['libjpeg']
151     jpeg_libpath = [darwin_precomp + 'jpeg/lib']
152     jpeg_include = [darwin_precomp + 'jpeg/include']
153     # OpenGL library information
154     opengl_lib = ['GL', 'GLU']
155     opengl_static = []
156     opengl_libpath = []
157     opengl_include = []
158     # SDL specific stuff.
159     sdl_env.ParseConfig ('sdl-config --cflags --libs')
160     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
161     # Want to use precompiled libraries?
162     if use_precomp == 'true':
163         sdl_include = [darwin_precomp + 'sdl/include']
164         sdl_libpath = [darwin_precomp + 'sdl/lib']
165         sdl_lib = ['libSDL.a']
166     platform_libs = ['stdc++'] 
167     extra_includes = ['/sw/include']
168     platform_libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries']
169     platform_linkflags = []
170     # SOLID library information
171     solid_lib = ['libsolid']                                          
172     solid_libpath = [darwin_precomp + 'solid/lib']                                          
173     solid_include = [darwin_precomp + 'solid/include']
174     qhull_lib = ['libqhull']                                          
175     qhull_libpath = [darwin_precomp + 'qhull/lib']                                          
176     qhull_include = [darwin_precomp + 'qhull/include']
177     # ODE library information
178     ode_lib = ['libode']                                             
179     ode_libpath = [darwin_precomp + 'ode/lib']                                          
180     ode_include = [darwin_precomp + 'ode/include/ode']
181     # Python variables.
182     # TODO : fill vars differently if we are on 10.2 or 10.3
183     # python_lib = ['python%d.%d' % sys.version_info[0:2]]
184     # python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
185     # python_include = [sysconfig.get_python_inc ()]
186     # python_linkflags = Split (sysconfig.get_config_var('LINKFORSHARED'))
187     python_lib = []
188     python_libpath = ['/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config']
189     python_include = ['/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3']
190     python_linkflags = ['-u', '__dummy', '-u', '_PyMac_Error', 
191                         '-framework', 'System',
192                         '-framework', 'Python',
193                         '-framework', 'CoreServices',
194                         '-framework', 'Foundation']
195     # International stuff
196     ftgl_lib = ['ftgl']
197     ftgl_libpath = [darwin_precomp + 'ftgl/lib']
198     ftgl_include = [darwin_precomp + 'ftgl/include']
199     freetype_lib = ['libfreetype']
200     freetype_libpath = [darwin_precomp + 'freetype/lib']
201     freetype_include = [darwin_precomp + 'freetype/include']
202     gettext_lib = ['libintl']
203     gettext_libpath = [darwin_precomp + 'gettext/lib']
204     gettext_include = [darwin_precomp + 'gettext/include']
205     # OpenAL library information
206     openal_lib = ['libopenal']
207     openal_libpath = [darwin_precomp + 'openal/lib']
208     openal_include = [darwin_precomp + 'openal/include']
209
210 elif sys.platform == 'cygwin':
211     use_international = 'false'
212     use_gameengine = 'false'
213     use_openal = 'false'
214     use_fmod = 'false'
215     use_quicktime = 'false'
216     use_sumo = 'false'
217     use_ode = 'false'
218     use_buildinfo = 'false'
219     build_blender_dynamic = 'true'
220     build_blender_static = 'false'
221     build_blender_player = 'false'
222     build_blender_plugin = 'false'
223     release_flags = ['-O2']
224     debug_flags = ['-O2', '-g']
225     extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
226     cxxflags = []
227     defines = ['FREE_WINDOWS', 'NDEBUG']
228     warn_flags = ['-Wall', '-Wno-char-subscripts']
229     platform_libs = ['png', 'jpeg', 'netapi32',
230                      'opengl32', 'glu32', 'winmm',
231                      'mingw32']
232     platform_libpath = ['/usr/lib/w32api', '/lib/w32api']
233     platform_linkflags = ['-mwindows', '-mno-cygwin', '-mconsole']
234     window_system = 'WIN32'
235     extra_includes = []
236     # z library information
237     z_lib = ['z']
238     z_libpath = ['#../lib/windows/zlib/lib']
239     z_include = ['#../lib/windows/zlib/include']
240     # png library information
241     png_lib = ['png']
242     png_libpath = ['#../lib/windows/png/lib']
243     png_include = ['#../lib/windows/png/include']
244     # jpeg library information
245     jpeg_lib = ['jpeg']
246     jpeg_libpath = ['#../lib/windows/jpeg/lib']
247     jpeg_include = ['#../lib/windows/jpeg/include']
248     # OpenGL library information
249     opengl_lib = ['opengl32', 'glu32']
250     opengl_static = []
251     opengl_libpath = []
252     opengl_include = []
253     # SDL specific stuff.
254     sdl_include = ['#../lib/windows/sdl/include']
255     sdl_libpath = ['#../lib/windows/sdl/lib']
256     sdl_lib = ['SDL']
257     sdl_cflags = []
258     #sdl_cflags = '-DWIN32'
259     # SOLID library information
260     solid_lib = []                                              # TODO
261     solid_libpath = []                                          # TODO
262     solid_include = ['#extern/solid']
263     qhull_lib = []                                              # TODO
264     qhull_libpath = []                                          # TODO
265     qhull_include = ['#extern/qhull/include']
266     # ODE library information
267     ode_lib = ['ode']
268     ode_libpath = ['#../lib/windows/gcc/ode/lib']
269     ode_include = ['#../lib/windows/gcc/ode/include']
270     # Python library information
271     python_include = ['#../lib/windows/python/include/python2.2']
272     python_libpath = ['#../lib/windows/python/lib']
273     python_lib = ['python22']
274     python_linkflags = []
275     # International stuff
276     ftgl_lib = ['ftgl']
277     ftgl_libpath = ['#../lib/windows/gcc/ftgl/lib']
278     ftgl_include = ['#../lib/windows/gcc/ftgl/include']
279     freetype_lib = ['freetype']
280     freetype_libpath = ['#../lib/windows/gcc/freetype/lib']
281     freetype_include = ['#../lib/windows/gcc/freetype/include']
282     gettext_lib = []
283     gettext_libpath = []
284     gettext_include = []
285     # OpenAL library information
286     openal_lib = []
287     openal_libpath = []
288     openal_include = []
289
290 elif sys.platform == 'win32':
291     use_international = 'true'
292     use_gameengine = 'true'
293     use_openal = 'true'
294     use_fmod = 'false'
295     use_quicktime = 'true'
296     use_sumo = 'true'
297     use_ode = 'false'
298     use_buildinfo = 'false'
299     build_blender_dynamic = 'true'
300     build_blender_static = 'false'
301     build_blender_player = 'false'
302     build_blender_plugin = 'false'
303     release_flags = ['/Og', '/Ot', '/Ob1', '/Op', '/G6']
304     debug_flags = ['/Zi', '/Fr${TARGET.base}.sbr']
305     extra_flags = ['/EHsc', '/J', '/W3', '/Gd', '/MT']
306     cxxflags = []
307     defines = ['WIN32', '_CONSOLE']
308     defines += ['WITH_QUICKTIME']
309     defines += ['_LIB', 'USE_OPENAL']
310     defines += ['FTGL_LIBRARY_STATIC']
311     warn_flags = []
312     platform_libs = [ 'qtmlClient', 'soundsystem',
313                      'ws2_32', 'dxguid', 'vfw32', 'winmm',
314                      'iconv', 'kernel32', 'user32', 'gdi32',
315                      'winspool', 'comdlg32', 'advapi32', 'shell32',
316                      'ole32', 'oleaut32', 'uuid', 'odbc32', 'odbccp32',
317                      'libcmt', 'libc']
318     platform_libpath = ['#../lib/windows/iconv/lib',
319                         '#../lib/windows/QTDevWin/Libraries']
320     platform_linkflags = [
321                         '/SUBSYSTEM:CONSOLE',
322                         '/MACHINE:IX86',
323                         '/ENTRY:mainCRTStartup',
324                         '/INCREMENTAL:NO',
325                         '/NODEFAULTLIB:"msvcprt.lib"',
326                         '/NODEFAULTLIB:"glut32.lib"',
327                         '/NODEFAULTLIB:"libcd.lib"',
328                         #'/NODEFAULTLIB:"libc.lib"',
329                         '/NODEFAULTLIB:"libcpd.lib"',
330                         '/NODEFAULTLIB:"libcp.lib"',
331                         '/NODEFAULTLIB:"libcmtd.lib"',
332                         ]
333     window_system = 'WIN32'
334     extra_includes = []
335     if use_quicktime == 'true':
336         extra_includes += ['#../lib/windows/QTDevWin/CIncludes']
337     # z library information
338     z_lib = ['libz_st']
339     z_libpath = ['#../lib/windows/zlib/lib']
340     z_include = ['#../lib/windows/zlib/include']
341     # png library information
342     png_lib = ['libpng_st']
343     png_libpath = ['#../lib/windows/png/lib']
344     png_include = ['#../lib/windows/png/include']
345     # jpeg library information
346     jpeg_lib = ['libjpeg']
347     jpeg_libpath = ['#../lib/windows/jpeg/lib']
348     jpeg_include = ['#../lib/windows/jpeg/include']
349     # OpenGL library information
350     opengl_lib = ['opengl32', 'glu32']
351     opengl_static = []
352     opengl_libpath = []
353     opengl_include = ['/usr/include']
354     # SDL library information
355     sdl_include = ['#../lib/windows/sdl/include']
356     sdl_libpath = ['#../lib/windows/sdl/lib']
357     sdl_lib = ['SDL']
358     sdl_cflags = []
359     window_system = 'WIN32'
360     # SOLID library information
361     solid_lib = ['extern/solid']
362     solid_libpath = ['#../lib/windows/solid/lib']
363     solid_include = ['#extern/solid']
364     qhull_lib = ['qhull']
365     qhull_libpath = ['#../lib/windows/qhull/lib']
366     qhull_include = ['#extern/qhull/include']
367     # ODE library information
368     ode_lib = []                                                # TODO
369     ode_libpath = ['#../lib/windows/ode/lib']
370     ode_include = ['#../lib/windows/ode/include']
371     # Python lib name
372     python_include = ['#../lib/windows/python/include/python2.3']
373     python_libpath = ['#../lib/windows/python/lib']
374     python_lib = ['python23']
375     python_linkflags = []
376     # International stuff
377     ftgl_lib = ['ftgl_static_ST']
378     ftgl_libpath = ['#../lib/windows/ftgl/lib']
379     ftgl_include = ['#../lib/windows/ftgl/include']
380     freetype_lib = ['freetype2ST']
381     freetype_libpath = ['#../lib/windows/freetype/lib']
382     freetype_include = ['#../lib/windows/freetype/include']
383     gettext_lib = ['gnu_gettext']
384     gettext_libpath = ['#../lib/windows/gettext/lib']
385     gettext_include = ['#../lib/windows/gettext/include']
386     # OpenAL library information
387     openal_lib = ['openal_static']
388     openal_libpath = ['#../lib/windows/openal/lib']
389     openal_include = ['#../lib/windows/openal/include']
390
391 elif string.find (sys.platform, 'sunos') != -1:
392     use_international = 'true'
393     use_gameengine = 'false'
394     use_openal = 'false'
395     use_fmod = 'false'
396     use_quicktime = 'false'
397     use_sumo = 'false'
398     use_ode = 'false'
399     use_buildinfo = 'false'
400     build_blender_dynamic = 'true'
401     build_blender_static = 'false'
402     build_blender_player = 'false'
403     build_blender_plugin = 'false'
404     release_flags = ['-O2']
405     debug_flags = ['-O2', '-g']
406     extra_flags = ['-pipe', '-fPIC', '-funsigned-char', '-DSUN_OGL_NO_VERTEX_MACROS']
407     cxxflags = []
408     defines = []
409     warn_flags = ['-Wall', '-W']
410     window_system = 'X11'
411     platform_libs = ['stdc++', 'dl', 'm']
412     platform_libpath = []
413     platform_linkflags = []
414     extra_includes = []
415     # z library information
416     z_lib = ['z']
417     z_libpath = []
418     z_include = []
419     # png library information
420     png_lib = ['png']
421     png_libpath = []
422     png_include = []
423     # jpeg library information
424     jpeg_lib = ['jpeg']
425     jpeg_libpath = []
426     jpeg_include = []
427     # OpenGL library information
428     opengl_lib = ['GL', 'GLU', 'X11']
429     opengl_static = []
430     opengl_libpath = ['/usr/openwin/include']
431     opengl_include = ['/usr/openwin/lib']
432     # SDL library information
433     sdl_env.ParseConfig ('sdl-config --cflags --libs')
434     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
435     sdl_include = sdl_env.Dictionary()['CPPPATH']
436     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
437     sdl_lib = sdl_env.Dictionary()['LIBS']
438     # SOLID library information
439     solid_lib = []                                              # TODO
440     solid_libpath = []                                          # TODO
441     solid_include = ['#extern/solid']
442     qhull_lib = []                                              # TODO
443     qhull_libpath = []                                          # TODO
444     qhull_include = ['#extern/qhull/include']
445     # ODE library information
446     ode_lib = []                                                # TODO
447     ode_libpath = []                                            # TODO
448     ode_include = ['#extern/ode/dist/include/ode']
449     # Python variables.
450     python_lib = ['python%d.%d' % sys.version_info[0:2]]
451     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
452     python_include = [sysconfig.get_python_inc ()]
453     python_linkflags = []
454     # International support information
455     ftgl_lib = ['ftgl']
456     ftgl_libpath = ['#../lib/solaris-2.8-sparc/ftgl/lib']
457     ftgl_include = ['#../lib/solaris-2.8-sparc/ftgl/include']
458     freetype_lib = ['freetype']
459     freetype_libpath = ['#../lib/solaris-2.8-sparc/freetype/lib']
460     freetype_include = ['#../lib/solaris-2.8-sparc/freetype/include']
461     gettext_lib = []
462     gettext_libpath = []
463     gettext_include = []
464     # OpenAL library information
465     openal_lib = []
466     openal_libpath = []
467     openal_include = []
468
469 elif string.find (sys.platform, 'irix') != -1:
470     use_international = 'false'
471     use_gameengine = 'false'
472     use_openal = 'false'
473     use_fmod = 'false'
474     use_quicktime = 'false'
475     use_sumo = 'false'
476     use_ode = 'false'
477     use_buildinfo = 'false'
478     build_blender_dynamic = 'true'
479     build_blender_static = 'false'
480     build_blender_player = 'false'
481     build_blender_plugin = 'false'
482     irix_precomp = '#../lib/irix-6.5-mips'
483     extra_flags = ['-n32', '-mips3', '-Xcpluscomm']
484     cxxflags = ['-n32', '-mips3', '-Xcpluscomm', '-LANG:std']
485     cxxflags += ['-LANG:libc_in_namespace_std=off']
486     
487     window_system = 'X11'
488     release_flags = ['-O2', '-OPT:Olimit=0']
489     debug_flags = ['-O2', '-g']
490     defines = []
491     warn_flags = ['-fullwarn', '-woff', '1001,1110,1201,1209,1355,1424,1681,3201']
492     platform_libs = ['movieGL', 'Xmu', 'Xext', 'X11',
493                      'c', 'm', 'dmedia', 'cl', 'audio',
494                      'Cio', 'pthread']
495     platform_libpath = ['/usr/lib32/mips3',
496                         '/lib/freeware/lib32',
497                         '/usr/lib32']
498     platform_linkflags = ['-mips3', '-n32']
499     extra_includes = ['/usr/freeware/include',
500                       '/usr/include']
501     # z library information
502     z_lib = ['z']
503     z_libpath = []
504     z_include = []
505     # png library information
506     png_lib = ['png']
507     png_libpath = [irix_precomp + '/png/lib']
508     png_include = [irix_precomp + '/png/include']
509     # jpeg library information
510     jpeg_lib = ['jpeg']
511     jpeg_libpath = [irix_precomp + '/jpeg/lib']
512     jpeg_include = [irix_precomp + '/jpeg/include']
513     # OpenGL library information
514     opengl_lib = ['GL', 'GLU']
515     opengl_static = []
516     opengl_libpath = []
517     opengl_include = []
518     # SDL library information
519     sdl_cflags = []
520     sdl_include = [irix_precomp + '/sdl/include/SDL']
521     sdl_libpath = [irix_precomp + '/sdl/lib']
522     sdl_lib = ['SDL', 'libSDL.a']
523     # SOLID library information
524     solid_lib = []                                              # TODO
525     solid_libpath = []                                          # TODO
526     solid_include = [irix_precomp + '/solid/include']
527     qhull_lib = []                                              # TODO
528     qhull_libpath = []                                          # TODO
529     qhull_include = ['#extern/qhull/include']
530     # ODE library information
531     ode_lib = []                                                # TODO
532     ode_libpath = []                                            # TODO
533     ode_include = [irix_precomp + '/ode/include']
534     # Python library information
535     python_libpath = [irix_precomp + '/python/lib/python2.2/config']
536     python_include = [irix_precomp + '/python/include/python2.2']
537     python_lib = ['python2.2']
538     python_linkflags = []
539     # International support information
540     ftgl_lib = ['ftgl']
541     ftgl_libpath = [irix_precomp + '/ftgl/lib']
542     ftgl_include = [irix_precomp + '/ftgl/include']
543     freetype_lib = ['freetype']
544     freetype_libpath = [irix_precomp + '/freetype/lib']
545     freetype_include = [irix_precomp + '/freetype/include']
546     gettext_lib = []
547     gettext_libpath = []
548     gettext_include = []
549     # OpenAL library information
550     openal_lib = []
551     openal_libpath = []
552     openal_include = []
553
554 elif string.find (sys.platform, 'hp-ux') != -1:
555     window_system = 'X11'
556     defines = []
557
558 elif sys.platform=='openbsd3':
559     print "Building for OpenBSD 3.x"
560     use_international = 'false'
561     use_gameengine = 'false'
562     use_openal = 'false'
563     use_fmod = 'false'
564     use_quicktime = 'false'
565     use_sumo = 'false'
566     use_ode = 'false'
567     use_buildinfo = 'true'
568     build_blender_dynamic = 'true'
569     build_blender_static = 'false'
570     build_blender_player = 'false'
571     build_blender_plugin = 'false'
572     release_flags = ['-O2']
573     debug_flags = ['-O2', '-g']
574     extra_flags = ['-pipe', '-fPIC', '-funsigned-char']
575     cxxflags = []
576     defines = []
577     warn_flags = ['-Wall','-W']
578     window_system = 'X11'
579     platform_libs = ['m', 'stdc++', 'pthread', 'util']
580     platform_libpath = []
581     platform_linkflags = []
582     extra_includes = []
583     z_lib = ['z']
584     z_libpath = ['/usr/lib']
585     z_include = ['/usr/include']
586     # png library information
587     png_lib = ['png']
588     png_libpath = ['/usr/local/lib']
589     png_include = ['/usr/local/include']
590     # jpeg library information
591     jpeg_lib = ['jpeg']
592     jpeg_libpath = ['/usr/local/lib']
593     jpeg_include = ['/usr/local/include']
594     # OpenGL library information
595     opengl_lib = ['GL', 'GLU']
596     opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
597     opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
598     opengl_include = ['/usr/X11R6/include/']
599     # SDL library information
600     sdl_env.ParseConfig ('sdl-config --cflags --libs')
601     sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
602     sdl_include = sdl_env.Dictionary()['CPPPATH']
603     sdl_libpath = sdl_env.Dictionary()['LIBPATH']
604     sdl_lib = sdl_env.Dictionary()['LIBS']
605     # SOLID library information
606     solid_lib = []                     # TODO
607     solid_libpath = []        # TODO
608     solid_include = ['#extern/solid']
609     qhull_lib = []       # TODO
610     qhull_libpath = []  # TODO
611     qhull_include = ['#extern/qhull/include']
612     # ODE library information
613     ode_lib = ['ode']
614     ode_libpath = ['#../lib/linux-glibc2.2.5-i386/ode/lib']
615     ode_include = ['#../lib/linux-glibc2.2.5-i386/ode/include']
616     # Python library information
617     python_lib = ['python%d.%d' % sys.version_info[0:2]]
618     python_libpath = [sysconfig.get_python_lib (0, 1) + '/config']
619     python_include = [sysconfig.get_python_inc ()]
620     python_linkflags = []
621     # International support information
622     ftgl_lib = ['ftgl']
623     ftgl_libpath = ['#../lib/linux-glibc2.2.5-i386/ftgl/lib']
624     ftgl_include = ['#../lib/linux-glibc2.2.5-i386/ftgl/include']
625     freetype_env.ParseConfig('pkg-config --cflags --libs freetype2')
626     freetype_lib = freetype_env.Dictionary()['LIBS']
627     freetype_libpath = freetype_env.Dictionary()['LIBPATH']
628     freetype_include = freetype_env.Dictionary()['CPPPATH']
629     gettext_lib = []
630     gettext_libpath = []
631     gettext_include = []
632     # OpenAL library information
633     openal_lib = ['openal']
634     openal_libpath = ['/usr/lib']
635     openal_include = ['/usr/include']
636
637 else:
638     print "Unknown platform %s"%sys.platform
639     exit
640
641 #-----------------------------------------------------------------------------
642 # End of platform specific section
643 #-----------------------------------------------------------------------------
644
645 #-----------------------------------------------------------------------------
646 # User configurable options to be saved in a config file.
647 #-----------------------------------------------------------------------------
648 # Checking for an existing config file - use that one if it exists,
649 # otherwise create one.
650 if os.path.exists (config_file):
651     print "Using config file: " + config_file
652 else:
653     print "Creating new config file: " + config_file
654     env_dict = env.Dictionary()
655     config=open (config_file, 'w')
656     config.write ("# Configuration file containing user definable options.\n")
657     config.write ("VERSION = '2.33-cvs'\n")
658     config.write ("BUILD_BINARY = 'release'\n")
659     config.write ("USE_BUILDINFO = %r\n"%(use_buildinfo))
660     config.write ("BUILD_BLENDER_DYNAMIC = %r\n"%(build_blender_dynamic))
661     config.write ("BUILD_BLENDER_STATIC = %r\n"%(build_blender_static))
662     config.write ("BUILD_BLENDER_PLAYER = %r\n"%(build_blender_player))
663     config.write ("BUILD_BLENDER_PLUGIN = %r\n"%(build_blender_plugin))
664     config.write ("BUILD_DIR = %r\n"%(root_build_dir))
665     config.write ("USE_INTERNATIONAL = %r\n"%(use_international))
666     config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
667     if use_ode == 'true':
668         config.write ("USE_PHYSICS = 'ode'\n")
669     else:
670         config.write ("USE_PHYSICS = 'solid'\n")
671     config.write ("USE_OPENAL = %r\n"%(use_openal))
672     config.write ("USE_FMOD = %r\n"%(use_fmod))
673     config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
674     config.write ("\n# Compiler information.\n")
675     config.write ("HOST_CC = %r\n"%(env_dict['CC']))
676     config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
677     config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
678     config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
679     config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
680     config.write ("PATH = %r\n"%(os.environ['PATH']))
681     config.write ("\n# External library information.\n")
682     config.write ("PLATFORM_LIBS = %r\n"%(platform_libs))
683     config.write ("PLATFORM_LIBPATH = %r\n"%(platform_libpath))
684     config.write ("PLATFORM_LINKFLAGS = %r\n"%(platform_linkflags))
685     config.write ("PYTHON_INCLUDE = %r\n"%(python_include))
686     config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath))
687     config.write ("PYTHON_LIBRARY = %r\n"%(python_lib))
688     config.write ("PYTHON_LINKFLAGS = %r\n"%(python_linkflags))
689     config.write ("SDL_CFLAGS = %r\n"%(sdl_cflags))
690     config.write ("SDL_INCLUDE = %r\n"%(sdl_include))
691     config.write ("SDL_LIBPATH = %r\n"%(sdl_libpath))
692     config.write ("SDL_LIBRARY = %r\n"%(sdl_lib))
693     config.write ("Z_INCLUDE = %r\n"%(z_include))
694     config.write ("Z_LIBPATH = %r\n"%(z_libpath))
695     config.write ("Z_LIBRARY = %r\n"%(z_lib))
696     config.write ("PNG_INCLUDE = %r\n"%(png_include))
697     config.write ("PNG_LIBPATH = %r\n"%(png_libpath))
698     config.write ("PNG_LIBRARY = %r\n"%(png_lib))
699     config.write ("JPEG_INCLUDE = %r\n"%(jpeg_include))
700     config.write ("JPEG_LIBPATH = %r\n"%(jpeg_libpath))
701     config.write ("JPEG_LIBRARY = %r\n"%(jpeg_lib))
702     config.write ("OPENGL_INCLUDE = %r\n"%(opengl_include))
703     config.write ("OPENGL_LIBPATH = %r\n"%(opengl_libpath))
704     config.write ("OPENGL_LIBRARY = %r\n"%(opengl_lib))
705     config.write ("OPENGL_STATIC = %r\n"%(opengl_static))
706     config.write ("\n# The following information is only necessary when you've enabled support for\n")
707     config.write ("# the game engine.\n")
708     config.write ("SOLID_INCLUDE = %r\n"%(solid_include))
709     config.write ("SOLID_LIBPATH = %r\n"%(solid_libpath))
710     config.write ("SOLID_LIBRARY = %r\n"%(solid_lib))
711     config.write ("QHULL_INCLUDE = %r\n"%(qhull_include))
712     config.write ("QHULL_LIBPATH = %r\n"%(qhull_libpath))
713     config.write ("QHULL_LIBRARY = %r\n"%(qhull_lib))
714     config.write ("ODE_INCLUDE = %r\n"%(ode_include))
715     config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
716     config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
717     config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
718     config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
719     config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
720     config.write ("\n# The following information is only necessary when building with\n")
721     config.write ("# internationalization support.\n");
722     config.write ("FTGL_INCLUDE = %r\n"%(ftgl_include))
723     config.write ("FTGL_LIBPATH = %r\n"%(ftgl_libpath))
724     config.write ("FTGL_LIBRARY = %r\n"%(ftgl_lib))
725     config.write ("FREETYPE_INCLUDE = %r\n"%(freetype_include))
726     config.write ("FREETYPE_LIBPATH = %r\n"%(freetype_libpath))
727     config.write ("FREETYPE_LIBRARY = %r\n"%(freetype_lib))
728     config.write ("GETTEXT_INCLUDE = %r\n"%(gettext_include))
729     config.write ("GETTEXT_LIBPATH = %r\n"%(gettext_libpath))
730     config.write ("GETTEXT_LIBRARY = %r\n"%(gettext_lib))
731     config.close ()
732
733 #-----------------------------------------------------------------------------
734 # Read the options from the config file and update the various necessary flags
735 #-----------------------------------------------------------------------------
736 list_opts = []
737 user_options_env = Environment ()
738 user_options = Options (config_file)
739 user_options.AddOptions (
740         ('VERSION', 'Blender version', version),
741         (EnumOption ('BUILD_BINARY', 'release',
742                      'Select a release or debug binary.',
743                      allowed_values = ('release', 'debug'))),
744         (BoolOption ('USE_BUILDINFO',
745                      'Set to 1 if you want to add build information.',
746                      'false')),
747         (BoolOption ('BUILD_BLENDER_DYNAMIC',
748                      'Set to 1 if you want to build blender with hardware accellerated OpenGL support.',
749                      'true')),
750         (BoolOption ('BUILD_BLENDER_STATIC',
751                      'Set to 1 if you want to build blender with software OpenGL support.',
752                      'false')),
753         (BoolOption ('BUILD_BLENDER_PLAYER',
754                      'Set to 1 if you want to build the blender player.',
755                      'false')),
756         (BoolOption ('BUILD_BLENDER_PLUGIN',
757                      'Set to 1 if you want to build the blender plugin.',
758                      'false')),
759         ('BUILD_DIR', 'Target directory for intermediate files.',
760                      root_build_dir),
761         (BoolOption ('USE_INTERNATIONAL',
762                      'Set to 1 to have international support.',
763                      'false')),
764         (EnumOption ('USE_PHYSICS', 'solid',
765                      'Select which physics engine to use.',
766                      allowed_values = ('ode', 'solid'))),
767         (BoolOption ('BUILD_GAMEENGINE',
768                      'Set to 1 to build blender with game engine support.',
769                      'false')),
770         (BoolOption ('USE_OPENAL',
771                      'Set to 1 to build the game engine with OpenAL support.',
772                      'false')),
773         (BoolOption ('USE_FMOD',
774                      'Set to 1 to build the game engine with FMod support.',
775                      'false')),
776         (BoolOption ('USE_QUICKTIME',
777                      'Set to 1 to add support for QuickTime.',
778                      'false')),
779         ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
780         ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
781         ('TARGET_CC', 'C compiler for the target platform.'),
782         ('TARGET_CXX', 'C++ compiler for the target platform.'),
783         ('TARGET_AR', 'Linker command for linking libraries.'),
784         ('PATH', 'Standard search path'),
785         ('PLATFORM_LIBS', 'Platform specific libraries.'),
786         ('PLATFORM_LIBPATH', 'Platform specific library link path.'),
787         ('PLATFORM_LINKFLAGS', 'Platform specific linkflags'),
788         ('PYTHON_INCLUDE', 'Include directory for Python header files.'),
789         ('PYTHON_LIBPATH', 'Library path where the Python lib is located.'),
790         ('PYTHON_LIBRARY', 'Python library name.'),
791         ('PYTHON_LINKFLAGS', 'Python specific linkflags.'),
792         ('SDL_CFLAGS', 'Necessary CFLAGS when using sdl functionality.'),
793         ('SDL_INCLUDE', 'Include directory for SDL header files.'),
794         ('SDL_LIBPATH', 'Library path where the SDL library is located.'),
795         ('SDL_LIBRARY', 'SDL library name.'),
796         ('Z_INCLUDE', 'Include directory for zlib header files.'),
797         ('Z_LIBPATH', 'Library path where the zlib library is located.'),
798         ('Z_LIBRARY', 'Z library name.'),
799         ('PNG_INCLUDE', 'Include directory for png header files.'),
800         ('PNG_LIBPATH', 'Library path where the png library is located.'),
801         ('PNG_LIBRARY', 'png library name.'),
802         ('JPEG_INCLUDE', 'Include directory for jpeg header files.'),
803         ('JPEG_LIBPATH', 'Library path where the jpeg library is located.'),
804         ('JPEG_LIBRARY', 'jpeg library name.'),
805         ('OPENGL_INCLUDE', 'Include directory for OpenGL header files.'),
806         ('OPENGL_LIBPATH', 'Library path where the OpenGL libraries are located.'),
807         ('OPENGL_LIBRARY', 'OpenGL library names.'),
808         ('OPENGL_STATIC', 'Linker flags for static linking of Open GL.'),
809         ('SOLID_INCLUDE', 'Include directory for SOLID header files.'),
810         ('SOLID_LIBPATH', 'Library path where the SOLID library is located.'),
811         ('SOLID_LIBRARY', 'SOLID library name.'),
812         ('QHULL_INCLUDE', 'Include directory for QHULL header files.'),
813         ('QHULL_LIBPATH', 'Library path where the QHULL library is located.'),
814         ('QHULL_LIBRARY', 'QHULL library name.'),
815         ('ODE_INCLUDE', 'Include directory for ODE header files.'),
816         ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
817         ('ODE_LIBRARY', 'ODE library name.'),
818         ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
819         ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
820         ('OPENAL_LIBRARY', 'OpenAL library name.'),
821         ('FTGL_INCLUDE', 'Include directory for ftgl header files.'),
822         ('FTGL_LIBPATH', 'Library path where the ftgl library is located.'),
823         ('FTGL_LIBRARY', 'ftgl library name.'),
824         ('FREETYPE_INCLUDE', 'Include directory for freetype2 header files.'),
825         ('FREETYPE_LIBPATH', 'Library path where the freetype2 library is located.'),
826         ('FREETYPE_LIBRARY', 'Freetype2 library name.'),
827         ('GETTEXT_INCLUDE', 'Include directory for gettext header files.'),
828         ('GETTEXT_LIBPATH', 'Library path where the gettext library is located.'),
829         ('GETTEXT_LIBRARY', 'gettext library name.')
830     )
831 user_options.Update (user_options_env)
832 user_options_dict = user_options_env.Dictionary()
833
834 root_build_dir = user_options_dict['BUILD_DIR']
835     
836 if user_options_dict['BUILD_GAMEENGINE'] == 1:
837     defines += ['GAMEBLENDER=1']
838     if user_options_dict['USE_PHYSICS'] == 'ode':
839         defines += ['USE_ODE']
840     else:
841         defines += ['USE_SUMO_SOLID']
842 else:
843     defines += ['GAMEBLENDER=0']
844
845 if user_options_dict['BUILD_BINARY'] == 'release':
846     cflags = extra_flags + release_flags + warn_flags
847     if sys.platform == 'win32':
848         defines += ['NDEBUG']
849 else:
850     cflags = extra_flags + debug_flags + warn_flags
851     if sys.platform == 'win32':
852         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
853         platform_linkflags += ['/DEBUG','/PDB:blender.pdb']
854
855 #-----------------------------------------------------------------------------
856 # Generic library generation environment. This one is the basis for each
857 # library.
858 #-----------------------------------------------------------------------------
859 library_env = env.Copy ()
860 library_env.Replace (CC = user_options_dict['TARGET_CC'])
861 library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
862 library_env.Replace (PATH = user_options_dict['PATH'])
863 library_env.Replace (AR = user_options_dict['TARGET_AR'])
864 library_env.Append (CCFLAGS = cflags)
865 library_env.Append (CXXFLAGS = cxxflags)
866 library_env.Append (CPPDEFINES = defines)
867 library_env.SConsignFile (root_build_dir+'scons-signatures')
868
869 #-----------------------------------------------------------------------------
870 # Settings to be exported to other SConscript files
871 #-----------------------------------------------------------------------------
872
873 Export ('cflags')
874 Export ('defines')
875 Export ('window_system')
876 Export ('extra_includes')
877 Export ('user_options_dict')
878 Export ('library_env')
879
880 BuildDir (root_build_dir+'/extern', 'extern', duplicate=0)
881 SConscript (root_build_dir+'extern/SConscript')
882 BuildDir (root_build_dir+'/intern', 'intern', duplicate=0)
883 SConscript (root_build_dir+'intern/SConscript')
884 BuildDir (root_build_dir+'/source', 'source', duplicate=0)
885 SConscript (root_build_dir+'source/SConscript')
886
887 libpath = (['#'+root_build_dir+'/lib'])
888
889 libraries = (['blender_creator',
890               'blender_render',
891               'blender_yafray',
892               'blender_blendersrc',
893               'blender_renderconverter',
894               'blender_blenloader',
895               'blender_readblenfile',
896               'blender_img',
897               'blender_radiosity',
898               'blender_blenkernel',
899               'blender_blenpluginapi',
900               'blender_imbuf',
901               'blender_avi',
902               'blender_blenlib',
903               'blender_makesdna',
904               'blender_kernel',
905               'blender_BSP',
906               'blender_LOD',
907               'blender_GHOST',
908               'blender_STR',
909               'blender_guardedalloc',
910               'blender_BMF',
911               'blender_CTR',
912               'blender_MEM',
913               'blender_IK',
914               'blender_MT',
915               'soundsystem'])
916
917 link_env = library_env.Copy ()
918 link_env.Append (LIBS=libraries)
919 link_env.Append (LIBPATH=libpath)
920
921 if user_options_dict['USE_INTERNATIONAL'] == 1:
922     link_env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
923     link_env.Append (LIBPATH=user_options_dict['FREETYPE_LIBPATH'])
924     link_env.Append (LIBS=['blender_FTF'])
925     link_env.Append (LIBS=user_options_dict['FTGL_LIBRARY'])
926     link_env.Append (LIBPATH=user_options_dict['FTGL_LIBPATH'])
927     link_env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
928 if user_options_dict['USE_QUICKTIME'] == 1:
929     link_env.Append (LIBS=['blender_quicktime'])
930
931 if user_options_dict['BUILD_GAMEENGINE'] == 1:
932     link_env.Append (LIBS=['KX_blenderhook',
933                            'KX_converter',
934                            'PHY_Dummy',
935                            'PHY_Physics',
936                            'KX_ketsji',
937                            'SCA_GameLogic',
938                            'RAS_rasterizer',
939                            'RAS_OpenGLRasterizer',
940                            'blender_expressions',
941                            'SG_SceneGraph',
942                            'blender_MT',
943                            'KX_blenderhook',
944                            'KX_network',
945                            'blender_kernel',
946                            'NG_network',
947                            'NG_loopbacknetwork'])
948     if user_options_dict['USE_PHYSICS'] == 'solid':
949         link_env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
950     else:
951         link_env.Append (LIBS=['PHY_Ode',
952                                'PHY_Physics'])
953         link_env.Append (LIBS=user_options_dict['ODE_LIBRARY'])
954         link_env.Append (LIBPATH=user_options_dict['ODE_LIBPATH'])
955
956 link_env.Append (LIBS=['blender_python'])
957 link_env.Append (LIBS=user_options_dict['PYTHON_LIBRARY'])
958 link_env.Append (LIBPATH=user_options_dict['PYTHON_LIBPATH'])
959 link_env.Append (LINKFLAGS=user_options_dict['PYTHON_LINKFLAGS'])
960 link_env.Append (LIBS=user_options_dict['SDL_LIBRARY'])
961 link_env.Append (LIBPATH=user_options_dict['SDL_LIBPATH'])
962 link_env.Append (LIBS=user_options_dict['PNG_LIBRARY'])
963 link_env.Append (LIBPATH=user_options_dict['PNG_LIBPATH'])
964 link_env.Append (LIBS=user_options_dict['JPEG_LIBRARY'])
965 link_env.Append (LIBPATH=user_options_dict['JPEG_LIBPATH'])
966 link_env.Append (LIBS=user_options_dict['GETTEXT_LIBRARY'])
967 link_env.Append (LIBPATH=user_options_dict['GETTEXT_LIBPATH'])
968 link_env.Append (LIBS=user_options_dict['Z_LIBRARY'])
969 link_env.Append (LIBPATH=user_options_dict['Z_LIBPATH'])
970 if user_options_dict['USE_OPENAL'] == 1:
971     link_env.Append (LIBS=user_options_dict['OPENAL_LIBRARY'])
972     link_env.Append (LIBPATH=user_options_dict['OPENAL_LIBPATH'])
973 link_env.Append (LIBS=user_options_dict['PLATFORM_LIBS'])
974 link_env.Append (LIBPATH=user_options_dict['PLATFORM_LIBPATH'])
975 if sys.platform == 'darwin':
976     link_env.Append (LINKFLAGS='-framework')
977     link_env.Append (LINKFLAGS='Carbon')
978     link_env.Append (LINKFLAGS='-framework')
979     link_env.Append (LINKFLAGS='AGL')
980     link_env.Append (LINKFLAGS='-framework')
981     link_env.Append (LINKFLAGS='AudioUnit')
982     link_env.Append (LINKFLAGS='-framework')
983     link_env.Append (LINKFLAGS='AudioToolbox')
984     link_env.Append (LINKFLAGS='-framework')
985     link_env.Append (LINKFLAGS='CoreAudio')
986     if user_options_dict['USE_QUICKTIME'] == 1:
987         link_env.Append (LINKFLAGS='-framework')
988         link_env.Append (LINKFLAGS='QuickTime')
989 else:
990     link_env.Append (LINKFLAGS=user_options_dict['PLATFORM_LINKFLAGS'])
991
992 if sys.platform == 'win32':
993     link_env.RES(['source/icons/winblender.rc'])
994
995 link_env.BuildDir (root_build_dir, '.', duplicate=0)
996
997 build_date = time.strftime ("%Y-%m-%d")
998 build_time = time.strftime ("%H:%M:%S")
999
1000 if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
1001     dy_blender = link_env.Copy ()
1002     dy_blender.Append (LIBS=user_options_dict['OPENGL_LIBRARY'])
1003     dy_blender.Append (LIBPATH=user_options_dict['OPENGL_LIBPATH'])
1004     dy_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1005     if user_options_dict['USE_BUILDINFO'] == 1:
1006         if sys.platform=='win32':
1007             build_info_file = open("source/creator/winbuildinfo.h", 'w')
1008             build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1009             build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1010             build_info_file.write("char *build_platform=\"win32\";\n")
1011             build_info_file.write("char *build_type=\"dynamic\";\n")
1012             build_info_file.close()
1013             dy_blender.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1014         else:
1015             dy_blender.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1016                                          'BUILD_DATE=\'"%s"\''%(build_date),
1017                                          'BUILD_TYPE=\'"dynamic"\'',
1018                                          'NAN_BUILDINFO',
1019                                          'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1020     d_obj = [dy_blender.Object (root_build_dir+'source/creator/d_buildinfo',
1021                                 [root_build_dir+'source/creator/buildinfo.c'])]
1022     if sys.platform == 'win32':
1023         dy_blender.Program (target='blender',
1024                             source=d_obj + ['source/icons/winblender.res'])
1025     else:
1026         if sys.platform == 'cygwin':
1027             dy_blender.Replace (CC='g++')
1028         dy_blender.Program (target='blender', source=d_obj)
1029 if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
1030     st_blender = link_env.Copy ()
1031     # The next line is to make sure that the LINKFLAGS are appended at the end
1032     # of the link command. This 'trick' is needed because the GL and GLU static
1033     # libraries need to be at the end of the command.
1034     st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
1035     if user_options_dict['USE_BUILDINFO'] == 1:
1036         if sys.platform=='win32':
1037             build_info_file = open("source/creator/winbuildinfo.h", 'w')
1038             build_info_file.write("char *build_date=\"%s\";\n"%build_date)
1039             build_info_file.write("char *build_time=\"%s\";\n"%build_time)
1040             build_info_file.write("char *build_platform=\"win32\";\n")
1041             build_info_file.write("char *build_type=\"static\";\n")
1042             build_info_file.close()
1043             st_blender.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
1044         else:
1045             st_blender.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
1046                                          'BUILD_DATE=\'"%s"\''%(build_date),
1047                                          'BUILD_TYPE=\'"static"\'',
1048                                          'NAN_BUILDINFO',
1049                                          'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
1050     st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
1051     st_blender.Append (CPPPATH=user_options_dict['OPENGL_INCLUDE'])
1052     s_obj = [st_blender.Object (root_build_dir+'source/creator/s_buildinfo',
1053                                 [root_build_dir+'source/creator/buildinfo.c'])]
1054     st_blender.Prepend (LIBPATH=['/usr/lib/opengl/xfree/lib'])
1055     st_blender.Program (target='blenderstatic', source=s_obj)
1056
1057 if sys.platform == 'darwin':
1058     bundle = Environment ()
1059     blender_app = 'blender'
1060     bundle.Depends ('#/blender.app/Contents/Info.plist', blender_app)
1061     bundle.Command ('#/blender.app/Contents/Info.plist',
1062                     '#/source/darwin/blender.app/Contents/Info.plist',
1063                     "rm -rf blender.app && " + \
1064                     "cp -R source/darwin/blender.app . && " +
1065                     "cat $SOURCE | sed s/VERSION/`cat release/VERSION`/ | \
1066                                    sed s/DATE/`date +'%Y-%b-%d'`/ \
1067                                    > $TARGET && " + \
1068                     'cp -p blender blender.app/Contents/MacOS/blender && ' + \
1069                     'strip -u -r blender.app/Contents/MacOS/blender && ' + \
1070                     'cp bin/.blender/.bfont.ttf blender.app/Contents/Resources/ && ' + \
1071                     'cp bin/.blender/.Blanguages blender.app/Contents/Resources/ && ' + \
1072                     'cp -R bin/.blender/locale blender.app/Contents/Resources/ && ' + \
1073                     'cp -R release/bpydata blender.app/Contents/Resources/ && ' + \
1074                     'cp -R release/scripts blender.app/Contents/Resources/ && ' + \
1075                     'cp -R release/plugins blender.app/Contents/Resources/ && ' + \
1076                     'chmod +x $TARGET && ' + \
1077                     'find blender.app -name CVS -prune -exec rm -rf {} \; && ' +
1078                     'find blender.app -name .DS_Store -exec rm -rf {} \;')
1079 elif sys.platform=='win32':
1080     if user_options_dict['BUILD_BINARY']=='debug':
1081         browser = Environment()
1082         browser_tmp = root_build_dir+'bscmake.tmp'
1083         browser.Command ('blender.bsc', 'blender$PROGSUFFIX',
1084             ['dir /b/s '+root_build_dir+'*.sbr >'+browser_tmp,
1085              'bscmake /nologo /n /oblender.bsc @'+browser_tmp,
1086              'del '+browser_tmp])