=== SCons ===

* enable TWEAK_MODE with BF_TWEAK_MODE=1 on cmd-line. Can also be specified in user-config.py
This commit is contained in:
Nathan Letwory
2007-04-05 05:14:50 +00:00
parent d31355fa24
commit 581970a640
4 changed files with 159 additions and 152 deletions

View File

@@ -275,154 +275,154 @@ if not B.root_build_dir[-1]==os.sep:
def NSIS_Installer(): def NSIS_Installer():
if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw': if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
print "NSIS installer is only available on Windows." print "NSIS installer is only available on Windows."
Exit() Exit()
install_base_dir = os.getcwd() + "\\" 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") os.chdir("release")
v = open("VERSION")
ns = open("00.sconsblender.nsi","r") version = v.read()[:-1]
shortver = version.split('.')[0] + version.split('.')[1]
ns_cnt = str(ns.read()) v.close()
ns.close()
#### change to suit install dir ####
# do root inst_dir = install_base_dir + env['BF_INSTALLDIR']
rootlist = []
rootdir = os.listdir(inst_dir+"\\") os.chdir("windows/installer")
for rootitem in rootdir:
if os.path.isdir(inst_dir+"\\"+ rootitem) == 0: ns = open("00.sconsblender.nsi","r")
rootlist.append("File " + inst_dir + "\\" + rootitem)
rootstring = string.join(rootlist, "\n ") ns_cnt = str(ns.read())
rootstring += "\n\n" ns.close()
ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
# do root
# do delete items rootlist = []
delrootlist = [] rootdir = os.listdir(inst_dir+"\\")
for rootitem in rootdir: for rootitem in rootdir:
if os.path.isdir(inst_dir + rootitem) == 0: if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
delrootlist.append("Delete $INSTDIR\\" + rootitem) rootlist.append("File " + inst_dir + "\\" + rootitem)
delrootstring = string.join(delrootlist, "\n ") rootstring = string.join(rootlist, "\n ")
delrootstring += "\n" rootstring += "\n\n"
ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
# do scripts # do delete items
scriptlist = [] delrootlist = []
scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts") for rootitem in rootdir:
scriptdir = os.listdir(scriptpath) if os.path.isdir(inst_dir + rootitem) == 0:
for scriptitem in scriptdir: delrootlist.append("Delete $INSTDIR\\" + rootitem)
scriptfile = "%s\\%s" % (scriptpath, scriptitem) delrootstring = string.join(delrootlist, "\n ")
if os.path.isdir(scriptfile) == 0: delrootstring += "\n"
scriptlist.append("File %s" % scriptfile) ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
scriptstring = string.join(scriptlist, "\n ")
scriptstring += "\n\n" # do scripts
ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring) scriptlist = []
scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
# do scripts\bpymodules scriptdir = os.listdir(scriptpath)
bpymodlist = [] for scriptitem in scriptdir:
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules") scriptfile = "%s\\%s" % (scriptpath, scriptitem)
bpymoddir = os.listdir(bpymodpath) if os.path.isdir(scriptfile) == 0:
scriptlist.append("File %s" % scriptfile)
for bpymoditem in bpymoddir: scriptstring = string.join(scriptlist, "\n ")
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem) scriptstring += "\n\n"
if os.path.isdir(bpymodfile) == 0: ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
bpymodlist.append("File %s" % bpymodfile)
bpymodstring = string.join(bpymodlist, "\n ") # do scripts\bpymodules
bpymodstring += "\n\n" bpymodlist = []
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring) bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
bpymoddir = os.listdir(bpymodpath)
# do scripts\bpymodules\colladaimex
colladalist = [] for bpymoditem in bpymoddir:
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx") bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
bpymoddir = os.listdir(bpymodpath) if os.path.isdir(bpymodfile) == 0:
bpymodlist.append("File %s" % bpymodfile)
for bpymoditem in bpymoddir: bpymodstring = string.join(bpymodlist, "\n ")
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem) bpymodstring += "\n\n"
if os.path.isdir(bpymodfile) == 0: ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
colladalist.append("File %s" % bpymodfile)
bpymodstring = string.join(colladalist, "\n ") # do scripts\bpymodules\colladaimex
bpymodstring += "\n\n" colladalist = []
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring) bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
bpymoddir = os.listdir(bpymodpath)
# do scripts\bpydata
bpydatalist = [] for bpymoditem in bpymoddir:
bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata") bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
bpydatadir = os.listdir(bpydatapath) if os.path.isdir(bpymodfile) == 0:
for bpydataitem in bpydatadir: colladalist.append("File %s" % bpymodfile)
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem) bpymodstring = string.join(colladalist, "\n ")
if os.path.isdir(bpydatafile) == 0: bpymodstring += "\n\n"
bpydatalist.append("File %s" % bpydatafile) ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
bpydatastring = string.join(bpydatalist, "\n ")
bpydatastring += "\n\n" # do scripts\bpydata
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring) bpydatalist = []
bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
# do plugins\include bpydatadir = os.listdir(bpydatapath)
plugincludelist = [] for bpydataitem in bpydatadir:
plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include") bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
plugincludedir = os.listdir(plugincludepath) if os.path.isdir(bpydatafile) == 0:
for plugincludeitem in plugincludedir: bpydatalist.append("File %s" % bpydatafile)
plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem) bpydatastring = string.join(bpydatalist, "\n ")
if os.path.isdir(plugincludefile) == 0: bpydatastring += "\n\n"
if plugincludefile.find('.h') or plugincludefile.find('.DEF'): ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
plugincludelist.append("File %s" % plugincludefile)
plugincludestring = string.join(plugincludelist, "\n ") # do plugins\include
plugincludestring += "\n\n" plugincludelist = []
ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring) plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
plugincludedir = os.listdir(plugincludepath)
# do scripts\bpydata\config for plugincludeitem in plugincludedir:
cfglist = [] plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config") if os.path.isdir(plugincludefile) == 0:
cfgdir = os.listdir(cfgpath) if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
for cfgitem in cfgdir: plugincludelist.append("File %s" % plugincludefile)
cfgfile = "%s\\%s" % (cfgpath, cfgitem) plugincludestring = string.join(plugincludelist, "\n ")
if os.path.isdir(cfgfile) == 0: plugincludestring += "\n\n"
cfglist.append("File %s" % cfgfile) ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
cfgstring = string.join(cfglist, "\n ")
cfgstring += "\n\n" # do scripts\bpydata\config
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring) cfglist = []
cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
# do dotblender cfgdir = os.listdir(cfgpath)
dotblendlist = [] for cfgitem in cfgdir:
dotblenddir = os.listdir(inst_dir+"\\.blender") cfgfile = "%s\\%s" % (cfgpath, cfgitem)
for dotblenditem in dotblenddir: if os.path.isdir(cfgfile) == 0:
if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0: cfglist.append("File %s" % cfgfile)
dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem) cfgstring = string.join(cfglist, "\n ")
dotblendstring = string.join(dotblendlist, "\n ") cfgstring += "\n\n"
dotblendstring += "\n\n" ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
# do dotblender
# do language files dotblendlist = []
langlist = [] dotblenddir = os.listdir(inst_dir+"\\.blender")
langfiles = [] for dotblenditem in dotblenddir:
langdir = os.listdir(inst_dir + "\\.blender\\locale") if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
for langitem in langdir: dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem)
if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1: dotblendstring = string.join(dotblendlist, "\n ")
langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES") dotblendstring += "\n\n"
langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo") ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
langstring = string.join(langfiles, "\n ")
langstring += "\n\n" # do language files
ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring) langlist = []
langfiles = []
# var replacements langdir = os.listdir(inst_dir + "\\.blender\\locale")
ns_cnt = string.replace(ns_cnt, "DISTDIR", inst_dir+"\\") for langitem in langdir:
ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver) if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
ns_cnt = string.replace(ns_cnt, "VERSION", version) langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
new_nsis = open("00.blender_tmp.nsi", 'w') langstring = string.join(langfiles, "\n ")
new_nsis.write(ns_cnt) langstring += "\n\n"
new_nsis.close() ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w') # 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 nsis_build = None
if 'nsis' in B.targets: if 'nsis' in B.targets:
@@ -582,7 +582,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
'${LCGDIR}/zlib/lib/zlib.dll', '${LCGDIR}/zlib/lib/zlib.dll',
'${LCGDIR}/tiff/lib/libtiff.dll'] '${LCGDIR}/tiff/lib/libtiff.dll']
if env['BF_DEBUG']: if env['BF_DEBUG']:
dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}_d.dll') dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
else: else:
dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll') dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
if env['OURPLATFORM'] == 'win32-mingw': if env['OURPLATFORM'] == 'win32-mingw':

View File

@@ -9,7 +9,7 @@ maxobj = 30
numlibs = numobj / maxobj numlibs = numobj / maxobj
if (numobj % maxobj): if (numobj % maxobj):
numlibs = numlibs + 1 numlibs = numlibs + 1
subsources = [] subsources = []
if (env['OURPLATFORM'] == 'win32-mingw'): if (env['OURPLATFORM'] == 'win32-mingw'):
@@ -33,6 +33,9 @@ incs += ' ' + env['BF_OPENGL_INC']
defs = [] defs = []
if env['BF_TWEAK_MODE'] == 1:
defs.append('TWEAK_MODE')
if env['WITH_BF_YAFRAY'] == 0: if env['WITH_BF_YAFRAY'] == 0:
defs.append('DISABLE_YAFRAY') defs.append('DISABLE_YAFRAY')

View File

@@ -142,7 +142,7 @@ def setup_syslibs(lenv):
lenv['BF_PNG_LIB'], lenv['BF_PNG_LIB'],
lenv['BF_ZLIB_LIB'] lenv['BF_ZLIB_LIB']
] ]
if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): if lenv['BF_DEBUG']==1 and lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
syslibs.append(lenv['BF_PYTHON_LIB']+'_d') syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
else: else:
syslibs.append(lenv['BF_PYTHON_LIB']) syslibs.append(lenv['BF_PYTHON_LIB'])

View File

@@ -44,7 +44,9 @@ def validate_arguments(args, bc):
'C_WARN', 'CC_WARN', 'LLIBS', 'PLATFORM_LINKFLAGS', 'C_WARN', 'CC_WARN', 'LLIBS', 'PLATFORM_LINKFLAGS',
'BF_PROFILE_FLAGS', 'LCGDIR', 'WITH_BF_VERSE', 'BF_PROFILE_FLAGS', 'LCGDIR', 'WITH_BF_VERSE',
'BF_VERSE_INCLUDE', 'BF_VERSE_INCLUDE',
'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO'] 'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO',
'BF_TWEAK_MODE'
]
arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE', arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME', 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
@@ -287,7 +289,9 @@ def read_opts(cfg, args):
('CC', 'C compiler to use', ''), ('CC', 'C compiler to use', ''),
('CXX', 'C++ compiler to use', ''), ('CXX', 'C++ compiler to use', ''),
(BoolOption('BF_BUILDINFO', 'Buildtime in splash if true', 'true')) (BoolOption('BF_BUILDINFO', 'Buildtime in splash if true', 'true')),
(BoolOption('BF_TWEAK_MODE', 'Enable tweak mode if true', 'false')),
) # end of opts.AddOptions() ) # end of opts.AddOptions()