diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-12 22:26:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-12 22:26:35 +0400 |
commit | d80d6e28127dcfb83b11d88c993595f846ffbb02 (patch) | |
tree | c147380634b0214cbaf47a1f778403563fc930ca /tools | |
parent | 3b81c67353b9b0b9539fe7befbba0d7e449e912b (diff) |
re-arrange build files so scons "config" dir isnt confused with ~/.blender/2.52/config
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Blender.py | 792 | ||||
-rw-r--r-- | tools/__init__.py | 0 | ||||
-rw-r--r-- | tools/bcolors.py | 16 | ||||
-rw-r--r-- | tools/btools.py | 566 | ||||
-rw-r--r-- | tools/crossmingw.py | 184 | ||||
-rw-r--r-- | tools/mstoolkit.py | 353 |
6 files changed, 0 insertions, 1911 deletions
diff --git a/tools/Blender.py b/tools/Blender.py deleted file mode 100644 index 1195b00b39d..00000000000 --- a/tools/Blender.py +++ /dev/null @@ -1,792 +0,0 @@ -#!/usr/bin/env python - -""" -tools.BlenderEnvironment - -This environment builds on SCons.Script.SConscript.SConsEnvironment - -* library repository -* custom printout -* wrapper functions - -TODO: clean up and sanitise code - crosscheck with btools and SConstruct -to kill any code duplication - -""" - -import os -import os.path -import string -import glob -import time -import sys -import zipfile -import shutil -import cStringIO - -from SCons.Script.SConscript import SConsEnvironment -import SCons.Action -import SCons.Util -import SCons.Builder -import SCons.Tool -import bcolors -bc = bcolors.bcolors() -import btools -VERSION = btools.VERSION - -Split = SCons.Util.Split -Action = SCons.Action.Action -Builder = SCons.Builder.Builder -GetBuildPath = SConsEnvironment.GetBuildPath - -# a few globals -root_build_dir = '' -doc_build_dir = '' -quickie = None # Anything else than None if BF_QUICK has been passed -quicklist = [] # The list of libraries/programs to compile during a quickie -program_list = [] # A list holding Nodes to final binaries, used to create installs -arguments = None -targets = None -resources = [] - -#some internals -blenderdeps = [] # don't manipulate this one outside this module! - -##### LIB STUFF ########## - -possible_types = ['core'] # can be set in ie. SConstruct -libs = {} -vcp = [] - -def getresources(): - return resources - -def init_lib_dict(): - for pt in possible_types: - libs[pt] = {} - -# helper func for add_lib_to_dict -def internal_lib_to_dict(dict = None, libtype = None, libname = None, priority = 100): - if not libname in dict[libtype]: - done = None - while not done: - if dict[libtype].has_key(priority): - priority = priority + 1 - else: - done = True - dict[libtype][priority] = libname - -# libtype and priority can both be lists, for defining lib in multiple places -def add_lib_to_dict(env, dict = None, libtype = None, libname = None, priority = 100): - if not dict or not libtype or not libname: - print "Passed wrong arg" - env.Exit() - - if type(libtype) is str and type(priority) is int: - internal_lib_to_dict(dict, libtype, libname, priority) - elif type(libtype) is list and type(priority) is list: - if len(libtype)==len(priority): - for lt, p in zip(libtype, priority): - internal_lib_to_dict(dict, lt, libname, p) - else: - print "libtype and priority lists are unequal in length" - env.Exit() - else: - print "Wrong type combinations for libtype and priority. Only str and int or list and list" - env.Exit() - -def create_blender_liblist(lenv = None, libtype = None): - if not lenv or not libtype: - print "missing arg" - - lst = [] - if libtype in possible_types: - curlib = libs[libtype] - sortlist = curlib.keys() - sortlist.sort() - for sk in sortlist: - v = curlib[sk] - if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): - target = os.path.abspath(os.getcwd() + os.sep + root_build_dir + 'lib' + os.sep +lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']) - else: - target = os.path.abspath(root_build_dir + 'lib' + os.sep +lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']) - lst.append(target) - - return lst - -## TODO: static linking -def setup_staticlibs(lenv): - statlibs = [ - #here libs for static linking - ] - - libincs = [] - - if lenv['WITH_BF_FFMPEG']: - libincs += Split(lenv['BF_FFMPEG_LIBPATH']) - - libincs.extend([ - lenv['BF_OPENGL_LIBPATH'], - lenv['BF_JPEG_LIBPATH'], - lenv['BF_PNG_LIBPATH'], - lenv['BF_ZLIB_LIBPATH'], - lenv['BF_LIBSAMPLERATE_LIBPATH'], - lenv['BF_ICONV_LIBPATH'] - ]) - - libincs += Split(lenv['BF_FREETYPE_LIBPATH']) - if lenv['WITH_BF_PYTHON']: - libincs += Split(lenv['BF_PYTHON_LIBPATH']) - if lenv['WITH_BF_SDL']: - libincs += Split(lenv['BF_SDL_LIBPATH']) - if lenv['WITH_BF_JACK']: - libincs += Split(lenv['BF_JACK_LIBPATH']) - if lenv['WITH_BF_SNDFILE']: - libincs += Split(lenv['BF_SNDFILE_LIBPATH']) - if lenv['WITH_BF_OPENEXR']: - libincs += Split(lenv['BF_OPENEXR_LIBPATH']) - if lenv['WITH_BF_STATICOPENEXR']: - statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC']) - if lenv['WITH_BF_LCMS']: - libincs += Split(lenv['BF_LCMS_LIBPATH']) - if lenv['WITH_BF_TIFF']: - libincs += Split(lenv['BF_TIFF_LIBPATH']) - if lenv['WITH_BF_FFTW3']: - libincs += Split(lenv['BF_FFTW3_LIBPATH']) - if lenv['WITH_BF_INTERNATIONAL']: - libincs += Split(lenv['BF_GETTEXT_LIBPATH']) - if lenv['WITH_BF_OPENAL']: - libincs += Split(lenv['BF_OPENAL_LIBPATH']) - if lenv['WITH_BF_STATICOPENAL']: - statlibs += Split(lenv['BF_OPENAL_LIB_STATIC']) - if lenv['WITH_BF_STATICOPENGL']: - statlibs += Split(lenv['BF_OPENGL_LIB_STATIC']) - if lenv['WITH_BF_STATICCXX']: - statlibs += Split(lenv['BF_CXX_LIB_STATIC']) - - if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']: - statlibs += Split(lenv['BF_PYTHON_LIB_STATIC']) - - if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): - libincs += Split(lenv['BF_PTHREADS_LIBPATH']) - - if lenv['WITH_BF_COLLADA']: - libincs += Split(lenv['BF_OPENCOLLADA_LIBPATH']) - if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): - libincs += Split(lenv['BF_PCRE_LIBPATH']) - libincs += Split(lenv['BF_EXPAT_LIBPATH']) - - if lenv['WITH_BF_OPENMP']: - if lenv['OURPLATFORM'] == 'linuxcross': - libincs += Split(lenv['BF_OPENMP_LIBPATH']) - - # setting this last so any overriding of manually libs could be handled - if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): - libincs.append('/usr/lib') - - return statlibs, libincs - -def setup_syslibs(lenv): - syslibs = [ - - lenv['BF_JPEG_LIB'], - lenv['BF_PNG_LIB'], - lenv['BF_ZLIB_LIB'], - lenv['BF_LIBSAMPLERATE_LIB'] - ] - - syslibs += Split(lenv['BF_FREETYPE_LIB']) - if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']: - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): - syslibs.append(lenv['BF_PYTHON_LIB']+'_d') - else: - syslibs.append(lenv['BF_PYTHON_LIB']) - if lenv['WITH_BF_INTERNATIONAL']: - syslibs += Split(lenv['BF_GETTEXT_LIB']) - if lenv['WITH_BF_OPENAL']: - if not lenv['WITH_BF_STATICOPENAL']: - syslibs += Split(lenv['BF_OPENAL_LIB']) - if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc': - if lenv['CC'] == 'cl.exe': - syslibs += ['vcomp'] - else: - syslibs += ['gomp'] - if lenv['WITH_BF_ICONV']: - syslibs += Split(lenv['BF_ICONV_LIB']) - if lenv['WITH_BF_OPENEXR']: - if not lenv['WITH_BF_STATICOPENEXR']: - syslibs += Split(lenv['BF_OPENEXR_LIB']) - if lenv['WITH_BF_TIFF']: - syslibs += Split(lenv['BF_TIFF_LIB']) - if lenv['WITH_BF_FFMPEG']: - syslibs += Split(lenv['BF_FFMPEG_LIB']) - if lenv['WITH_BF_OGG']: - syslibs += Split(lenv['BF_OGG_LIB']) - if lenv['WITH_BF_JACK']: - syslibs += Split(lenv['BF_JACK_LIB']) - if lenv['WITH_BF_SNDFILE']: - syslibs += Split(lenv['BF_SNDFILE_LIB']) - if lenv['WITH_BF_FFTW3']: - syslibs += Split(lenv['BF_FFTW3_LIB']) - if lenv['WITH_BF_SDL']: - syslibs += Split(lenv['BF_SDL_LIB']) - if not lenv['WITH_BF_STATICOPENGL']: - syslibs += Split(lenv['BF_OPENGL_LIB']) - if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'): - syslibs += Split(lenv['BF_PTHREADS_LIB']) - if lenv['WITH_BF_LCMS']: - syslibs.append(lenv['BF_LCMS_LIB']) - if lenv['WITH_BF_COLLADA']: - syslibs.append(lenv['BF_PCRE_LIB']) - syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) - syslibs.append(lenv['BF_EXPAT_LIB']) - - - syslibs += lenv['LLIBS'] - - return syslibs - -def propose_priorities(): - print bc.OKBLUE+"Priorities:"+bc.ENDC - for t in possible_types: - print bc.OKGREEN+"\t"+t+bc.ENDC - new_priority = 0 - curlib = libs[t] - sortlist = curlib.keys() - sortlist.sort() - - for sk in sortlist: - v = curlib[sk] - #for p,v in sorted(libs[t].iteritems()): - print "\t\t",new_priority, v - new_priority += 5 - -## TODO: see if this can be made in an emitter -def buildinfo(lenv, build_type): - """ - Generate a buildinfo object - """ - build_date = time.strftime ("%Y-%m-%d") - build_time = time.strftime ("%H:%M:%S") - build_rev = os.popen('svnversion').read()[:-1] # remove \n - - obj = [] - if lenv['BF_BUILDINFO']: - lenv.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time), - 'BUILD_DATE=\'"%s"\''%(build_date), - 'BUILD_TYPE=\'"dynamic"\'', - 'BUILD_REV=\'"%s"\''%(build_rev), - 'NAN_BUILDINFO', - 'BUILD_PLATFORM=\'"%s"\''%(sys.platform)]) - obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type, - [root_build_dir+'source/creator/buildinfo.c'])] - return obj - -##### END LIB STUFF ############ - -##### ACTION STUFF ############# - -def my_print_cmd_line(self, s, target, source, env): - sys.stdout.write(' ' * 70 + '\r') - sys.stdout.flush() - sys.stdout.write(s + "\r") - sys.stdout.flush() - -def my_compile_print(target, source, env): - a = '%s' % (source[0]) - d, f = os.path.split(a) - return bc.OKBLUE+"Compiling"+bc.ENDC +" ==> '"+bc.OKGREEN+"%s" % (f) + "'"+bc.ENDC - -def my_moc_print(target, source, env): - a = '%s' % (source[0]) - d, f = os.path.split(a) - return bc.OKBLUE+"Creating MOC"+bc.ENDC+ " ==> '"+bc.OKGREEN+"%s" %(f) + "'"+bc.ENDC - -def my_linking_print(target, source, env): - t = '%s' % (target[0]) - d, f = os.path.split(t) - return bc.OKBLUE+"Linking library"+bc.ENDC +" ==> '"+bc.OKGREEN+"%s" % (f) + "'"+bc.ENDC - -def my_program_print(target, source, env): - t = '%s' % (target[0]) - d, f = os.path.split(t) - return bc.OKBLUE+"Linking program"+bc.ENDC +" ==> '"+bc.OKGREEN+"%s" % (f) + "'"+bc.ENDC - -def msvc_hack(env): - static_lib = SCons.Tool.createStaticLibBuilder(env) - program = SCons.Tool.createProgBuilder(env) - - env['BUILDERS']['Library'] = static_lib - env['BUILDERS']['StaticLibrary'] = static_lib - env['BUILDERS']['Program'] = program - -def set_quiet_output(env): - mycaction = Action("$CCCOM", strfunction=my_compile_print) - myshcaction = Action("$SHCCCOM", strfunction=my_compile_print) - mycppaction = Action("$CXXCOM", strfunction=my_compile_print) - myshcppaction = Action("$SHCXXCOM", strfunction=my_compile_print) - mylibaction = Action("$ARCOM", strfunction=my_linking_print) - mylinkaction = Action("$LINKCOM", strfunction=my_program_print) - - static_ob, shared_ob = SCons.Tool.createObjBuilders(env) - static_ob.add_action('.c', mycaction) - static_ob.add_action('.cpp', mycppaction) - shared_ob.add_action('.c', myshcaction) - shared_ob.add_action('.cpp', myshcppaction) - - static_lib = SCons.Builder.Builder(action = mylibaction, - emitter = '$LIBEMITTER', - prefix = '$LIBPREFIX', - suffix = '$LIBSUFFIX', - src_suffix = '$OBJSUFFIX', - src_builder = 'StaticObject') - - program = SCons.Builder.Builder(action = mylinkaction, - emitter = '$PROGEMITTER', - prefix = '$PROGPREFIX', - suffix = '$PROGSUFFIX', - src_suffix = '$OBJSUFFIX', - src_builder = 'Object', - target_scanner = SCons.Defaults.ProgScan) - - env['BUILDERS']['Object'] = static_ob - env['BUILDERS']['StaticObject'] = static_ob - env['BUILDERS']['StaticLibrary'] = static_lib - env['BUILDERS']['Library'] = static_lib - env['BUILDERS']['Program'] = program - if env['BF_LINE_OVERWRITE']: - SCons.Action._ActionAction.print_cmd_line = my_print_cmd_line - - -class CompZipFile(zipfile.ZipFile): - """Partial copy of python2.6's zipfile.ZipFile (see http://www.python.org) - to get a extractall() that works on py2.5 and probably earlier distributions.""" - def __init__(self, file, mode="r", compression=zipfile.ZIP_STORED, allowZip64=False): - if sys.version_info < (2, 6): - zipfile.ZipFile.__init__(self, file, mode, compression) - else: - zipfile.ZipFile.__init__(self, file, mode, compression, allowZip64) - - if not hasattr(self,"extractall"): # use our method - print "Debug: Using comp_extractall!" - self.extractall= self.comp_extractall - - def comp_extractall(self, path=None, members=None, pwd=None): #renamed method - """Extract all members from the archive to the current working - directory. `path' specifies a different directory to extract to. - `members' is optional and must be a subset of the list returned - by namelist(). - """ - if members is None: - members = self.namelist() - - for zipinfo in members: - self.comp_extract(zipinfo, path, pwd) # use our method - - def comp_extract(self, member, path=None, pwd=None): #renamed method - """Extract a member from the archive to the current working directory, - using its full name. Its file information is extracted as accurately - as possible. `member' may be a filename or a ZipInfo object. You can - specify a different directory using `path'. - """ - if not isinstance(member, zipfile.ZipInfo): - member = self.getinfo(member) - - if path is None: - path = os.getcwd() - - return self.comp_extract_member(member, path, pwd) # use our method - - def comp_extract_member(self, member, targetpath, pwd): #renamed method - """Extract the ZipInfo object 'member' to a physical - file on the path targetpath. - """ - # build the destination pathname, replacing - # forward slashes to platform specific separators. - if targetpath[-1:] in (os.path.sep, os.path.altsep): - targetpath = targetpath[:-1] - - # don't include leading "/" from file name if present - if member.filename[0] == '/': - targetpath = os.path.join(targetpath, member.filename[1:]) - else: - targetpath = os.path.join(targetpath, member.filename) - - targetpath = os.path.normpath(targetpath) - - # Create all upper directories if necessary. - upperdirs = os.path.dirname(targetpath) - if upperdirs and not os.path.exists(upperdirs): - os.makedirs(upperdirs) - - if member.filename[-1] == '/': - os.mkdir(targetpath) - return targetpath - - #use StrinIO instead so we don't have to reproduce more functionality. - source = cStringIO.StringIO(self.read(member.filename)) - target = file(targetpath, "wb") - shutil.copyfileobj(source, target) - source.close() - target.close() - - return targetpath - -def unzip_pybundle(from_zip,to_dir,exclude_re): - - zip= CompZipFile(from_zip, mode='r') - exclude_re= list(exclude_re) #single re object or list of re objects - debug= 0 #list files instead of unpacking - good= [] - if debug: print '\nFiles not being unpacked:\n' - for name in zip.namelist(): - is_bad= 0 - for r in exclude_re: - if r.match(name): - is_bad=1 - if debug: print name - break - if not is_bad: - good.append(name) - if debug: - print '\nFiles being unpacked:\n' - for g in good: - print g - else: - zip.extractall(to_dir, good) - -def my_winpybundle_print(target, source, env): - pass - -def WinPyBundle(target=None, source=None, env=None): - import re - py_zip= env.subst( env['LCGDIR'] ) - if py_zip[0]=='#': - py_zip= py_zip[1:] - py_zip+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '.zip' - - py_target = env.subst( env['BF_INSTALLDIR'] ) - if py_target[0]=='#': - py_target=py_target[1:] - py_target = os.path.join(py_target, VERSION, 'python', 'lib') - def printexception(func,path,ex): - if os.path.exists(path): #do not report if path does not exist. eg on a fresh build. - print str(func) + ' failed on ' + str(path) - print "Trying to remove existing py bundle." - shutil.rmtree(py_target, False, printexception) - exclude_re=[re.compile('.*/test/.*'), - re.compile('^config/.*'), - re.compile('^distutils/.*'), - re.compile('^idlelib/.*'), - re.compile('^lib2to3/.*'), - re.compile('^tkinter/.*')] - print "Unpacking '" + py_zip + "' to '" + py_target + "'" - unzip_pybundle(py_zip,py_target,exclude_re) - -def my_appit_print(target, source, env): - a = '%s' % (target[0]) - d, f = os.path.split(a) - return "making bundle for " + f - -def AppIt(target=None, source=None, env=None): - import shutil - import commands - import os.path - - - a = '%s' % (target[0]) - builddir, b = os.path.split(a) - libdir = env['LCGDIR'][1:] - osxarch = env['MACOSX_ARCHITECTURE'] - print("compiled architecture: %s"%(osxarch)) - if libdir == '../lib/darwin-9.x.universal': - python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip - else: - python_zip = 'python.zip' # compatibility for darwin8 python.zip - print("unzipping to app-bundle: %s"%(python_zip)) - bldroot = env.Dir('.').abspath - binary = env['BINARYKIND'] - - if b=='verse': - print bc.OKBLUE+"no bundle for verse"+bc.ENDC - return 0 - - sourcedir = bldroot + '/source/darwin/%s.app'%binary - sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary - targetinfo = builddir +'/' + "%s.app/Contents/Info.plist"%binary - cmd = builddir + '/' +'%s.app'%binary - - if os.path.isdir(cmd): - shutil.rmtree(cmd) - shutil.copytree(sourcedir, cmd) - cmd = "cat %s | sed s/VERSION/`cat release/VERSION`/ | sed s/DATE/`date +'%%Y-%%b-%%d'`/ > %s"%(sourceinfo,targetinfo) - commands.getoutput(cmd) - cmd = 'cp %s/%s %s/%s.app/Contents/MacOS/%s'%(builddir, binary,builddir, binary, binary) - commands.getoutput(cmd) - cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/'%(builddir, binary, VERSION) -# print cmd - commands.getoutput(cmd) - cmd = builddir + '/%s.app/Contents/MacOS/%s'%(binary,VERSION) - shutil.copy(bldroot + '/bin/.blender/.bfont.ttf', cmd) - shutil.copy(bldroot + '/bin/.blender/.Blanguages', cmd) - cmd = 'cp -R %s/bin/%s/locale %s/%s.app/Contents/Resources/'%(bldroot,VERSION,builddir,binary) - commands.getoutput(cmd) - cmd = 'cp -R %s/bin/%s/locale %s/%s.app/Contents/MacOS/%s/'%(bldroot,VERSION,builddir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp %s/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,builddir,binary) - commands.getoutput(cmd) - cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(builddir,binary, VERSION) - commands.getoutput(cmd) - cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,builddir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,builddir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/ui %s/%s.app/Contents/MacOS/%s/'%(bldroot,builddir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/io %s/%s.app/Contents/MacOS/%s/'%(bldroot,builddir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'chmod +x %s/%s.app/Contents/MacOS/%s'%(builddir,binary, binary) - commands.getoutput(cmd) - cmd = 'find %s/%s.app -name .svn -prune -exec rm -rf {} \;'%(builddir, binary) - commands.getoutput(cmd) - cmd = 'find %s/%s.app -name .DS_Store -exec rm -rf {} \;'%(builddir, binary) - commands.getoutput(cmd) - cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(builddir, binary) - commands.getoutput(cmd) - -# extract copy system python, be sure to update other build systems -# when making changes to the files that are copied. -def my_unixpybundle_print(target, source, env): - pass - -def UnixPyBundle(target=None, source=None, env=None): - # Any Unix except osx - #-- VERSION/python/lib/python3.1 - - import commands - - def run(cmd): - print 'Install command:', cmd - commands.getoutput(cmd) - - if env['WITH_BF_FHS']: dir = os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION']) # BLENDERPATH - else: dir = os.path.join(env['BF_INSTALLDIR'], VERSION) - - py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] ) - py_target = env.subst( dir + '/python/lib/python'+env['BF_PYTHON_VERSION'] ) - - # This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow. - if os.path.exists(py_target): - print 'Using existing python from:' - print '\t"%s"' % py_target - print '\t(skipping copy)\n' - return - - - # Copied from source/creator/CMakeLists.txt, keep in sync. - print 'Install python from:' - print '\t"%s" into...' % py_src - print '\t"%s"\n' % py_target - - run('rm -rf "%s"' % py_target) - try: os.makedirs(os.path.dirname(py_target)) # the final part is copied - except:pass - - run('cp -R "%s" "%s"' % (py_src, os.path.dirname(py_target))) - run('rm -rf "%s/distutils"' % py_target) - run('rm -rf "%s/lib2to3"' % py_target) - run('rm -rf "%s/idlelib"' % py_target) - run('rm -rf "%s/tkinter"' % py_target) - run('rm -rf "%s/config"' % py_target) - - run('rm -rf "%s/site-packages"' % py_target) - run('mkdir "%s/site-packages"' % py_target) # python needs it.' - - run('rm -f "%s/lib-dynload/_tkinter.so"' % py_target) - run('find "%s" -name "test" -prune -exec rm -rf {} \;' % py_target) - run('find "%s" -name "*.py?" -exec rm -rf {} \;' % py_target) - run('find "%s" -name "*.so"-exec strip -s {} \;' % py_target) - -#### END ACTION STUFF ######### - -def bsc(env, target, source): - - bd = os.path.dirname(target[0].abspath) - bscfile = '\"'+target[0].abspath+'\"' - bscpathcollect = '\"'+bd + os.sep + '*.sbr\"' - bscpathtmp = '\"'+bd + os.sep + 'bscmake.tmp\"' - - os.system('dir /b/s '+bscpathcollect+' >'+bscpathtmp) - - myfile = open(bscpathtmp[1:-1], 'r') - lines = myfile.readlines() - myfile.close() - - newfile = open(bscpathtmp[1:-1], 'w') - for l in lines: - newfile.write('\"'+l[:-1]+'\"\n') - newfile.close() - - os.system('bscmake /nologo /n /o'+bscfile+' @'+bscpathtmp) - os.system('del '+bscpathtmp) - -class BlenderEnvironment(SConsEnvironment): - - def BlenderRes(self=None, libname=None, source=None, libtype=['core'], priority=[100]): - global libs - if not self or not libname or not source: - print bc.FAIL+'Cannot continue. Missing argument for BlenderRes '+libname+bc.ENDC - self.Exit() - if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc'): - print bc.FAIL+'BlenderRes is for windows only!'+bc.END - self.Exit() - - print bc.HEADER+'Configuring resource '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC - lenv = self.Clone() - if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): - res = lenv.RES('#'+root_build_dir+'lib/'+libname, source) - else: - res = lenv.RES(root_build_dir+'lib/'+libname, source) - - - SConsEnvironment.Default(self, res) - resources.append(res) - - def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None): - global vcp - if not self or not libname or not sources: - print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC - self.Exit() - - def list_substring(quickie, libname): - for q in quickie: - if libname.find(q) != -1: - return True - return False - - if list_substring(quickie, libname) or len(quickie)==0: - if list_substring(quickdebug, libname): - print bc.HEADER+'Configuring library '+bc.ENDC+bc.OKGREEN+libname +bc.ENDC+bc.OKBLUE+ " (debug mode)" + bc.ENDC - else: - print bc.HEADER+'Configuring library '+bc.ENDC+bc.OKGREEN+libname + bc.ENDC - lenv = self.Clone() - lenv.Append(CPPPATH=includes) - lenv.Append(CPPDEFINES=defines) - if lenv['BF_DEBUG'] or (libname in quickdebug): - lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS']) - lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS']) - else: - lenv.Append(CFLAGS = lenv['REL_CFLAGS']) - lenv.Append(CCFLAGS = lenv['REL_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS']) - if lenv['BF_PROFILE']: - lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS']) - lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS']) - if compileflags: - lenv.Replace(CFLAGS = compileflags) - if cc_compileflags: - lenv.Replace(CCFLAGS = cc_compileflags) - if cxx_compileflags: - lenv.Replace(CXXFLAGS = cxx_compileflags) - lenv.Append(CFLAGS = lenv['C_WARN']) - lenv.Append(CCFLAGS = lenv['CC_WARN']) - lenv.Append(CXXFLAGS = lenv['CXX_WARN']) - - if lenv['OURPLATFORM'] == 'win64-vc': - lenv.Append(LINKFLAGS = ['/MACHINE:X64']) - - if lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - if lenv['BF_DEBUG']: - lenv.Append(CCFLAGS = ['/MTd']) - else: - lenv.Append(CCFLAGS = ['/MT']) - - targetdir = root_build_dir+'lib/' + libname - if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): - targetdir = '#'+targetdir - lib = lenv.Library(target= targetdir, source=sources) - SConsEnvironment.Default(self, lib) # we add to default target, because this way we get some kind of progress info during build - if self['BF_MSVS'] and self['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - #if targetdir[0] == '#': - # targetdir = targetdir[1:-1] - print "! ",targetdir+ '.vcproj' # + self['MSVSPROJECTSUFFIX'] - vcproject = self.MSVSProject(target = targetdir + '.vcproj', # + self['MSVSPROJECTSUFFIX'], - srcs = sources, - buildtarget = lib, - variant = 'Release', - auto_build_solution=0) - vcp.append(vcproject) - SConsEnvironment.Default(self, vcproject) - else: - print bc.WARNING+'Not building '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC+' for '+bc.OKBLUE+'BF_QUICK'+bc.ENDC - # note: libs is a global - add_lib_to_dict(self, libs, libtype, libname, priority) - - def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None, binarykind=''): - global vcp - print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC - lenv = self.Clone() - if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'): - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - lenv.Append(LINKFLAGS = ['/FORCE:MULTIPLE']) - if lenv['BF_DEBUG']: - lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb']) - if lenv['OURPLATFORM']=='linux2': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - if lenv['WITH_BF_PYTHON']: - lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) - if lenv['OURPLATFORM']=='sunos5': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - if lenv['WITH_BF_PYTHON']: - lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) - if lenv['CXX'].endswith('CC'): - lenv.Replace(LINK = '$CXX') - if lenv['OURPLATFORM']=='darwin': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - if lenv['WITH_BF_PYTHON']: - lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) - lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS']) - if lenv['BF_PROFILE']: - lenv.Append(LINKFLAGS = lenv['BF_PROFILE_LINKFLAGS']) - lenv.Append(CPPPATH=includes) - if root_build_dir[0]==os.sep or root_build_dir[1]==':': - lenv.Append(LIBPATH=root_build_dir + '/lib') - lenv.Append(LIBPATH=libpath) - lenv.Append(LIBS=libs) - if lenv['WITH_BF_QUICKTIME']: - lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB']) - lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH']) - prog = lenv.Program(target=builddir+'bin/'+progname, source=sources) - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc') and lenv['BF_BSC']: - f = lenv.File(progname + '.bsc', builddir) - brs = lenv.Command(f, prog, [bsc]) - SConsEnvironment.Default(self, brs) - SConsEnvironment.Default(self, prog) - if self['BF_MSVS'] and self['OURPLATFORM'] in ('win32-vc', 'win64-vc') and progname == 'blender': - print "! ",builddir + "/" + progname + '.sln' - sln = self.MSVSProject(target = builddir + "/" + progname + '.sln', - projects= vcp, - variant = 'Release') - SConsEnvironment.Default(self, sln) - program_list.append(prog) - if lenv['OURPLATFORM']=='darwin': - lenv['BINARYKIND'] = binarykind - lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print)) - elif os.sep == '/' and lenv['OURPLATFORM'] != 'linuxcross': # any unix (except cross-compilation) - if lenv['WITH_BF_PYTHON']: - if not lenv['WITHOUT_BF_INSTALL'] and not lenv['WITHOUT_BF_PYTHON_INSTALL']: - lenv.AddPostAction(prog,Action(UnixPyBundle,strfunction=my_unixpybundle_print)) - elif lenv['OURPLATFORM'].startswith('win') or lenv['OURPLATFORM'] == 'linuxcross': # windows or cross-compilation - if lenv['WITH_BF_PYTHON']: - if not lenv['WITHOUT_BF_PYTHON_INSTALL']: - lenv.AddPostAction(prog,Action(WinPyBundle,strfunction=my_winpybundle_print)) - return prog - - def Glob(lenv, pattern): - path = string.replace(GetBuildPath(lenv,'SConscript'),'SConscript', '') - files = [] - for i in glob.glob(path + pattern): - files.append(string.replace(i, path, '')) - return files diff --git a/tools/__init__.py b/tools/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 --- a/tools/__init__.py +++ /dev/null diff --git a/tools/bcolors.py b/tools/bcolors.py deleted file mode 100644 index b01bb781524..00000000000 --- a/tools/bcolors.py +++ /dev/null @@ -1,16 +0,0 @@ -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - - def disable(self): - self.HEADER = '' - self.OKBLUE = '' - self.OKGREEN = '' - self.WARNING = '' - self.FAIL = '' - self.ENDC = '' - diff --git a/tools/btools.py b/tools/btools.py deleted file mode 100644 index 03a1a0f0b7a..00000000000 --- a/tools/btools.py +++ /dev/null @@ -1,566 +0,0 @@ -import os -import os.path -import SCons.Options - -import SCons.Variables -try: - import subprocess -except ImportError: - pass -import string -import glob -import shutil -import sys - -Variables = SCons.Variables -BoolVariable = SCons.Variables.BoolVariable - -VERSION = '2.52' # This is used in creating the local config directories - -def print_arguments(args, bc): - if len(args): - for k,v in args.iteritems(): - if type(v)==list: - v = ' '.join(v) - print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC - else: - print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC - -def validate_arguments(args, bc): - opts_list = [ - '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', 'BF_PYTHON_DLL', - 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC', - 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', - 'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', - 'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', - 'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH', - 'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH', - 'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC', - 'WITH_BF_DDS', - 'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC', - 'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB', - 'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH', - 'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH', - 'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH', - 'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH', - 'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH', - 'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH', - 'WITH_BF_INTERNATIONAL', - 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH', - 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH', - 'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB', - 'BF_WINTAB', 'BF_WINTAB_INC', - 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', - 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH', - 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', - 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', - 'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH', - 'WITH_BF_PLAYER', - 'WITH_BF_NOBLENDER', - 'WITH_BF_BINRELOC', - 'WITH_BF_LZO', 'WITH_BF_LZMA', - 'LCGDIR', - 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC', - 'BF_TWEAK_MODE', 'BF_SPLIT_SRC', - 'WITHOUT_BF_INSTALL', - 'WITHOUT_BF_PYTHON_INSTALL', - 'WITHOUT_BF_OVERWRITE_INSTALL', - 'WITH_BF_OPENMP', - 'BF_OPENMP', - 'BF_OPENMP_INC', - 'BF_OPENMP_LIBPATH', - 'WITH_GHOST_COCOA', - 'USE_QTKIT', - 'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE', - 'BF_X264_CONFIG', - 'BF_XVIDCORE_CONFIG', - 'WITH_BF_LCMS', 'BF_LCMS', 'BF_LCMS_INC', 'BF_LCMS_LIB', 'BF_LCMS_LIBPATH', - 'WITH_BF_DOCS', - 'BF_NUMJOBS', - 'BF_MSVS', - 'WITH_BF_FHS', - 'BF_VERSION', - 'BF_GHOST_DEBUG', - 'WITH_BF_RAYOPTIMIZATION', - 'BF_RAYOPTIMIZATION_SSE_FLAGS', - 'BF_NO_ELBEEM', - 'BF_VCREDIST' # Windows-only, and useful only when creating installer - ] - - # Have options here that scons expects to be lists - opts_list_split = [ - 'BF_PYTHON_LINKFLAGS', - 'BF_OPENGL_LINKFLAGS', - 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS', - 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS', - 'BGE_CXXFLAGS', - 'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS', - 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS', - 'C_WARN', 'CC_WARN', 'CXX_WARN', - 'LLIBS', 'PLATFORM_LINKFLAGS','MACOSX_ARCHITECTURE', - ] - - - arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE', - 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME', - 'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE', 'BF_LINE_OVERWRITE', - 'BF_BSC', 'BF_CONFIG', - 'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG', - 'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG', - 'BF_UNIT_TEST'] - - okdict = {} - - for k,v in args.iteritems(): - if (k in opts_list) or (k in arg_list): - okdict[k] = v - elif k in opts_list_split: - okdict[k] = v.split() # "" have already been stripped - else: - print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v - - return okdict - -def print_targets(targs, bc): - if len(targs)>0: - for t in targs: - print '\t'+bc.OKBLUE+t+bc.ENDC - else: - print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC - -def validate_targets(targs, bc): - valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin', - 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release', - 'everything', 'clean', 'install-bin', 'install', 'nsis'] - oklist = [] - for t in targs: - if t in valid_list: - oklist.append(t) - else: - 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 - -def SetupSpawn( env ): - buf = ourSpawn() - buf.ourenv = env - env['SPAWN'] = buf.ourspawn - - -def read_opts(env, cfg, args): - localopts = Variables.Variables(cfg, args) - localopts.AddVariables( - ('LCGDIR', 'location of cvs lib dir'), - (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)), - ('BF_PYTHON', 'base path for python', ''), - ('BF_PYTHON_VERSION', 'Python version to use', ''), - ('BF_PYTHON_INC', 'include path for Python headers', ''), - ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''), - ('BF_PYTHON_LIB', 'Python library', ''), - ('BF_PYTHON_DLL', 'Python dll - used on Windows only', ''), - ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''), - ('BF_PYTHON_LIBPATH', 'Library path', ''), - ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''), - (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)), - - (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)), - ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''), - (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)), - ('BF_OPENAL', 'base path for OpenAL', ''), - ('BF_OPENAL_INC', 'include path for python headers', ''), - ('BF_OPENAL_LIB', 'Path to OpenAL library', ''), - ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''), - ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''), - (BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)), - - (BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)), - ('BF_SDL', 'SDL base path', ''), - ('BF_SDL_INC', 'SDL include path', ''), - ('BF_SDL_LIB', 'SDL library', ''), - ('BF_SDL_LIBPATH', 'SDL library path', ''), - - ('BF_LIBSAMPLERATE', 'libsamplerate aka SRC base path', ''), - ('BF_LIBSAMPLERATE_INC', 'libsamplerate aka SRC include path', ''), - ('BF_LIBSAMPLERATE_LIB', 'libsamplerate aka SRC library', ''), - ('BF_LIBSAMPLERATE_LIBPATH', 'libsamplerate aka SRC library path', ''), - - (BoolVariable('WITH_BF_JACK', 'Enable jack support if true', True)), - ('BF_JACK', 'jack base path', ''), - ('BF_JACK_INC', 'jack include path', ''), - ('BF_JACK_LIB', 'jack library', ''), - ('BF_JACK_LIBPATH', 'jack library path', ''), - - (BoolVariable('WITH_BF_SNDFILE', 'Enable sndfile support if true', True)), - ('BF_SNDFILE', 'sndfile base path', ''), - ('BF_SNDFILE_INC', 'sndfile include path', ''), - ('BF_SNDFILE_LIB', 'sndfile library', ''), - ('BF_SNDFILE_LIBPATH', 'sndfile library path', ''), - - ('BF_PTHREADS', 'Pthreads base path', ''), - ('BF_PTHREADS_INC', 'Pthreads include path', ''), - ('BF_PTHREADS_LIB', 'Pthreads library', ''), - ('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''), - - (BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)), - (BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)), - ('BF_OPENEXR', 'OPENEXR base path', ''), - ('BF_OPENEXR_INC', 'OPENEXR include path', ''), - ('BF_OPENEXR_LIB', 'OPENEXR library', ''), - ('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''), - ('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''), - - (BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)), - - (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)), - ('BF_FFMPEG', 'FFMPEG base path', ''), - ('BF_FFMPEG_LIB', 'FFMPEG library', ''), - ('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''), - - ('BF_FFMPEG_INC', 'FFMPEG includes', ''), - ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''), - - (BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true', - False)), - ('BF_OGG', 'OGG base path', ''), - ('BF_OGG_LIB', 'OGG library', ''), - - (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)), - ('BF_JPEG', 'JPEG base path', ''), - ('BF_JPEG_INC', 'JPEG include path', ''), - ('BF_JPEG_LIB', 'JPEG library', ''), - ('BF_JPEG_LIBPATH', 'JPEG library path', ''), - - (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)), - ('BF_OPENJPEG', 'OPENJPEG base path', ''), - ('BF_OPENJPEG_INC', 'OPENJPEG include path', ''), - ('BF_OPENJPEG_LIB', 'OPENJPEG library', ''), - ('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''), - - (BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)), - ('BF_REDCODE', 'REDCODE base path', ''), - ('BF_REDCODE_INC', 'REDCODE include path', ''), - ('BF_REDCODE_LIB', 'REDCODE library', ''), - ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''), - - (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)), - ('BF_PNG', 'PNG base path', ''), - ('BF_PNG_INC', 'PNG include path', ''), - ('BF_PNG_LIB', 'PNG library', ''), - ('BF_PNG_LIBPATH', 'PNG library path', ''), - - (BoolVariable('WITH_BF_TIFF', 'Use TIFF if true', True)), - ('BF_TIFF', 'TIFF base path', ''), - ('BF_TIFF_INC', 'TIFF include path', ''), - ('BF_TIFF_LIB', 'TIFF library', ''), - ('BF_TIFF_LIBPATH', 'TIFF library path', ''), - - (BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)), - ('BF_LCMS', 'LCMS base path', ''), - ('BF_LCMS_INC', 'LCMS include path', ''), - ('BF_LCMS_LIB', 'LCMS library', ''), - ('BF_LCMS_LIBPATH', 'LCMS library path', ''), - - (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)), - ('BF_ZLIB', 'ZLib base path', ''), - ('BF_ZLIB_INC', 'ZLib include path', ''), - ('BF_ZLIB_LIB', 'ZLib library', ''), - ('BF_ZLIB_LIBPATH', 'ZLib library path', ''), - - (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext if true', True)), - - ('BF_GETTEXT', 'gettext base path', ''), - ('BF_GETTEXT_INC', 'gettext include path', ''), - ('BF_GETTEXT_LIB', 'gettext library', ''), - ('BF_GETTEXT_LIBPATH', 'gettext library path', ''), - - (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)), - ('BF_ICONV', 'iconv base path', ''), - ('BF_ICONV_INC', 'iconv include path', ''), - ('BF_ICONV_LIB', 'iconv library', ''), - ('BF_ICONV_LIBPATH', 'iconv library path', ''), - - (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , False)), - - (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)), - ('BF_BULLET', 'Bullet base dir', ''), - ('BF_BULLET_INC', 'Bullet include path', ''), - ('BF_BULLET_LIB', 'Bullet library', ''), - - ('BF_WINTAB', 'WinTab base dir', ''), - ('BF_WINTAB_INC', 'WinTab include dir', ''), - ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''), - (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)), - ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''), -## -##WITH_BF_NSPR = True -##BF_NSPR = $(LCGDIR)/nspr -##BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr -##BF_NSPR_LIB = -### Uncomment the following line to use Mozilla inplace of netscape -##CPPFLAGS += -DMOZ_NOT_NET -### Location of MOZILLA/Netscape header files... -##BF_MOZILLA = $(LCGDIR)/mozilla -##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 -##BF_MOZILLA_LIB = -### Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB -### if this is not set. -## -### Be paranoid regarding library creation (do not update archives) -##BF_PARANOID = True -## -### enable freetype2 support for text objects - (BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', True)), - ('BF_FREETYPE', 'Freetype base path', ''), - ('BF_FREETYPE_INC', 'Freetype include path', ''), - ('BF_FREETYPE_LIB', 'Freetype library', ''), - ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''), - - (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)), - ('BF_OPENMP', 'Base path to OpenMP (used when cross-compiling with older versions of WinGW)', ''), - ('BF_OPENMP_INC', 'Path to OpenMP includes (used when cross-compiling with older versions of WinGW)', ''), - ('BF_OPENMP_LIBPATH', 'Path to OpenMP libraries (used when cross-compiling with older versions of WinGW)', ''), - (BoolVariable('WITH_GHOST_COCOA', 'Use Cocoa-framework if true', False)), - (BoolVariable('USE_QTKIT', 'Use QTKIT if true', False)), - - (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)), - ('BF_QUICKTIME', 'QuickTime base path', ''), - ('BF_QUICKTIME_INC', 'QuickTime include path', ''), - ('BF_QUICKTIME_LIB', 'QuickTime library', ''), - ('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''), - - (BoolVariable('WITH_BF_FFTW3', 'Use FFTW3 if true', False)), - ('BF_FFTW3', 'FFTW3 base path', ''), - ('BF_FFTW3_INC', 'FFTW3 include path', ''), - ('BF_FFTW3_LIB', 'FFTW3 library', ''), - ('BF_FFTW3_LIBPATH', 'FFTW3 library path', ''), - - (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)), - ('BF_OPENGL', 'OpenGL base path', ''), - ('BF_OPENGL_INC', 'OpenGL include path', ''), - ('BF_OPENGL_LIB', 'OpenGL libraries', ''), - ('BF_OPENGL_LIBPATH', 'OpenGL library path', ''), - ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''), - ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''), - - (BoolVariable('WITH_BF_COLLADA', 'Build COLLADA import/export module if true', False)), - ('BF_COLLADA', 'COLLADA base path', ''), - ('BF_COLLADA_INC', 'COLLADA include path', ''), - ('BF_COLLADA_LIB', 'COLLADA library', ''), - ('BF_OPENCOLLADA', 'OpenCollada base path', ''), - ('BF_OPENCOLLADA_INC', 'OpenCollada base include path', ''), - ('BF_OPENCOLLADA_LIB', 'OpenCollada library', ''), - ('BF_OPENCOLLADA_LIBPATH', 'OpenCollada library path', ''), - ('BF_PCRE', 'PCRE base path', ''), - ('BF_PCRE_LIB', 'PCRE library', ''), - ('BF_PCRE_LIBPATH', 'PCRE library path', ''), - ('BF_EXPAT', 'Expat base path', ''), - ('BF_EXPAT_LIB', 'Expat library', ''), - ('BF_EXPAT_LIBPATH', 'Expat library path', ''), - - (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)), - (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)), - - ('CFLAGS', 'C only flags', ''), - ('CCFLAGS', 'Generic C and C++ flags', ''), - ('CXXFLAGS', 'C++ only flags', ''), - ('BGE_CXXFLAGS', 'C++ only flags for BGE', ''), - ('CPPFLAGS', 'Defines', ''), - ('REL_CFLAGS', 'C only release flags', ''), - ('REL_CCFLAGS', 'Generic C and C++ release flags', ''), - ('REL_CXXFLAGS', 'C++ only release flags', ''), - - ('C_WARN', 'C warning flags', ''), - ('CC_WARN', 'Generic C and C++ warning flags', ''), - ('CXX_WARN', 'C++ only warning flags', ''), - - ('LLIBS', 'Platform libs', ''), - ('PLATFORM_LINKFLAGS', 'Platform linkflags', ''), - ('MACOSX_ARCHITECTURE', 'python_arch.zip select', ''), - - (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)), - ('BF_PROFILE_CFLAGS', 'C only profiling flags', ''), - ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''), - ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''), - ('BF_PROFILE_LINKFLAGS', 'Profile linkflags', ''), - - (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)), - ('BF_DEBUG_CFLAGS', 'C only debug flags', ''), - ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''), - ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''), - - (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)), - - ('BF_BUILDDIR', 'Build dir', ''), - ('BF_INSTALLDIR', 'Installation dir', ''), - - ('CC', 'C compiler to use', env['CC']), - ('CXX', 'C++ compiler to use', env['CXX']), - - (BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)), - - (BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)), - (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)), - (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)), - (BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)), - (BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)), - (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)), - (BoolVariable('BF_QUIET', 'Enable silent output if true', True)), - (BoolVariable('BF_LINE_OVERWRITE', 'Enable overwriting of compile line in BF_QUIET mode if true', False)), - (BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)), - - (BoolVariable('WITH_BF_LZO', 'Enable fast LZO pointcache compression', True)), - (BoolVariable('WITH_BF_LZMA', 'Enable best LZMA pointcache compression', True)), - - ('BF_X264_CONFIG', 'configuration flags for x264', ''), - ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''), - (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)), - - ('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'), - ('BF_NUMJOBS', 'Number of build processes to spawn', '1'), - ('BF_MSVS', 'Generate MSVS project files and solution', False), - - (BoolVariable('WITH_BF_FHS', 'Use the Unix "Filesystem Hierarchy Standard" rather then a redistributable directory layout', False)), - ('BF_VERSION', 'The root path for Unix (non-apple)', '2.5'), - - (BoolVariable('BF_UNIT_TEST', 'Build with unit test support.', False)), - - (BoolVariable('BF_GHOST_DEBUG', 'Make GHOST print events and info to stdout. (very verbose)', False)), - - (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)), - ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''), - ('BF_VCREDIST', 'Full path to vcredist', '') - ) # end of opts.AddOptions() - - return localopts - -def NSIS_print(target, source, env): - return "Creating NSIS installer for Blender" - -def NSIS_Installer(target=None, source=None, env=None): - print "="*35 - - if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc'): - print "NSIS installer is only available on Windows." - Exit() - if env['OURPLATFORM'] == 'win32-vc': - bitness = '32' - elif env['OURPLATFORM'] == 'win64-vc': - bitness = '64' - else: - bitness = '-mingw' - - start_dir = os.getcwd() - rel_dir = os.path.join(start_dir,'release','windows','installer') - install_base_dir = start_dir + os.sep - - bf_installdir = os.path.join(os.getcwd(),env['BF_INSTALLDIR']) - bf_installdir = os.path.normpath(bf_installdir) - - doneroot = False - rootdirconts = [] - datafiles = '' - l = len(bf_installdir) - - for dp,dn,df in os.walk(bf_installdir): - if not doneroot: - for f in df: - rootdirconts.append(os.path.join(dp,f)) - doneroot = True - else: - if len(df)>0: - dp_tmp = dp[l:] - if dp_tmp.find('python\\lib') > -1: - datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n" - else: - datafiles += "\n"+r'SetOutPath $BLENDERHOME'+dp[l:]+"\n\n" - - for f in df: - outfile = os.path.join(dp,f) - datafiles += ' File '+outfile + "\n" - - os.chdir("release") - v = open("VERSION") - version = v.read()[:-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() - - # var replacements - ns_cnt = string.replace(ns_cnt, "[DISTDIR]", os.path.normpath(inst_dir+os.sep)) - ns_cnt = string.replace(ns_cnt, "[VERSION]", version) - ns_cnt = string.replace(ns_cnt, "[SHORTVERSION]", VERSION) - ns_cnt = string.replace(ns_cnt, "[RELDIR]", os.path.normpath(rel_dir)) - ns_cnt = string.replace(ns_cnt, "[BITNESS]", bitness) - - # do root - rootlist = [] - for rootitem in rootdirconts: - rootlist.append("File \"" + rootitem + "\"") - rootstring = string.join(rootlist, "\n ") - rootstring = rootstring - rootstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring) - - - # do delete items - delrootlist = [] - for rootitem in rootdirconts: - delrootlist.append("Delete $INSTDIR\\" + rootitem[l+1:]) - delrootstring = string.join(delrootlist, "\n ") - delrootstring += "\n" - ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) - - ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles) - - # Setup vcredist part - vcredist = "File \""+env['BF_VCREDIST'] + "\"\n" - vcredist += " ExecWait '\"$TEMP\\" + os.path.basename(env['BF_VCREDIST']) + "\" /q'\n" - vcredist += " Delete \"$TEMP\\" + os.path.basename(env['BF_VCREDIST'])+"\"" - ns_cnt = string.replace(ns_cnt, "[VCREDIST]", vcredist) - - 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() - print "NSIS Installer script created" - - os.chdir(start_dir) - print "Launching 'makensis'" - - 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() - - if rv != 0: - print - print data.strip().split("\n")[-1] - return rv - diff --git a/tools/crossmingw.py b/tools/crossmingw.py deleted file mode 100644 index f97fdf3c15e..00000000000 --- a/tools/crossmingw.py +++ /dev/null @@ -1,184 +0,0 @@ -"""SCons.Tool.gcc - -Tool-specific initialization for MinGW (http://www.mingw.org/) - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "src/engine/SCons/Tool/mingw.py 4043 2009/02/23 09:06:45 scons" - -import os -import os.path -import string - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Tool -import SCons.Util - -# This is what we search for to find mingw: -prefixes = SCons.Util.Split(""" - mingw32- - i386-mingw32msvc- - i486-mingw32msvc- - i586-mingw32msvc- - i686-mingw32msvc- - i686-pc-mingw32- -""") - -def find(env): - for prefix in prefixes: - # First search in the SCons path and then the OS path: - if env.WhereIs(prefix + 'gcc') or SCons.Util.WhereIs(prefix + 'gcc'): - return prefix - - return '' - -def shlib_generator(target, source, env, for_signature): - cmd = SCons.Util.CLVar(['$SHLINK']) - - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: cmd.extend(['-o', dll]) - - cmd.extend(['$SOURCES', '$SHLINKFLAGS', '$_LIBDIRFLAGS', '$_LIBFLAGS']) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) - - def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - insert_def = env.subst("$WINDOWS_INSERT_DEF") - if not insert_def in ['', '0', 0] and def_target: \ - cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) - - return [cmd] - -def shlib_emitter(target, source, env): - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") - - if not no_import_lib and \ - not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): - - # Append an import library to the list of targets. - target.append(env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'LIBPREFIX', 'LIBSUFFIX')) - - # Append a def file target if there isn't already a def file target - # or a def file source. There is no option to disable def file - # target emitting, because I can't figure out why someone would ever - # want to turn it off. - def_source = env.FindIxes(source, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - if not def_source and not def_target: - target.append(env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX')) - - return (target, source) - - -shlib_action = SCons.Action.Action(shlib_generator, generator=1) - -res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') - -res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', - source_scanner=SCons.Tool.SourceFileScanner) -SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) - -def generate(env): - mingw = find(env) - if mingw: - dir = os.path.dirname(mingw) - env.PrependENVPath('PATH', dir ) - - - # Most of mingw is the same as gcc and friends... - gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'm4'] - for tool in gnu_tools: - SCons.Tool.Tool(tool)(env) - - #... but a few things differ: - env['CC'] = mingw + 'gcc' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['CXX'] = mingw + 'g++' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = shlib_action - env['LDMODULECOM'] = shlib_action - env.Append(SHLIBEMITTER = [shlib_emitter]) - env['RANLIB'] = mingw + 'ranlib' - env['LINK'] = mingw + 'gcc' - env['AS'] = mingw + 'as' - env['AR'] = mingw + 'ar' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' - env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' - - env['SHOBJSUFFIX'] = '.o' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = mingw + 'windres' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['RCINCPREFIX'] = '--include-dir ' - env['RCINCSUFFIX'] = '' - env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' - env['BUILDERS']['RES'] = res_builder - - # Some setting from the platform also have to be overridden: - env['OBJPREFIX'] = '' - env['OBJSUFFIX'] = '.o' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.a' - env['SHOBJPREFIX'] = '$OBJPREFIX' - env['SHOBJSUFFIX'] = '$OBJSUFFIX' - env['PROGPREFIX'] = '' - env['PROGSUFFIX'] = '.exe' - env['LIBPREFIX'] = '' - env['LIBSUFFIX'] = '.lib' - env['SHLIBPREFIX'] = '' - env['SHLIBSUFFIX'] = '.dll' - env['LIBPREFIXES'] = [ '$LIBPREFIX' ] - env['LIBSUFFIXES'] = [ '$LIBSUFFIX' ] - -def exists(env): - return find(env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/tools/mstoolkit.py b/tools/mstoolkit.py deleted file mode 100644 index 4eeefa5ed9d..00000000000 --- a/tools/mstoolkit.py +++ /dev/null @@ -1,353 +0,0 @@ -"""tools.mstoolkit - -Tool-specific initialization for Microsoft Visual C/C++ Toolkit Commandline - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2004 John Connors -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - - -import os.path -import re -import string -import types - -import SCons.Action -import SCons.Builder -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Util -import SCons.Warnings - -CSuffixes = ['.c', '.C'] -CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] - -def get_msvctoolkit_paths(): - """Return a 4-tuple of (INCLUDE, LIB, PATH, TOOLKIT) as the values of those - three environment variables that should be set in order to execute - the MSVC .NET tools properly, if the information wasn't available - from the registry.""" - - MSToolkitDir = None - paths = {} - exe_path = '' - lib_path = '' - include_path = '' - - # First, we get the shell folder for this user: - if not SCons.Util.can_read_reg: - raise SCons.Errors.InternalError, "No Windows registry module was found" - - # look for toolkit - if os.environ.has_key('VCToolkitInstallDir'): - MSToolkitDir = os.path.normpath(os.environ['VCToolkitInstallDir']) - else: - # last resort -- default install location - MSToolkitDir = r'C:\Program Files\Microsoft Visual C++ Toolkit 2003' - - # look for platform sdk - if os.environ.has_key('MSSdk'): - PlatformSDKDir = os.path.normpath(os.environ['MSSdk']) - else: - try: - PlatformSDKDir = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir')[0] - PlatformSDKDir = str(PlatformSDKDir) - except SCons.Util.RegError: - raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry or in the `MSSdk` environment variable." - - # look for DX Sdk (expecting DX9) - # dxsdk docs have a directory key, look for it, extract path - #dxsdkdocs = "" - DXsdkDir = "" - #try: - # dxsdkdocs = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\DirectX SDK\DX9SDK Doc Path') - #except SCons.Util.RegError: - # raise SCons.Errors.InternalError, "The DXSDK directory was not found in the registry." - if os.environ.has_key('DXSDK_DIR'): - DXsdkDir = os.path.normpath(os.environ['DXSDK_DIR']) - - #DXsdkDir = os.path.split(dxsdkdocs[0])[0] - DXsdkDir = os.path.split(DXsdkDir)[0] - - include_path = r'%s\include;%s\include;%s\include' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) - lib_path = r'%s\lib;%s\lib;%s\lib' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) - exe_path = r'%s\bin;%s\bin\win95;%s\bin' % (MSToolkitDir, PlatformSDKDir, PlatformSDKDir) - return (include_path, lib_path, exe_path, PlatformSDKDir) - -def validate_vars(env): - """Validate the PDB, PCH, and PCHSTOP construction variables.""" - if env.has_key('PCH') and env['PCH']: - if not env.has_key('PCHSTOP'): - raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined." - if not SCons.Util.is_String(env['PCHSTOP']): - raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'] - -def pch_emitter(target, source, env): - """Sets up the PDB dependencies for a pch file, and adds the object - file target.""" - - validate_vars(env) - - pch = None - obj = None - - for t in target: - if SCons.Util.splitext(str(t))[1] == '.pch': - pch = t - if SCons.Util.splitext(str(t))[1] == '.obj': - obj = t - - if not obj: - obj = SCons.Util.splitext(str(pch))[0]+'.obj' - - target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - return (target, source) - -def object_emitter(target, source, env, parent_emitter): - """Sets up the PDB and PCH dependencies for an object file.""" - - validate_vars(env) - - parent_emitter(target, source, env) - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - if env.has_key('PCH') and env['PCH']: - env.Depends(target, env['PCH']) - - return (target, source) - -def static_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.StaticObjectEmitter) - -def shared_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.SharedObjectEmitter) - -pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter) -res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res') - -def pdbGenerator(env, target, source, for_signature): - if target and env.has_key('PDB') and env['PDB']: - return ['/PDB:%s'%target[0].File(env['PDB']).get_string(for_signature), - '/DEBUG'] - -def win32ShlinkTargets(target, source, env, for_signature): - listCmd = [] - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) - - return listCmd - -def win32ShlinkSources(target, source, env, for_signature): - listCmd = [] - - deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX") - for src in source: - if src == deffile: - # Treat this source as a .def file. - listCmd.append("/def:%s" % src.get_string(for_signature)) - else: - # Just treat it as a generic source file. - listCmd.append(src) - return listCmd - -def win32LibEmitter(target, source, env): - # SCons.Tool.msvc.validate_vars(env) - - dll = env.FindIxes(target, "SHLIBPREFIX", "SHLIBSUFFIX") - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") - - if env.get("WIN32_INSERT_DEF", 0) and \ - not env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX"): - - # append a def file to the list of sources - source.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "WIN32DEFPREFIX", "WIN32DEFSUFFIX")) - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - if not no_import_lib and \ - not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): - # Append an import library to the list of targets. - target.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "LIBPREFIX", "LIBSUFFIX")) - # and .exp file is created if there are exports from a DLL - target.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "WIN32EXPPREFIX", "WIN32EXPSUFFIX")) - - return (target, source) - -def prog_emitter(target, source, env): - #SCons.Tool.msvc.validate_vars(env) - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - return (target,source) - -def RegServerFunc(target, source, env): - if env.has_key('register') and env['register']: - ret = regServerAction([target[0]], [source[0]], env) - if ret: - raise SCons.Errors.UserError, "Unable to register %s" % target[0] - else: - print "Registered %s sucessfully" % target[0] - return ret - return 0 - -regServerAction = SCons.Action.Action("$REGSVRCOM") -regServerCheck = SCons.Action.Action(RegServerFunc, None) -shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}') -compositeLinkAction = shlibLinkAction + regServerCheck - -def generate(env): - """Add Builders and construction variables for MSVC++ to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in CSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCAction) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CXXAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) - - SCons.Tool.createStaticLibBuilder(env) - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}']) - env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}']) - env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS' - env['CC'] = 'cl' - env['CCFLAGS'] = SCons.Util.CLVar('/nologo') - env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' - env['CXX'] = '$CC' - env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)') - env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' - env['CPPDEFPREFIX'] = '/D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '/I' - env['INCSUFFIX'] = '' - env['OBJEMITTER'] = static_object_emitter - env['SHOBJEMITTER'] = shared_object_emitter - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = 'rc' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' - CScan = env.get_scanner('.c') - if CScan: - CScan.add_skey('.rc') - env['BUILDERS']['RES'] = res_builder - - include_path, lib_path, exe_path, sdk_path = get_msvctoolkit_paths() - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) - - env['ENV']['CPU'] = 'i386' - env['ENV']['MSSDK'] = sdk_path - env['ENV']['BkOffice'] = sdk_path - env['ENV']['Basemake'] = sdk_path + "\\Include\\BKOffice.Mak" - env['ENV']['INETSDK'] = sdk_path - env['ENV']['MSSDK'] = sdk_path - env['ENV']['MSTOOLS'] = sdk_path - env['ENV']['TARGETOS'] = 'WINNT' - env['ENV']['APPVER'] = '5.0' - - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cc' - - env['PCHCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS' - env['BUILDERS']['PCH'] = pch_builder - - env['AR'] = 'lib.exe' #'"' +sdk_path + '\\bin\\Win64\\lib.exe"' - env['ARFLAGS'] = SCons.Util.CLVar('/nologo') - env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') - env['_SHLINK_TARGETS'] = win32ShlinkTargets - env['_SHLINK_SOURCES'] = win32ShlinkSources - env['SHLINKCOM'] = compositeLinkAction - env['SHLIBEMITTER']= win32LibEmitter - env['LINK'] = 'link.exe' #'"' +sdk_path + '\\bin\\Win64\\' + 'link.exe"' - env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') - env['_PDB'] = pdbGenerator - env["TEMPFILE"] = SCons.Platform.win32.TempFileMunge - env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}' - env['PROGEMITTER'] = prog_emitter - env['LIBDIRPREFIX']='/LIBPATH:' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WIN32_INSERT_DEF'] = 0 - - env['WIN32EXPPREFIX'] = '' - env['WIN32EXPSUFFIX'] = '.exp' - - env['REGSVRACTION'] = regServerCheck - env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') - env['REGSVRFLAGS'] = '/s ' - env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS $TARGET' - - -def exists(env): - return env.Detect('cl') |