Diego Borghetti 2007-06-19 14:21:48 +00:00
parent 31d60b2c8f
commit c8042cc5ce
8 changed files with 277 additions and 278 deletions

View File

@ -71,6 +71,11 @@ if platform=='win32':
if not use_color=='1':
B.bc.disable()
#on defaut white Os X terminal, some colors are totally unlegible
if platform=='darwin':
B.bc.OKGREEN = '\033[34m'
B.bc.WARNING = '\033[36m'
# arguments
print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
@ -110,6 +115,8 @@ if toolset:
env.Tool('mstoolkit', ['tools'])
else:
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
if env:
btools.SetupSpawn(env)
else:
env = BlenderEnvironment(ENV = os.environ)
@ -117,7 +124,7 @@ if not env:
print "Could not create a build environment"
Exit()
env.SConscriptChdir(0)
cc = B.arguments.get('CC', None)
cxx = B.arguments.get('CXX', None)
if cc:
@ -130,53 +137,7 @@ if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
elif env['CC'] in ['gcc'] and sys.platform=='win32':
platform = 'win32-mingw'
# Fix me!
#if platform == 'win32-mingw':
if 0:
try:
import win32file
import win32event
import win32process
import win32security
import string
slash= re.compile(r"\\")
def myesc(b):
if b[0]!= "-":
b = slash.sub(r"\\\\", b[1:-1])
return "\"" + b + "\""
else:
return b
def my_spawn(sh, escape, cmd, args, spawnenv):
for var in spawnenv:
spawnenv[var] = spawnenv[var].encode('ascii', 'replace')
sAttrs = win32security.SECURITY_ATTRIBUTES()
StartupInfo = win32process.STARTUPINFO()
if cmd=='ar' and args[1]=='r':
args[1] = '-r'
newargs = string.join(map(myesc, args[1:]), ' ')
cmdline = cmd + " " + newargs
# check for any special operating system commands
if cmd == 'del':
for arg in args[1:]:
win32file.DeleteFile(arg)
exit_code = 0
else:
# otherwise execute the command.
hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)
win32event.WaitForSingleObject(hProcess, win32event.INFINITE)
exit_code = win32process.GetExitCodeProcess(hProcess)
win32file.CloseHandle(hProcess);
win32file.CloseHandle(hThread);
return exit_code
env['SPAWN'] = my_spawn
except:
print "install win32all from http://sourceforge.net/project/showfiles.php?group_id=78018"
env.SConscriptChdir(0)
crossbuild = B.arguments.get('BF_CROSS', None)
if crossbuild and platform!='win32':
@ -273,162 +234,6 @@ env['BUILDDIR'] = B.root_build_dir
if not B.root_build_dir[-1]==os.sep:
B.root_build_dir += os.sep
def NSIS_Installer():
if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
print "NSIS installer is only available on Windows."
Exit()
install_base_dir = os.getcwd() + "\\"
os.chdir("release")
v = open("VERSION")
version = v.read()[:-1]
shortver = version.split('.')[0] + version.split('.')[1]
v.close()
#### change to suit install dir ####
inst_dir = install_base_dir + env['BF_INSTALLDIR']
os.chdir("windows/installer")
ns = open("00.sconsblender.nsi","r")
ns_cnt = str(ns.read())
ns.close()
# do root
rootlist = []
rootdir = os.listdir(inst_dir+"\\")
for rootitem in rootdir:
if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
rootlist.append("File " + inst_dir + "\\" + rootitem)
rootstring = string.join(rootlist, "\n ")
rootstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
# do delete items
delrootlist = []
for rootitem in rootdir:
if os.path.isdir(inst_dir + rootitem) == 0:
delrootlist.append("Delete $INSTDIR\\" + rootitem)
delrootstring = string.join(delrootlist, "\n ")
delrootstring += "\n"
ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
# do scripts
scriptlist = []
scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
scriptdir = os.listdir(scriptpath)
for scriptitem in scriptdir:
scriptfile = "%s\\%s" % (scriptpath, scriptitem)
if os.path.isdir(scriptfile) == 0:
scriptlist.append("File %s" % scriptfile)
scriptstring = string.join(scriptlist, "\n ")
scriptstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
# do scripts\bpymodules
bpymodlist = []
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
bpymoddir = os.listdir(bpymodpath)
for bpymoditem in bpymoddir:
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
if os.path.isdir(bpymodfile) == 0:
bpymodlist.append("File %s" % bpymodfile)
bpymodstring = string.join(bpymodlist, "\n ")
bpymodstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
# do scripts\bpymodules\colladaimex
colladalist = []
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
bpymoddir = os.listdir(bpymodpath)
for bpymoditem in bpymoddir:
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
if os.path.isdir(bpymodfile) == 0:
colladalist.append("File %s" % bpymodfile)
bpymodstring = string.join(colladalist, "\n ")
bpymodstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
# do scripts\bpydata
bpydatalist = []
bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
bpydatadir = os.listdir(bpydatapath)
for bpydataitem in bpydatadir:
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
if os.path.isdir(bpydatafile) == 0:
bpydatalist.append("File %s" % bpydatafile)
bpydatastring = string.join(bpydatalist, "\n ")
bpydatastring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
# do plugins\include
plugincludelist = []
plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
plugincludedir = os.listdir(plugincludepath)
for plugincludeitem in plugincludedir:
plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
if os.path.isdir(plugincludefile) == 0:
if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
plugincludelist.append("File %s" % plugincludefile)
plugincludestring = string.join(plugincludelist, "\n ")
plugincludestring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
# do scripts\bpydata\config
cfglist = []
cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
cfgdir = os.listdir(cfgpath)
for cfgitem in cfgdir:
cfgfile = "%s\\%s" % (cfgpath, cfgitem)
if os.path.isdir(cfgfile) == 0:
cfglist.append("File %s" % cfgfile)
cfgstring = string.join(cfglist, "\n ")
cfgstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
# do dotblender
dotblendlist = []
dotblenddir = os.listdir(inst_dir+"\\.blender")
for dotblenditem in dotblenddir:
if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem)
dotblendstring = string.join(dotblendlist, "\n ")
dotblendstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
# do language files
langlist = []
langfiles = []
langdir = os.listdir(inst_dir + "\\.blender\\locale")
for langitem in langdir:
if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
langstring = string.join(langfiles, "\n ")
langstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
# var replacements
ns_cnt = string.replace(ns_cnt, "DISTDIR", inst_dir+"\\")
ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
ns_cnt = string.replace(ns_cnt, "VERSION", version)
new_nsis = open("00.blender_tmp.nsi", 'w')
new_nsis.write(ns_cnt)
new_nsis.close()
sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
nsis_build = None
if 'nsis' in B.targets:
NSIS_Installer()
Exit()
# We do a shortcut for clean when no quicklist is given: just delete
# builddir without reading in SConscripts
do_clean = None
@ -471,8 +276,6 @@ B.init_lib_dict()
##### END SETUP ##########
Export('env')
#Export('root_build_dir') # this one is still needed for makesdna
##TODO: improve makesdna usage
BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
SConscript(B.root_build_dir+'/intern/SConscript')
@ -586,8 +389,8 @@ allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, t
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
'${LCGDIR}/png/lib/libpng.dll',
# '#release/windows/extra/python24.zip',
# '#release/windows/extra/zlib.pyd',
'#release/windows/extra/python25.zip',
'#release/windows/extra/zlib.pyd',
'${LCGDIR}/sdl/lib/SDL.dll',
'${LCGDIR}/zlib/lib/zlib.dll',
'${LCGDIR}/tiff/lib/libtiff.dll']
@ -611,6 +414,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
installtarget = env.Alias('install', allinstall)
bininstalltarget = env.Alias('install-bin', blenderinstall)
nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
nsiscmd = env.Command('nsisinstaller', None, nsisaction)
nsisalias = env.Alias('nsis', nsiscmd)
if env['WITH_BF_PLAYER']:
blenderplayer = env.Alias('blenderplayer', B.program_list)
Depends(blenderplayer,installtarget)
@ -619,6 +426,8 @@ if not env['WITH_BF_GAMEENGINE']:
blendernogame = env.Alias('blendernogame', B.program_list)
Depends(blendernogame,installtarget)
Depends(nsiscmd, allinstall)
Default(B.program_list)
Default(installtarget)

View File

@ -1,11 +1,26 @@
LCGDIR = '#../lib/darwin-6.1-powerpc'
LIBDIR = '${LCGDIR}'
WITH_BF_VERSE = 'false'
BF_VERSE_INCLUDE = "#extern/verse/dist"
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
WITH_BF_VERSE = 'false'
BF_VERSE = "#extern/verse/dist"
BF_VERSE_LIBPATH = "${BF_BUILDDIR}/extern/verse/dist"
BF_VERSE_INCLUDE = BF_VERSE
BF_VERSE_LIBS = "libverse"
# python.org libs install in /library
BF_PYTHON_VERSION = '2.3'
if BF_PYTHON_VERSION=='2.3':
BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
else:
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
BF_PYTHON_VERSION = '2.5'
BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = ''
@ -13,7 +28,12 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERS
BF_PYTHON_LINKFLAGS = '-u __dummy -u _PyMac_Error -framework System -framework Python'
WITH_BF_OPENAL = 'true'
BF_OPENAL = LIBDIR + '/openal'
#different lib must be used following version of gcc
# for gcc 3.3
#BF_OPENAL = LIBDIR + '/openal'
# for gcc 3.4
BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
@ -30,7 +50,7 @@ BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
BF_OPENEXR = '/usr/local'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
WITH_BF_JPEG = 'true'
@ -65,8 +85,8 @@ BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_PLAYER='false'
WITH_BF_GAMEENGINE='true'
WITH_BF_PLAYER='true'
WITH_BF_ODE = 'false'
BF_ODE = LIBDIR + '/ode'
@ -129,9 +149,9 @@ BF_OPENGL_LINKFLAGS = '-framework OpenGL'
CFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CPPFLAGS = []
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CPPFLAGS = ['-fpascal-strings']
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-fpascal-strings']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-fpascal-strings']
PLATFORM_LINKFLAGS = '-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime'
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']

View File

@ -145,7 +145,7 @@ CXX = 'cl.exe'
CCFLAGS = ['/nologo', '/Og', '/Ot', '/Ob1', '/Op', '/G6','/EHsc', '/J', '/W3', '/Gd', '/MT']
BF_DEBUG_FLAGS = ['/Zi', '/FR${TARGET.base}.sbr']
BF_DEBUG_FLAGS = ['/Zi', '/FR${TARGET}.sbr']
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DUSE_OPENAL', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
REL_CFLAGS = ['-O2', '-DNDEBUG']

View File

@ -1,6 +1,6 @@
$Id$
Note: The current official release of SCons is 0.96.1
Note: The current official release of SCons is 0.97
Blenders SCons build scripts
============================
@ -29,7 +29,7 @@ $Id$
To build Blender with the SCons scripts you need a full Python
install, version 2.4 or later (http://www.python.org) and a SCons
installation, version v0.96.1 (http://www.scons.org).
installation, version v0.97 (http://www.scons.org).
Check from the page
http://www.blender.org/development/building-blender/getting-dependencies/

View File

@ -8,17 +8,19 @@
!include "FileFunc.nsh"
!include "WordFunc.nsh"
SetCompressor /SOLID lzma
Name "Blender VERSION"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Blender.\r\n\r\nIt is recommended that you close all other applications before starting Setup.\r\n\r\nNote to Win2k/XP users: You may require administrator privileges to install Blender successfully."
!define MUI_WELCOMEFINISHPAGE_BITMAP "01.installer.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "RELDIR\01.installer.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "00.header.bmp"
!define MUI_HEADERIMAGE_BITMAP "RELDIR\00.header.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_RUN "$INSTDIR\blender.exe"
!define MUI_CHECKBITMAP "00.checked.bmp"
!define MUI_CHECKBITMAP "RELDIR\00.checked.bmp"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "DISTDIR\Copyright.txt"
@ -38,8 +40,8 @@ Page custom DataLocation
!insertmacro VersionCompare
Icon "00.installer.ico"
UninstallIcon "00.installer.ico"
Icon "RELDIR\00.installer.ico"
UninstallIcon "RELDIR\00.installer.ico"
;--------------------------------
;Languages
@ -60,7 +62,6 @@ UninstallIcon "00.installer.ico"
Caption "Blender VERSION Installer"
OutFile "DISTDIR\..\blender-VERSION-windows.exe"
InstallDir "$PROGRAMFILES\Blender Foundation\Blender"
BrandingText "http://www.blender.org/bf"
@ -208,7 +209,7 @@ Function .onInit
Call GetWindowsVersion
Pop $R0
Strcpy $winversion $R0
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "data.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "RELDIR\data.ini"
FunctionEnd
!define DLL_VER "8.00.50727.42"

View File

@ -4,18 +4,6 @@ Import ('env')
# TODO: src_env.Append (CCFLAGS = user_options_dict['SDL_CFLAGS'])
sources = env.Glob('*.c')
numobj = len(sources)
maxobj = 30
numlibs = numobj / maxobj
if (numobj % maxobj):
numlibs = numlibs + 1
subsources = []
if (env['OURPLATFORM'] == 'win32-mingw'):
for i in range(numlibs - 1):
subsources.append(sources[i*maxobj:(i+1)*maxobj])
subsources.append(sources[(numlibs-1)*maxobj:])
incs = ' #/intern/guardedalloc #/intern/memutil'
incs += ' ../blenlib ../makesdna ../blenkernel'
@ -67,8 +55,4 @@ if env['WITH_BF_VERSE']:
if env['BF_BUILDINFO'] == 1:
defs.append('NAN_BUILDINFO')
if (env['OURPLATFORM'] == 'win32-mingw'):
for i in range(numlibs):
env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
else:
env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )

View File

@ -5,8 +5,9 @@ sources = env.Glob('*.cpp')
incs = '. #source/kernel/gen_system #intern/string #intern/moto/include'
cflags = []
if env['OURPLATFORM']=='win32-vc':
cflags.append('/Ox')
env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['game','player'], priority=[35,115], compileflags = cflags )
cflags = []
cflags.append('/Ox')
env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['game','player'], priority=[35,115], compileflags = cflags )
else:
env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['game','player'], priority=[35,115] )

View File

@ -1,7 +1,15 @@
import sys
import StringIO
import os
import os.path
import SCons.Options
import SCons.Options.BoolOption
try:
import subprocess
except ImportError:
pass
import string
import glob
import shutil
import sys
Options = SCons.Options
BoolOption = SCons.Options.BoolOption
@ -84,33 +92,26 @@ def validate_targets(targs, bc):
print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
return oklist
class ourSpawn:
def ourspawn(self, sh, escape, cmd, args, env):
newargs = string.join(args[1:], ' ')
cmdline = cmd + " " + newargs
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
data, err = proc.communicate()
rv = proc.wait()
if rv:
print "====="
print err
print "====="
return rv
class idBuffering:
def buffered_spawn( self, sh, escape, cmd, args, env ):
stderr = StringIO.StringIO()
stdout = StringIO.StringIO()
command_string = ''
for i in args:
if ( len( command_string ) ):
command_string += ' '
command_string += i
try:
retval = self.env['PSPAWN']( sh, escape, cmd, args, env, stdout, stderr )
except OSError, x:
if x.errno != 10:
raise x
print 'OSError ignored on command: %s' % command_string
retval = 0
sys.stdout.write( stdout.getvalue() )
sys.stderr.write( stderr.getvalue() )
return retval
# get a clean error output when running multiple jobs
def SetupBufferedOutput( env ):
buf = idBuffering()
buf.env = env
env['SPAWN'] = buf.buffered_spawn
def SetupSpawn( env ):
buf = ourSpawn()
buf.ourenv = env
env['SPAWN'] = buf.ourspawn
def read_opts(cfg, args):
@ -297,3 +298,186 @@ def read_opts(cfg, args):
return localopts
def NSIS_print(target, source, env):
return "Creating NSIS installer for Blender 3D"
def NSIS_Installer(target=None, source=None, env=None):
if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
print "NSIS installer is only available on Windows."
Exit()
start_dir = os.getcwd()
rel_dir = start_dir + "\\release\\windows\\installer\\"
install_base_dir = start_dir + "\\"
if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
for f in glob.glob('source/blender/blenpluginapi/*.h'):
shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
os.chdir("release")
v = open("VERSION")
version = v.read()[:-1]
shortver = version.split('.')[0] + version.split('.')[1]
v.close()
#### change to suit install dir ####
inst_dir = install_base_dir + env['BF_INSTALLDIR']
os.chdir("windows/installer")
ns = open("00.sconsblender.nsi","r")
ns_cnt = str(ns.read())
ns.close()
# do root
rootlist = []
rootdir = os.listdir(inst_dir+"\\")
for rootitem in rootdir:
if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
rootstring = string.join(rootlist, "\n ")
rootstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
# do delete items
delrootlist = []
for rootitem in rootdir:
if os.path.isdir(inst_dir + rootitem) == 0:
delrootlist.append("Delete $INSTDIR\\" + rootitem)
delrootstring = string.join(delrootlist, "\n ")
delrootstring += "\n"
ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
# do scripts
scriptlist = []
scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
scriptdir = os.listdir(scriptpath)
for scriptitem in scriptdir:
scriptfile = "%s\\%s" % (scriptpath, scriptitem)
if os.path.isdir(scriptfile) == 0:
scriptfile = os.path.normpath(scriptfile)
scriptlist.append("File \"%s\"" % scriptfile)
scriptstring = string.join(scriptlist, "\n ")
scriptstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
# do scripts\bpymodules
bpymodlist = []
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
bpymoddir = os.listdir(bpymodpath)
for bpymoditem in bpymoddir:
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
if os.path.isdir(bpymodfile) == 0:
bpymodfile = os.path.normpath(bpymodfile)
bpymodlist.append("File \"%s\"" % bpymodfile)
bpymodstring = string.join(bpymodlist, "\n ")
bpymodstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
# do scripts\bpymodules\colladaimex
colladalist = []
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
bpymoddir = os.listdir(bpymodpath)
for bpymoditem in bpymoddir:
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
if os.path.isdir(bpymodfile) == 0:
bpymodfile=os.path.normpath(bpymodfile)
colladalist.append("File \"%s\"" % bpymodfile)
bpymodstring = string.join(colladalist, "\n ")
bpymodstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
# do scripts\bpydata
bpydatalist = []
bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
bpydatadir = os.listdir(bpydatapath)
for bpydataitem in bpydatadir:
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
if os.path.isdir(bpydatafile) == 0:
bpydatalist.append("File \"%s\"" % bpydatafile)
bpydatastring = string.join(bpydatalist, "\n ")
bpydatastring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
# do plugins\include
plugincludelist = []
plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
plugincludedir = os.listdir(plugincludepath)
for plugincludeitem in plugincludedir:
plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
if os.path.isdir(plugincludefile) == 0:
if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
plugincludefile = os.path.normpath(plugincludefile)
plugincludelist.append("File \"%s\"" % plugincludefile)
plugincludestring = string.join(plugincludelist, "\n ")
plugincludestring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
# do scripts\bpydata\config
cfglist = []
cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
cfgdir = os.listdir(cfgpath)
for cfgitem in cfgdir:
cfgfile = "%s\\%s" % (cfgpath, cfgitem)
if os.path.isdir(cfgfile) == 0:
cfglist.append("File \"%s\"" % cfgfile)
cfgstring = string.join(cfglist, "\n ")
cfgstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
# do dotblender
dotblendlist = []
dotblenddir = os.listdir(inst_dir+"\\.blender")
for dotblenditem in dotblenddir:
if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
dotblenditem+"\"")
dotblendstring = string.join(dotblendlist, "\n ")
dotblendstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
# do language files
langlist = []
langfiles = []
langdir = os.listdir(inst_dir + "\\.blender\\locale")
for langitem in langdir:
if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
+ langitem + "\\LC_MESSAGES\\blender.mo\"")
langstring = string.join(langfiles, "\n ")
langstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
# var replacements
ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
ns_cnt = string.replace(ns_cnt, "VERSION", version)
ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
new_nsis = open(tmpnsi, 'w')
new_nsis.write(ns_cnt)
new_nsis.close()
os.chdir(start_dir)
cmdline = "makensis " + "\""+tmpnsi+"\""
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
data, err = proc.communicate()
rv = proc.wait()
return 0