16 Variables = SCons.Variables
17 BoolVariable = SCons.Variables.BoolVariable
19 def print_arguments(args, bc):
21 for k,v in args.iteritems():
22 print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC
24 print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC
26 def validate_arguments(args, bc):
28 'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LINKFLAGS', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
29 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
30 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
31 'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
33 'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
35 'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
36 'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
37 'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
38 'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
39 'BF_TIFF', 'BF_TIFF_INC',
40 'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
41 'WITH_BF_INTERNATIONAL',
42 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
43 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
44 'WITH_BF_ODE', 'BF_ODE', 'BF_ODE_INC', 'BF_ODE_LIB',
45 'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
46 'BF_SOLID', 'BF_SOLID_INC', 'BF_WINTAB', 'BF_WINTAB_INC',
48 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
49 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
50 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', 'BF_OPENGL_LINKFLAGS',
51 'WITH_BF_FTGL', 'BF_FTGL', 'BF_FTGL_INC', 'BF_FTGL_LIB',
55 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
56 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
57 'BF_PROFILE_FLAGS', 'BF_PROFILE_FLAGS', 'BF_PROFILE_CXXFLAGS',
58 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
59 'C_WARN', 'CC_WARN', 'CXX_WARN',
60 'LLIBS', 'PLATFORM_LINKFLAGS',
62 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC'
63 'WITH_BF_VERSE', 'BF_VERSE_INCLUDE',
64 'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO',
65 'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
69 'BF_FANCY', 'BF_QUIET',
76 arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
77 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
78 'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE',
79 'BF_BSC', 'BF_CONFIG',
80 'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
81 'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
84 all_list = opts_list + arg_list
87 for k,v in args.iteritems():
91 print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v
95 def print_targets(targs, bc):
98 print '\t'+bc.OKBLUE+t+bc.ENDC
100 print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC
102 def validate_targets(targs, bc):
103 valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
104 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
105 'everything', 'clean', 'install-bin', 'install', 'nsis']
111 print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
115 def ourspawn(self, sh, escape, cmd, args, env):
116 newargs = string.join(args[1:], ' ')
117 cmdline = cmd + " " + newargs
118 startupinfo = subprocess.STARTUPINFO()
119 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
120 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
121 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
122 data, err = proc.communicate()
130 def SetupSpawn( env ):
133 env['SPAWN'] = buf.ourspawn
136 def read_opts(cfg, args):
137 localopts = Variables.Variables(cfg, args)
138 localopts.AddVariables(
139 ('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
140 ('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
141 ('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
142 (BoolVariable('WITH_BF_VERSE', 'Use VERSE if true', False)),
143 ('BF_VERSE_INCLUDE', 'verse include dir', '/usr/include'),
144 ('LCGDIR', 'location of cvs lib dir'),
145 ('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
146 ('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
147 ('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
148 ('BF_DEBUG_LIBS', 'list of libraries to build with debug symbols'),
150 (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
151 ('BF_PYTHON', 'base path for python', ''),
152 ('BF_PYTHON_VERSION', 'Python version to use', ''),
153 ('BF_PYTHON_INC', 'include path for Python headers', ''),
154 ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''),
155 ('BF_PYTHON_LIB', 'Python library', ''),
156 ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''),
157 ('BF_PYTHON_LIBPATH', 'Library path', ''),
158 ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
159 (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
161 (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
162 (BoolVariable('WITH_BF_YAFRAY', 'Enable Yafray', True)),
164 (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
165 ('BF_OPENAL', 'base path for OpenAL', ''),
166 ('BF_OPENAL_INC', 'include path for python headers', ''),
167 ('BF_OPENAL_LIB', 'Path to OpenAL library', ''),
168 ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''),
169 ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
170 (BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
172 (BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
173 ('BF_SDL', 'SDL base path', ''),
174 ('BF_SDL_INC', 'SDL include path', ''), #$(shell $(BF_SDL)/bin/sdl-config --cflags)
175 ('BF_SDL_LIB', 'SDL library', ''), #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
176 ('BF_SDL_LIBPATH', 'SDL library path', ''),
178 ('BF_PTHREADS', 'Pthreads base path', ''),
179 ('BF_PTHREADS_INC', 'Pthreads include path', ''),
180 ('BF_PTHREADS_LIB', 'Pthreads library', ''),
181 ('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''),
183 (BoolVariable('WITH_BF_FMOD', 'Use FMOD if true', False)),
184 # BF_FMOD = $(LCGDIR)/fmod
186 (BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)),
187 (BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)),
188 ('BF_OPENEXR', 'OPENEXR base path', ''),
189 ('BF_OPENEXR_INC', 'OPENEXR include path', ''),
190 ('BF_OPENEXR_LIB', 'OPENEXR library', ''),
191 ('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''),
192 ('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''),
194 (BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)),
196 (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
197 ('BF_FFMPEG', 'FFMPEG base path', ''),
198 ('BF_FFMPEG_LIB', 'FFMPEG library', ''),
199 ('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''),
201 ('BF_FFMPEG_INC', 'FFMPEG includes', ''),
202 ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
204 (BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
206 ('BF_OGG', 'OGG base path', ''),
207 ('BF_OGG_LIB', 'OGG library', ''),
209 (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
210 ('BF_JPEG', 'JPEG base path', ''),
211 ('BF_JPEG_INC', 'JPEG include path', ''),
212 ('BF_JPEG_LIB', 'JPEG library', ''),
213 ('BF_JPEG_LIBPATH', 'JPEG library path', ''),
215 (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
216 ('BF_OPENJPEG', 'OPENJPEG base path', ''),
217 ('BF_OPENJPEG_INC', 'OPENJPEG include path', ''),
218 ('BF_OPENJPEG_LIB', 'OPENJPEG library', ''),
219 ('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''),
221 (BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)),
222 ('BF_REDCODE', 'REDCODE base path', ''),
223 ('BF_REDCODE_INC', 'REDCODE include path', ''),
224 ('BF_REDCODE_LIB', 'REDCODE library', ''),
225 ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
227 (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
228 ('BF_PNG', 'PNG base path', ''),
229 ('BF_PNG_INC', 'PNG include path', ''),
230 ('BF_PNG_LIB', 'PNG library', ''),
231 ('BF_PNG_LIBPATH', 'PNG library path', ''),
233 ('BF_TIFF', 'TIFF base path', ''),
234 ('BF_TIFF_INC', 'TIFF include path', ''),
236 (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
237 ('BF_ZLIB', 'ZLib base path', ''),
238 ('BF_ZLIB_INC', 'ZLib include path', ''),
239 ('BF_ZLIB_LIB', 'ZLib library', ''),
240 ('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
242 (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext and Freetype if true', True)),
244 ('BF_GETTEXT', 'gettext base path', ''),
245 ('BF_GETTEXT_INC', 'gettext include path', ''),
246 ('BF_GETTEXT_LIB', 'gettext library', ''),
247 ('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
249 (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
250 ('BF_ICONV', 'iconv base path', ''),
251 ('BF_ICONV_INC', 'iconv include path', ''),
252 ('BF_ICONV_LIB', 'iconv library', ''),
253 ('BF_ICONV_LIBPATH', 'iconv library path', ''),
255 (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , True)),
257 (BoolVariable('WITH_BF_ODE', 'Use ODE if true', True)),
258 ('BF_ODE', 'ODE base path', ''),
259 ('BF_ODE_INC', 'ODE include path' , ''),
260 ('BF_ODE_LIB', 'ODE library', ''),
262 (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
263 ('BF_BULLET', 'Bullet base dir', ''),
264 ('BF_BULLET_INC', 'Bullet include path', ''),
265 ('BF_BULLET_LIB', 'Bullet library', ''),
267 ('BF_SOLID', 'Solid base dir', '#/extern/solid'),
268 ('BF_SOLID_INC', 'Solid include path', ''),
269 ('BF_WINTAB', 'WinTab base dir', ''),
270 ('BF_WINTAB_INC', 'WinTab include dir', ''),
271 ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
272 (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
273 ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
275 ##WITH_BF_NSPR = True
276 ##BF_NSPR = $(LCGDIR)/nspr
277 ##BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
279 ### Uncomment the following line to use Mozilla inplace of netscape
280 ##CPPFLAGS += -DMOZ_NOT_NET
281 ### Location of MOZILLA/Netscape header files...
282 ##BF_MOZILLA = $(LCGDIR)/mozilla
283 ##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
285 ### Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
286 ### if this is not set.
288 ### Be paranoid regarding library creation (do not update archives)
291 ### enable freetype2 support for text objects
292 (BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', False)),
293 ('BF_FREETYPE', 'Freetype base path', ''),
294 ('BF_FREETYPE_INC', 'Freetype include path', ''),
295 ('BF_FREETYPE_LIB', 'Freetype library', ''),
296 ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
298 (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
300 (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
301 ('BF_QUICKTIME', 'QuickTime base path', ''),
302 ('BF_QUICKTIME_INC', 'QuickTime include path', ''),
303 ('BF_QUICKTIME_LIB', 'QuickTime library', ''),
304 ('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
306 (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
307 ('BF_OPENGL', 'OpenGL base path', ''),
308 ('BF_OPENGL_INC', 'OpenGL include path', ''),
309 ('BF_OPENGL_LIB', 'OpenGL libraries', ''),
310 ('BF_OPENGL_LIBPATH', 'OpenGL library path', ''),
311 ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
312 ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
314 (BoolVariable('WITH_BF_FTGL', 'Use FTGL if true', True)),
315 ('BF_FTGL', 'FTGL base path', ''),
316 ('BF_FTGL_INC', 'FTGL include path', ''),
317 ('BF_FTGL_LIB', 'FTGL libraries', ''),
319 (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
320 (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
322 ('CFLAGS', 'C only flags', ''),
323 ('CCFLAGS', 'Generic C and C++ flags', ''),
324 ('CXXFLAGS', 'C++ only flags', ''),
325 ('CPPFLAGS', 'Defines', ''),
326 ('REL_CFLAGS', 'C only release flags', ''),
327 ('REL_CCFLAGS', 'Generic C and C++ release flags', ''),
328 ('REL_CXXFLAGS', 'C++ only release flags', ''),
330 ('C_WARN', 'C warning flags', ''),
331 ('CC_WARN', 'Generic C and C++ warning flags', ''),
332 ('CXX_WARN', 'C++ only warning flags', ''),
334 ('LLIBS', 'Platform libs', ''),
335 ('PLATFORM_LINKFLAGS', 'Platform linkflags', ''),
337 (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
338 ('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
339 ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
340 ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
342 (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
343 ('BF_DEBUG_CFLAGS', 'C only debug flags', ''),
344 ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
345 ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
347 (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
349 ('BF_BUILDDIR', 'Build dir', ''),
350 ('BF_INSTALLDIR', 'Installation dir', ''),
351 ('BF_DOCDIR', 'Dir where BPy documentation will be created', ''),
353 ('CC', 'C compiler to use', ''),
354 ('CXX', 'C++ compiler to use', ''),
356 (BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)),
358 (BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)),
359 (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
360 (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
361 (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
362 (BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
363 (BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
365 ('BF_X264_CONFIG', 'configuration flags for x264', ''),
366 ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
367 (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
369 ('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
370 ('BF_NUMJOBS', 'Number of build processes to spawn', '1')
372 ) # end of opts.AddOptions()
376 def NSIS_print(target, source, env):
377 return "Creating NSIS installer for Blender 3D"
379 def NSIS_Installer(target=None, source=None, env=None):
381 if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
382 print "NSIS installer is only available on Windows."
385 start_dir = os.getcwd()
386 rel_dir = start_dir + "\\release\\windows\\installer\\"
387 install_base_dir = start_dir + "\\"
389 if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
390 os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
392 for f in glob.glob('source/blender/blenpluginapi/*.h'):
393 shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
395 shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
399 version = v.read()[:-1]
400 shortver = version.split('.')[0] + version.split('.')[1]
403 #### change to suit install dir ####
404 inst_dir = install_base_dir + env['BF_INSTALLDIR']
406 os.chdir("windows/installer")
408 ns = open("00.sconsblender.nsi","r")
410 ns_cnt = str(ns.read())
415 rootdir = os.listdir(inst_dir+"\\")
416 for rootitem in rootdir:
417 if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
418 rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
419 rootstring = string.join(rootlist, "\n ")
421 ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
425 for rootitem in rootdir:
426 if os.path.isdir(inst_dir + rootitem) == 0:
427 delrootlist.append("Delete $INSTDIR\\" + rootitem)
428 delrootstring = string.join(delrootlist, "\n ")
429 delrootstring += "\n"
430 ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
434 scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
435 scriptdir = os.listdir(scriptpath)
436 for scriptitem in scriptdir:
437 scriptfile = "%s\\%s" % (scriptpath, scriptitem)
438 if os.path.isdir(scriptfile) == 0:
439 scriptfile = os.path.normpath(scriptfile)
440 scriptlist.append("File \"%s\"" % scriptfile)
441 scriptstring = string.join(scriptlist, "\n ")
442 scriptstring += "\n\n"
443 ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
445 # do scripts\bpymodules
447 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
448 bpymoddir = os.listdir(bpymodpath)
450 for bpymoditem in bpymoddir:
451 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
452 if os.path.isdir(bpymodfile) == 0:
453 bpymodfile = os.path.normpath(bpymodfile)
454 bpymodlist.append("File \"%s\"" % bpymodfile)
455 bpymodstring = string.join(bpymodlist, "\n ")
456 bpymodstring += "\n\n"
457 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
459 # do scripts\bpymodules\colladaimex
461 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
462 bpymoddir = os.listdir(bpymodpath)
464 for bpymoditem in bpymoddir:
465 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
466 if os.path.isdir(bpymodfile) == 0:
467 bpymodfile=os.path.normpath(bpymodfile)
468 colladalist.append("File \"%s\"" % bpymodfile)
469 bpymodstring = string.join(colladalist, "\n ")
470 bpymodstring += "\n\n"
471 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
475 bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
476 bpydatadir = os.listdir(bpydatapath)
477 for bpydataitem in bpydatadir:
478 bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
479 if os.path.isdir(bpydatafile) == 0:
480 bpydatalist.append("File \"%s\"" % bpydatafile)
481 bpydatastring = string.join(bpydatalist, "\n ")
482 bpydatastring += "\n\n"
483 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
487 plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
488 plugincludedir = os.listdir(plugincludepath)
489 for plugincludeitem in plugincludedir:
490 plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
491 if os.path.isdir(plugincludefile) == 0:
492 if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
493 plugincludefile = os.path.normpath(plugincludefile)
494 plugincludelist.append("File \"%s\"" % plugincludefile)
495 plugincludestring = string.join(plugincludelist, "\n ")
496 plugincludestring += "\n\n"
497 ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
499 # do scripts\bpydata\config
501 cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
502 cfgdir = os.listdir(cfgpath)
503 for cfgitem in cfgdir:
504 cfgfile = "%s\\%s" % (cfgpath, cfgitem)
505 if os.path.isdir(cfgfile) == 0:
506 cfglist.append("File \"%s\"" % cfgfile)
507 cfgstring = string.join(cfglist, "\n ")
509 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
513 dotblenddir = os.listdir(inst_dir+"\\.blender")
514 for dotblenditem in dotblenddir:
515 if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
516 dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
518 dotblendstring = string.join(dotblendlist, "\n ")
519 dotblendstring += "\n\n"
520 ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
525 langdir = os.listdir(inst_dir + "\\.blender\\locale")
526 for langitem in langdir:
527 if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
528 langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
529 langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
530 + langitem + "\\LC_MESSAGES\\blender.mo\"")
531 langstring = string.join(langfiles, "\n ")
533 ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
536 ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
537 ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
538 ns_cnt = string.replace(ns_cnt, "VERSION", version)
539 ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
541 tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
542 new_nsis = open(tmpnsi, 'w')
543 new_nsis.write(ns_cnt)
548 cmdline = "makensis " + "\""+tmpnsi+"\""
550 startupinfo = subprocess.STARTUPINFO()
551 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
552 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
553 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
554 data, err = proc.communicate()
559 print data.strip().split("\n")[-1]