16 Variables = SCons.Variables
17 BoolVariable = SCons.Variables.BoolVariable
19 def print_arguments(args, bc):
21 for k,v in args.iteritems():
24 print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC
26 print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC
28 def validate_arguments(args, bc):
30 'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
31 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
32 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
33 'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
34 'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
36 'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
37 'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
38 'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
39 'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
40 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
41 'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
42 'WITH_BF_INTERNATIONAL',
43 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
44 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
45 'WITH_BF_ODE', 'BF_ODE', 'BF_ODE_INC', 'BF_ODE_LIB',
46 'WITH_BF_GAMEENGINE', 'WITH_BF_SOLID', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
47 'BF_SOLID', 'BF_SOLID_INC', 'BF_WINTAB', 'BF_WINTAB_INC',
49 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
50 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
51 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
52 'WITH_BF_FTGL', 'BF_FTGL', 'BF_FTGL_INC', 'BF_FTGL_LIB',
57 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
58 'WITH_BF_VERSE', 'BF_VERSE_INCLUDE',
59 'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO',
60 'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
64 'BF_FANCY', 'BF_QUIET',
71 # Have options here that scons expects to be lists
73 'BF_PYTHON_LINKFLAGS',
74 'BF_OPENGL_LINKFLAGS',
75 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
76 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
77 'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS',
78 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
79 'C_WARN', 'CC_WARN', 'CXX_WARN',
80 'LLIBS', 'PLATFORM_LINKFLAGS',
84 arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
85 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
86 'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE',
87 'BF_BSC', 'BF_CONFIG',
88 'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
89 'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
94 for k,v in args.iteritems():
95 if (k in opts_list) or (k in arg_list):
97 elif k in opts_list_split:
98 okdict[k] = v.split() # "" have alredy been stripped
100 print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v
104 def print_targets(targs, bc):
107 print '\t'+bc.OKBLUE+t+bc.ENDC
109 print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC
111 def validate_targets(targs, bc):
112 valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
113 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
114 'everything', 'clean', 'install-bin', 'install', 'nsis']
120 print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
124 def ourspawn(self, sh, escape, cmd, args, env):
125 newargs = string.join(args[1:], ' ')
126 cmdline = cmd + " " + newargs
127 startupinfo = subprocess.STARTUPINFO()
128 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
129 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
130 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
131 data, err = proc.communicate()
139 def SetupSpawn( env ):
142 env['SPAWN'] = buf.ourspawn
145 def read_opts(cfg, args):
146 localopts = Variables.Variables(cfg, args)
147 localopts.AddVariables(
148 ('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
149 ('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
150 ('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
151 (BoolVariable('WITH_BF_VERSE', 'Use VERSE if true', False)),
152 ('BF_VERSE_INCLUDE', 'verse include dir', '/usr/include'),
153 ('LCGDIR', 'location of cvs lib dir'),
154 ('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
155 ('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
156 ('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
157 ('BF_DEBUG_LIBS', 'list of libraries to build with debug symbols'),
159 (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
160 ('BF_PYTHON', 'base path for python', ''),
161 ('BF_PYTHON_VERSION', 'Python version to use', ''),
162 ('BF_PYTHON_INC', 'include path for Python headers', ''),
163 ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''),
164 ('BF_PYTHON_LIB', 'Python library', ''),
165 ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''),
166 ('BF_PYTHON_LIBPATH', 'Library path', ''),
167 ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
168 (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
170 (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
171 (BoolVariable('WITH_BF_YAFRAY', 'Enable Yafray', True)),
173 (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
174 ('BF_OPENAL', 'base path for OpenAL', ''),
175 ('BF_OPENAL_INC', 'include path for python headers', ''),
176 ('BF_OPENAL_LIB', 'Path to OpenAL library', ''),
177 ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''),
178 ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
179 (BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
181 (BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
182 ('BF_SDL', 'SDL base path', ''),
183 ('BF_SDL_INC', 'SDL include path', ''), #$(shell $(BF_SDL)/bin/sdl-config --cflags)
184 ('BF_SDL_LIB', 'SDL library', ''), #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
185 ('BF_SDL_LIBPATH', 'SDL library path', ''),
187 ('BF_PTHREADS', 'Pthreads base path', ''),
188 ('BF_PTHREADS_INC', 'Pthreads include path', ''),
189 ('BF_PTHREADS_LIB', 'Pthreads library', ''),
190 ('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''),
192 (BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)),
193 (BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)),
194 ('BF_OPENEXR', 'OPENEXR base path', ''),
195 ('BF_OPENEXR_INC', 'OPENEXR include path', ''),
196 ('BF_OPENEXR_LIB', 'OPENEXR library', ''),
197 ('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''),
198 ('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''),
200 (BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)),
202 (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
203 ('BF_FFMPEG', 'FFMPEG base path', ''),
204 ('BF_FFMPEG_LIB', 'FFMPEG library', ''),
205 ('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''),
207 ('BF_FFMPEG_INC', 'FFMPEG includes', ''),
208 ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
210 (BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
212 ('BF_OGG', 'OGG base path', ''),
213 ('BF_OGG_LIB', 'OGG library', ''),
215 (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
216 ('BF_JPEG', 'JPEG base path', ''),
217 ('BF_JPEG_INC', 'JPEG include path', ''),
218 ('BF_JPEG_LIB', 'JPEG library', ''),
219 ('BF_JPEG_LIBPATH', 'JPEG library path', ''),
221 (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
222 ('BF_OPENJPEG', 'OPENJPEG base path', ''),
223 ('BF_OPENJPEG_INC', 'OPENJPEG include path', ''),
224 ('BF_OPENJPEG_LIB', 'OPENJPEG library', ''),
225 ('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''),
227 (BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)),
228 ('BF_REDCODE', 'REDCODE base path', ''),
229 ('BF_REDCODE_INC', 'REDCODE include path', ''),
230 ('BF_REDCODE_LIB', 'REDCODE library', ''),
231 ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
233 (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
234 ('BF_PNG', 'PNG base path', ''),
235 ('BF_PNG_INC', 'PNG include path', ''),
236 ('BF_PNG_LIB', 'PNG library', ''),
237 ('BF_PNG_LIBPATH', 'PNG library path', ''),
239 ('BF_TIFF', 'TIFF base path', ''),
240 ('BF_TIFF_INC', 'TIFF include path', ''),
241 ('BF_TIFF_LIB', 'TIFF library', ''),
242 ('BF_TIFF_LIBPATH', 'TIFF library path', ''),
244 (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
245 ('BF_ZLIB', 'ZLib base path', ''),
246 ('BF_ZLIB_INC', 'ZLib include path', ''),
247 ('BF_ZLIB_LIB', 'ZLib library', ''),
248 ('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
250 (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext and Freetype if true', True)),
252 ('BF_GETTEXT', 'gettext base path', ''),
253 ('BF_GETTEXT_INC', 'gettext include path', ''),
254 ('BF_GETTEXT_LIB', 'gettext library', ''),
255 ('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
257 (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
258 ('BF_ICONV', 'iconv base path', ''),
259 ('BF_ICONV_INC', 'iconv include path', ''),
260 ('BF_ICONV_LIB', 'iconv library', ''),
261 ('BF_ICONV_LIBPATH', 'iconv library path', ''),
263 (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , True)),
265 (BoolVariable('WITH_BF_ODE', 'Use ODE if true', True)),
266 ('BF_ODE', 'ODE base path', ''),
267 ('BF_ODE_INC', 'ODE include path' , ''),
268 ('BF_ODE_LIB', 'ODE library', ''),
270 (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
271 ('BF_BULLET', 'Bullet base dir', ''),
272 ('BF_BULLET_INC', 'Bullet include path', ''),
273 ('BF_BULLET_LIB', 'Bullet library', ''),
275 (BoolVariable('WITH_BF_SOLID', 'Use Sumo/Solid deprecated physics system if true', True)),
276 ('BF_SOLID', 'Solid base dir', '#/extern/solid'),
277 ('BF_SOLID_INC', 'Solid include path', ''),
278 ('BF_WINTAB', 'WinTab base dir', ''),
279 ('BF_WINTAB_INC', 'WinTab include dir', ''),
280 ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
281 (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
282 ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
284 ##WITH_BF_NSPR = True
285 ##BF_NSPR = $(LCGDIR)/nspr
286 ##BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
288 ### Uncomment the following line to use Mozilla inplace of netscape
289 ##CPPFLAGS += -DMOZ_NOT_NET
290 ### Location of MOZILLA/Netscape header files...
291 ##BF_MOZILLA = $(LCGDIR)/mozilla
292 ##BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
294 ### Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
295 ### if this is not set.
297 ### Be paranoid regarding library creation (do not update archives)
300 ### enable freetype2 support for text objects
301 (BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', False)),
302 ('BF_FREETYPE', 'Freetype base path', ''),
303 ('BF_FREETYPE_INC', 'Freetype include path', ''),
304 ('BF_FREETYPE_LIB', 'Freetype library', ''),
305 ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
307 (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
309 (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
310 ('BF_QUICKTIME', 'QuickTime base path', ''),
311 ('BF_QUICKTIME_INC', 'QuickTime include path', ''),
312 ('BF_QUICKTIME_LIB', 'QuickTime library', ''),
313 ('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
315 (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
316 ('BF_OPENGL', 'OpenGL base path', ''),
317 ('BF_OPENGL_INC', 'OpenGL include path', ''),
318 ('BF_OPENGL_LIB', 'OpenGL libraries', ''),
319 ('BF_OPENGL_LIBPATH', 'OpenGL library path', ''),
320 ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
321 ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
323 (BoolVariable('WITH_BF_FTGL', 'Use FTGL if true', True)),
324 ('BF_FTGL', 'FTGL base path', ''),
325 ('BF_FTGL_INC', 'FTGL include path', ''),
326 ('BF_FTGL_LIB', 'FTGL libraries', ''),
328 (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
329 (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
331 ('CFLAGS', 'C only flags', ''),
332 ('CCFLAGS', 'Generic C and C++ flags', ''),
333 ('CXXFLAGS', 'C++ only flags', ''),
334 ('CPPFLAGS', 'Defines', ''),
335 ('REL_CFLAGS', 'C only release flags', ''),
336 ('REL_CCFLAGS', 'Generic C and C++ release flags', ''),
337 ('REL_CXXFLAGS', 'C++ only release flags', ''),
339 ('C_WARN', 'C warning flags', ''),
340 ('CC_WARN', 'Generic C and C++ warning flags', ''),
341 ('CXX_WARN', 'C++ only warning flags', ''),
343 ('LLIBS', 'Platform libs', ''),
344 ('PLATFORM_LINKFLAGS', 'Platform linkflags', ''),
346 (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
347 ('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
348 ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
349 ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
350 ('BF_PROFILE_LINKFLAGS', 'Profile linkflags', ''),
352 (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
353 ('BF_DEBUG_CFLAGS', 'C only debug flags', ''),
354 ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
355 ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
357 (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
359 ('BF_BUILDDIR', 'Build dir', ''),
360 ('BF_INSTALLDIR', 'Installation dir', ''),
361 ('BF_DOCDIR', 'Dir where BPy documentation will be created', ''),
363 ('CC', 'C compiler to use', ''),
364 ('CXX', 'C++ compiler to use', ''),
366 (BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)),
368 (BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)),
369 (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
370 (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
371 (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
372 (BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
373 (BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
375 ('BF_X264_CONFIG', 'configuration flags for x264', ''),
376 ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
377 (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
379 ('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
380 ('BF_NUMJOBS', 'Number of build processes to spawn', '1')
382 ) # end of opts.AddOptions()
386 def NSIS_print(target, source, env):
387 return "Creating NSIS installer for Blender 3D"
389 def NSIS_Installer(target=None, source=None, env=None):
391 if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
392 print "NSIS installer is only available on Windows."
395 start_dir = os.getcwd()
396 rel_dir = start_dir + "\\release\\windows\\installer\\"
397 install_base_dir = start_dir + "\\"
399 if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
400 os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
402 for f in glob.glob('source/blender/blenpluginapi/*.h'):
403 shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
405 shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
409 version = v.read()[:-1]
410 shortver = version.split('.')[0] + version.split('.')[1]
413 #### change to suit install dir ####
414 inst_dir = install_base_dir + env['BF_INSTALLDIR']
416 os.chdir("windows/installer")
418 ns = open("00.sconsblender.nsi","r")
420 ns_cnt = str(ns.read())
425 rootdir = os.listdir(inst_dir+"\\")
426 for rootitem in rootdir:
427 if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
428 rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
429 rootstring = string.join(rootlist, "\n ")
431 ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
435 for rootitem in rootdir:
436 if os.path.isdir(inst_dir + rootitem) == 0:
437 delrootlist.append("Delete $INSTDIR\\" + rootitem)
438 delrootstring = string.join(delrootlist, "\n ")
439 delrootstring += "\n"
440 ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
444 scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
445 scriptdir = os.listdir(scriptpath)
446 for scriptitem in scriptdir:
447 scriptfile = "%s\\%s" % (scriptpath, scriptitem)
448 if os.path.isdir(scriptfile) == 0:
449 scriptfile = os.path.normpath(scriptfile)
450 scriptlist.append("File \"%s\"" % scriptfile)
451 scriptstring = string.join(scriptlist, "\n ")
452 scriptstring += "\n\n"
453 ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
455 # do scripts\bpymodules
457 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
458 bpymoddir = os.listdir(bpymodpath)
460 for bpymoditem in bpymoddir:
461 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
462 if os.path.isdir(bpymodfile) == 0:
463 bpymodfile = os.path.normpath(bpymodfile)
464 bpymodlist.append("File \"%s\"" % bpymodfile)
465 bpymodstring = string.join(bpymodlist, "\n ")
466 bpymodstring += "\n\n"
467 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
469 # do scripts\bpymodules\colladaimex
471 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
472 bpymoddir = os.listdir(bpymodpath)
474 for bpymoditem in bpymoddir:
475 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
476 if os.path.isdir(bpymodfile) == 0:
477 bpymodfile=os.path.normpath(bpymodfile)
478 colladalist.append("File \"%s\"" % bpymodfile)
479 bpymodstring = string.join(colladalist, "\n ")
480 bpymodstring += "\n\n"
481 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
485 bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
486 bpydatadir = os.listdir(bpydatapath)
487 for bpydataitem in bpydatadir:
488 bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
489 if os.path.isdir(bpydatafile) == 0:
490 bpydatalist.append("File \"%s\"" % bpydatafile)
491 bpydatastring = string.join(bpydatalist, "\n ")
492 bpydatastring += "\n\n"
493 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
497 plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
498 plugincludedir = os.listdir(plugincludepath)
499 for plugincludeitem in plugincludedir:
500 plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
501 if os.path.isdir(plugincludefile) == 0:
502 if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
503 plugincludefile = os.path.normpath(plugincludefile)
504 plugincludelist.append("File \"%s\"" % plugincludefile)
505 plugincludestring = string.join(plugincludelist, "\n ")
506 plugincludestring += "\n\n"
507 ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
509 # do scripts\bpydata\config
511 cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
512 cfgdir = os.listdir(cfgpath)
513 for cfgitem in cfgdir:
514 cfgfile = "%s\\%s" % (cfgpath, cfgitem)
515 if os.path.isdir(cfgfile) == 0:
516 cfglist.append("File \"%s\"" % cfgfile)
517 cfgstring = string.join(cfglist, "\n ")
519 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
523 dotblenddir = os.listdir(inst_dir+"\\.blender")
524 for dotblenditem in dotblenddir:
525 if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
526 dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
528 dotblendstring = string.join(dotblendlist, "\n ")
529 dotblendstring += "\n\n"
530 ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
535 langdir = os.listdir(inst_dir + "\\.blender\\locale")
536 for langitem in langdir:
537 if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
538 langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
539 langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
540 + langitem + "\\LC_MESSAGES\\blender.mo\"")
541 langstring = string.join(langfiles, "\n ")
543 ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
546 ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
547 ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
548 ns_cnt = string.replace(ns_cnt, "VERSION", version)
549 ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
551 tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
552 new_nsis = open(tmpnsi, 'w')
553 new_nsis.write(ns_cnt)
555 print "Preparing nsis file looks ok\n"
558 print "try to launch 'makensis' ...make sure it is on the path \n"
560 cmdline = "makensis " + "\""+tmpnsi+"\""
562 startupinfo = subprocess.STARTUPINFO()
563 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
564 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
565 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
566 data, err = proc.communicate()
571 print data.strip().split("\n")[-1]