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',
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',
55 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
56 'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
60 'BF_FANCY', 'BF_QUIET',
63 'WITH_BF_LCMS', 'BF_LCMS_LIB',
68 # Have options here that scons expects to be lists
70 'BF_PYTHON_LINKFLAGS',
71 'BF_OPENGL_LINKFLAGS',
72 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
73 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
74 'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS',
75 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
76 'C_WARN', 'CC_WARN', 'CXX_WARN',
77 'LLIBS', 'PLATFORM_LINKFLAGS',
81 arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
82 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
83 'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE',
84 'BF_BSC', 'BF_CONFIG',
85 'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
86 'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
91 for k,v in args.iteritems():
92 if (k in opts_list) or (k in arg_list):
94 elif k in opts_list_split:
95 okdict[k] = v.split() # "" have alredy been stripped
97 print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v
101 def print_targets(targs, bc):
104 print '\t'+bc.OKBLUE+t+bc.ENDC
106 print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC
108 def validate_targets(targs, bc):
109 valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
110 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
111 'everything', 'clean', 'install-bin', 'install', 'nsis']
117 print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
121 def ourspawn(self, sh, escape, cmd, args, env):
122 newargs = string.join(args[1:], ' ')
123 cmdline = cmd + " " + newargs
124 startupinfo = subprocess.STARTUPINFO()
125 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
126 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
127 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
128 data, err = proc.communicate()
136 def SetupSpawn( env ):
139 env['SPAWN'] = buf.ourspawn
142 def read_opts(cfg, args):
143 localopts = Variables.Variables(cfg, args)
144 localopts.AddVariables(
145 ('LCGDIR', 'location of cvs lib dir'),
146 (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
147 ('BF_PYTHON', 'base path for python', ''),
148 ('BF_PYTHON_VERSION', 'Python version to use', ''),
149 ('BF_PYTHON_INC', 'include path for Python headers', ''),
150 ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''),
151 ('BF_PYTHON_LIB', 'Python library', ''),
152 ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''),
153 ('BF_PYTHON_LIBPATH', 'Library path', ''),
154 ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
155 (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
157 (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
159 (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
160 ('BF_OPENAL', 'base path for OpenAL', ''),
161 ('BF_OPENAL_INC', 'include path for python headers', ''),
162 ('BF_OPENAL_LIB', 'Path to OpenAL library', ''),
163 ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''),
164 ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
165 (BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
167 (BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
168 ('BF_SDL', 'SDL base path', ''),
169 ('BF_SDL_INC', 'SDL include path', ''), #$(shell $(BF_SDL)/bin/sdl-config --cflags)
170 ('BF_SDL_LIB', 'SDL library', ''), #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
171 ('BF_SDL_LIBPATH', 'SDL library path', ''),
173 ('BF_PTHREADS', 'Pthreads base path', ''),
174 ('BF_PTHREADS_INC', 'Pthreads include path', ''),
175 ('BF_PTHREADS_LIB', 'Pthreads library', ''),
176 ('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''),
178 (BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)),
179 (BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)),
180 ('BF_OPENEXR', 'OPENEXR base path', ''),
181 ('BF_OPENEXR_INC', 'OPENEXR include path', ''),
182 ('BF_OPENEXR_LIB', 'OPENEXR library', ''),
183 ('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''),
184 ('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''),
186 (BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)),
188 (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
189 ('BF_FFMPEG', 'FFMPEG base path', ''),
190 ('BF_FFMPEG_LIB', 'FFMPEG library', ''),
191 ('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''),
193 ('BF_FFMPEG_INC', 'FFMPEG includes', ''),
194 ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
196 (BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
198 ('BF_OGG', 'OGG base path', ''),
199 ('BF_OGG_LIB', 'OGG library', ''),
201 (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
202 ('BF_JPEG', 'JPEG base path', ''),
203 ('BF_JPEG_INC', 'JPEG include path', ''),
204 ('BF_JPEG_LIB', 'JPEG library', ''),
205 ('BF_JPEG_LIBPATH', 'JPEG library path', ''),
207 (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
208 ('BF_OPENJPEG', 'OPENJPEG base path', ''),
209 ('BF_OPENJPEG_INC', 'OPENJPEG include path', ''),
210 ('BF_OPENJPEG_LIB', 'OPENJPEG library', ''),
211 ('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''),
213 (BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)),
214 ('BF_REDCODE', 'REDCODE base path', ''),
215 ('BF_REDCODE_INC', 'REDCODE include path', ''),
216 ('BF_REDCODE_LIB', 'REDCODE library', ''),
217 ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
219 (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
220 ('BF_PNG', 'PNG base path', ''),
221 ('BF_PNG_INC', 'PNG include path', ''),
222 ('BF_PNG_LIB', 'PNG library', ''),
223 ('BF_PNG_LIBPATH', 'PNG library path', ''),
225 ('BF_TIFF', 'TIFF base path', ''),
226 ('BF_TIFF_INC', 'TIFF include path', ''),
227 ('BF_TIFF_LIB', 'TIFF library', ''),
228 ('BF_TIFF_LIBPATH', 'TIFF library path', ''),
230 (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
231 ('BF_ZLIB', 'ZLib base path', ''),
232 ('BF_ZLIB_INC', 'ZLib include path', ''),
233 ('BF_ZLIB_LIB', 'ZLib library', ''),
234 ('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
236 (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext if true', True)),
238 ('BF_GETTEXT', 'gettext base path', ''),
239 ('BF_GETTEXT_INC', 'gettext include path', ''),
240 ('BF_GETTEXT_LIB', 'gettext library', ''),
241 ('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
243 (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
244 ('BF_ICONV', 'iconv base path', ''),
245 ('BF_ICONV_INC', 'iconv include path', ''),
246 ('BF_ICONV_LIB', 'iconv library', ''),
247 ('BF_ICONV_LIBPATH', 'iconv library path', ''),
249 (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , True)),
251 (BoolVariable('WITH_BF_ODE', 'Use ODE if true', True)),
252 ('BF_ODE', 'ODE base path', ''),
253 ('BF_ODE_INC', 'ODE include path' , ''),
254 ('BF_ODE_LIB', 'ODE library', ''),
256 (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
257 ('BF_BULLET', 'Bullet base dir', ''),
258 ('BF_BULLET_INC', 'Bullet include path', ''),
259 ('BF_BULLET_LIB', 'Bullet library', ''),
261 (BoolVariable('WITH_BF_SOLID', 'Use Sumo/Solid deprecated physics system if true', True)),
262 ('BF_SOLID', 'Solid base dir', '#/extern/solid'),
263 ('BF_SOLID_INC', 'Solid include path', ''),
264 ('BF_WINTAB', 'WinTab base dir', ''),
265 ('BF_WINTAB_INC', 'WinTab include dir', ''),
266 ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
267 (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
268 ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
270 ##WITH_BF_NSPR = True
271 ##BF_NSPR = $(LCGDIR)/nspr
272 ##BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
274 ### Uncomment the following line to use Mozilla inplace of netscape
275 ##CPPFLAGS += -DMOZ_NOT_NET
276 ### Location of MOZILLA/Netscape header files...
277 ##BF_MOZILLA = $(LCGDIR)/mozilla
278 ##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
280 ### Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
281 ### if this is not set.
283 ### Be paranoid regarding library creation (do not update archives)
286 ### enable freetype2 support for text objects
287 (BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', True)),
288 ('BF_FREETYPE', 'Freetype base path', ''),
289 ('BF_FREETYPE_INC', 'Freetype include path', ''),
290 ('BF_FREETYPE_LIB', 'Freetype library', ''),
291 ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
293 (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
295 (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
296 ('BF_QUICKTIME', 'QuickTime base path', ''),
297 ('BF_QUICKTIME_INC', 'QuickTime include path', ''),
298 ('BF_QUICKTIME_LIB', 'QuickTime library', ''),
299 ('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
301 (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
302 ('BF_OPENGL', 'OpenGL base path', ''),
303 ('BF_OPENGL_INC', 'OpenGL include path', ''),
304 ('BF_OPENGL_LIB', 'OpenGL libraries', ''),
305 ('BF_OPENGL_LIBPATH', 'OpenGL library path', ''),
306 ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
307 ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
309 (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
310 (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
312 ('CFLAGS', 'C only flags', ''),
313 ('CCFLAGS', 'Generic C and C++ flags', ''),
314 ('CXXFLAGS', 'C++ only flags', ''),
315 ('CPPFLAGS', 'Defines', ''),
316 ('REL_CFLAGS', 'C only release flags', ''),
317 ('REL_CCFLAGS', 'Generic C and C++ release flags', ''),
318 ('REL_CXXFLAGS', 'C++ only release flags', ''),
320 ('C_WARN', 'C warning flags', ''),
321 ('CC_WARN', 'Generic C and C++ warning flags', ''),
322 ('CXX_WARN', 'C++ only warning flags', ''),
324 ('LLIBS', 'Platform libs', ''),
325 ('PLATFORM_LINKFLAGS', 'Platform linkflags', ''),
327 (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
328 ('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
329 ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
330 ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
331 ('BF_PROFILE_LINKFLAGS', 'Profile linkflags', ''),
333 (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
334 ('BF_DEBUG_CFLAGS', 'C only debug flags', ''),
335 ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
336 ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
338 (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
340 ('BF_BUILDDIR', 'Build dir', ''),
341 ('BF_INSTALLDIR', 'Installation dir', ''),
342 ('BF_DOCDIR', 'Dir where BPy documentation will be created', ''),
344 ('CC', 'C compiler to use', ''),
345 ('CXX', 'C++ compiler to use', ''),
347 (BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)),
349 (BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)),
350 (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
351 (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
352 (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
353 (BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
354 (BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
356 (BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)),
357 ('BF_LCMS_LIB', 'LCMSlibrary', 'lcms'),
359 ('BF_X264_CONFIG', 'configuration flags for x264', ''),
360 ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
361 (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
363 ('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
364 ('BF_NUMJOBS', 'Number of build processes to spawn', '1')
366 ) # end of opts.AddOptions()
370 def NSIS_print(target, source, env):
371 return "Creating NSIS installer for Blender 3D"
373 def NSIS_Installer(target=None, source=None, env=None):
375 if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
376 print "NSIS installer is only available on Windows."
379 start_dir = os.getcwd()
380 rel_dir = start_dir + "\\release\\windows\\installer\\"
381 install_base_dir = start_dir + "\\"
383 if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
384 os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
386 for f in glob.glob('source/blender/blenpluginapi/*.h'):
387 shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
389 shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
393 version = v.read()[:-1]
394 shortver = version.split('.')[0] + version.split('.')[1]
397 #### change to suit install dir ####
398 inst_dir = install_base_dir + env['BF_INSTALLDIR']
400 os.chdir("windows/installer")
402 ns = open("00.sconsblender.nsi","r")
404 ns_cnt = str(ns.read())
409 rootdir = os.listdir(inst_dir+"\\")
410 for rootitem in rootdir:
411 if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
412 rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
413 rootstring = string.join(rootlist, "\n ")
415 ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
419 for rootitem in rootdir:
420 if os.path.isdir(inst_dir + rootitem) == 0:
421 delrootlist.append("Delete $INSTDIR\\" + rootitem)
422 delrootstring = string.join(delrootlist, "\n ")
423 delrootstring += "\n"
424 ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
428 scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
429 scriptdir = os.listdir(scriptpath)
430 for scriptitem in scriptdir:
431 scriptfile = "%s\\%s" % (scriptpath, scriptitem)
432 if os.path.isdir(scriptfile) == 0:
433 scriptfile = os.path.normpath(scriptfile)
434 scriptlist.append("File \"%s\"" % scriptfile)
435 scriptstring = string.join(scriptlist, "\n ")
436 scriptstring += "\n\n"
437 ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
439 # do scripts\bpymodules
441 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
442 bpymoddir = os.listdir(bpymodpath)
444 for bpymoditem in bpymoddir:
445 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
446 if os.path.isdir(bpymodfile) == 0:
447 bpymodfile = os.path.normpath(bpymodfile)
448 bpymodlist.append("File \"%s\"" % bpymodfile)
449 bpymodstring = string.join(bpymodlist, "\n ")
450 bpymodstring += "\n\n"
451 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
453 # do scripts\bpymodules\colladaimex
455 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
456 bpymoddir = os.listdir(bpymodpath)
458 for bpymoditem in bpymoddir:
459 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
460 if os.path.isdir(bpymodfile) == 0:
461 bpymodfile=os.path.normpath(bpymodfile)
462 colladalist.append("File \"%s\"" % bpymodfile)
463 bpymodstring = string.join(colladalist, "\n ")
464 bpymodstring += "\n\n"
465 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
469 bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
470 bpydatadir = os.listdir(bpydatapath)
471 for bpydataitem in bpydatadir:
472 bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
473 if os.path.isdir(bpydatafile) == 0:
474 bpydatalist.append("File \"%s\"" % bpydatafile)
475 bpydatastring = string.join(bpydatalist, "\n ")
476 bpydatastring += "\n\n"
477 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
481 plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
482 plugincludedir = os.listdir(plugincludepath)
483 for plugincludeitem in plugincludedir:
484 plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
485 if os.path.isdir(plugincludefile) == 0:
486 if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
487 plugincludefile = os.path.normpath(plugincludefile)
488 plugincludelist.append("File \"%s\"" % plugincludefile)
489 plugincludestring = string.join(plugincludelist, "\n ")
490 plugincludestring += "\n\n"
491 ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
493 # do scripts\bpydata\config
495 cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
496 cfgdir = os.listdir(cfgpath)
497 for cfgitem in cfgdir:
498 cfgfile = "%s\\%s" % (cfgpath, cfgitem)
499 if os.path.isdir(cfgfile) == 0:
500 cfglist.append("File \"%s\"" % cfgfile)
501 cfgstring = string.join(cfglist, "\n ")
503 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
507 dotblenddir = os.listdir(inst_dir+"\\.blender")
508 for dotblenditem in dotblenddir:
509 if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
510 dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
512 dotblendstring = string.join(dotblendlist, "\n ")
513 dotblendstring += "\n\n"
514 ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
519 langdir = os.listdir(inst_dir + "\\.blender\\locale")
520 for langitem in langdir:
521 if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
522 langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
523 langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
524 + langitem + "\\LC_MESSAGES\\blender.mo\"")
525 langstring = string.join(langfiles, "\n ")
527 ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
530 ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
531 ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
532 ns_cnt = string.replace(ns_cnt, "VERSION", version)
533 ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
535 tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
536 new_nsis = open(tmpnsi, 'w')
537 new_nsis.write(ns_cnt)
539 print "Preparing nsis file looks ok\n"
542 print "try to launch 'makensis' ...make sure it is on the path \n"
544 cmdline = "makensis " + "\""+tmpnsi+"\""
546 startupinfo = subprocess.STARTUPINFO()
547 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
548 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
549 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
550 data, err = proc.communicate()
555 print data.strip().split("\n")[-1]