for x in tasks: if x.hasrun!=Task.SUCCESS: self.end_msg(kw.get('errmsg','no'),color='YELLOW') self.fatal(kw.get('fatalmsg',None)or'One of the tests has failed, see the config.log for more information') self.end_msg('ok') conf(parse_flags) conf(ret_msg) conf(validate_cfg) conf(exec_cfg) conf(check_cfg) conf(validate_c) conf(post_check) conf(check) feature('test_exec')(test_exec_fun) after_method('apply_link')(test_exec_fun) conf(run_c_code) conf(check_cxx) conf(check_cc) conf(define) conf(undefine) conf(define_cond) conf(is_defined) conf(get_define) conf(have_define) conf(write_config_header) conf(get_config_header) conf(cc_add_flags) conf(cxx_add_flags) conf(link_add_flags) conf(cc_load_tools)
if not hasattr(test.__class__, '__oldstr__'): test.__class__.__oldstr__ = test.__class__.__str__ test.__class__.__str__ = systest_task_str test.__class__.run = systest_task_run test.__unicode__ = systest_task_str test.sys = sysname test.ram = sdramname or sramname or "" test.rom = romname test.atstr = atstr test.filename = filename test.ut_exec = exec_list + param from waflib.TaskGen import feature, after_method, before_method, task_gen feature('systest')(make_systest) after_method('apply_link')(make_systest) # ASM hooks for the gcc compiler def s_hook(self, node): return self.create_compiled_task('c', node) TaskGen.extension('.S')(s_hook) MKPROM = Task.task_factory('MKPROM', func='${MKPROM} ${_MKPROMFLAGS} -o ${TGT} ${SRC}', color='YELLOW') MKPROM_TSKS = list()
color='YELLOW' run_str='${MCS} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}' def configure(conf): csc=getattr(Options.options,'cscbinary',None) if csc: conf.env.MCS=csc conf.find_program(['csc','mcs','gmcs'],var='MCS') conf.env.ASS_ST='/r:%s' conf.env.RES_ST='/resource:%s' conf.env.CS_NAME='csc' if str(conf.env.MCS).lower().find('mcs')>-1: conf.env.CS_NAME='mono' def options(opt): opt.add_option('--with-csc-binary',type='string',dest='cscbinary') class fake_csshlib(Task.Task): color='YELLOW' inst_to=None def runnable_status(self): for x in self.outputs: x.sig=Utils.h_file(x.abspath()) return Task.SKIP_ME def read_csshlib(self,name,paths=[]): return self(name=name,features='fake_lib',lib_paths=paths,lib_type='csshlib') feature('cs')(apply_cs) before_method('process_source')(apply_cs) feature('cs')(use_cs) after_method('apply_cs')(use_cs) feature('cs')(debug_cs) after_method('apply_cs','use_cs')(debug_cs) conf(read_csshlib)
opt.add_option('--header-ext', type='string', default='', help='header extension for moc files', dest='qt_header_ext') for i in 'qtdir qtbin qtlibs'.split(): opt.add_option('--' + i, type='string', default='', dest=i) if sys.platform == "darwin": opt.add_option('--no-qt4-framework', action="store_false", help='do not use the framework version of Qt4 in OS X', dest='use_qt4_osxframework', default=True) opt.add_option('--translate', action="store_true", help="collect translation strings", dest="trans_qt4", default=False) extension(*EXT_RCC)(create_rcc_task) extension(*EXT_UI)(create_uic_task) extension('.ts')(add_lang) feature('qt4')(apply_qt4) after_method('apply_link')(apply_qt4) extension(*EXT_QT4)(cxx_hook) conf(find_qt4_binaries) conf(find_qt4_libraries) conf(simplify_qt4_libs) conf(add_qt4_rpath) conf(set_qt4_libs_to_check)
srcdir = getattr(self, 'srcdir', '') if isinstance(srcdir, Node.Node): srcdir = [srcdir] for x in Utils.to_list(srcdir): if isinstance(x, Node.Node): y = x else: y = self.path.find_dir(x) if not y: self.bld.fatal('Could not find the folder %s from %s' % (x, self.path)) tmp.append(y) tsk.srcdir = tmp # reuse some code feature('scalac')(javaw.use_javac_files) after_method('apply_scalac')(javaw.use_javac_files) feature('scalac')(javaw.set_classpath) after_method('apply_scalac', 'use_scalac_files')(javaw.set_classpath) SOURCE_RE = '**/*.scala' class scalac(javaw.javac): color = 'GREEN' vars = ['CLASSPATH', 'SCALACFLAGS', 'SCALAC', 'OUTDIR'] def runnable_status(self): """ Wait for dependent tasks to be complete, then read the file system to find the input nodes. """ for t in self.run_after:
try: conf.find_program('python',var='PYTHON') except conf.errors.ConfigurationError: warn("could not find a python executable, setting to sys.executable '%s'"%sys.executable) conf.env.PYTHON=sys.executable if conf.env.PYTHON!=sys.executable: warn("python executable '%s' different from sys.executable '%s'"%(conf.env.PYTHON,sys.executable)) conf.env.PYTHON=conf.cmd_to_list(conf.env.PYTHON) v=conf.env v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v['PYFLAGS']='' v['PYFLAGS_OPT']='-O' v['PYC']=getattr(Options.options,'pyc',1) v['PYO']=getattr(Options.options,'pyo',1) def options(opt): opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc') opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo') extension('.py')(process_py) feature('py')(feature_py) feature('pyext')(init_pyext) before_method('propagate_uselib_vars','apply_link')(init_pyext) after_method('apply_bundle')(init_pyext) feature('pyext')(set_bundle) before_method('apply_link','apply_bundle')(set_bundle) before_method('propagate_uselib_vars')(init_pyembed) feature('pyembed')(init_pyembed) conf(get_python_variables) conf(check_python_headers) conf(check_python_version) conf(check_python_module)
obj_node = self.path.find_or_declare(self.target + '.%s' % self.env.GOCHAR) task = self.create_task('go', src_nodes, obj_node) try: self.compiled_tasks.append(task) except AttributeError: self.compiled_tasks = [task] def decorate(*args): decorators = args[:-1] func = args[-1] for d in reversed(decorators): func = d(func) decorate( feature('go'), after_method('propagate_uselib_vars', 'process_source'), apply_incpaths, ) decorate( feature('goprogram', 'gopackage'), after_method('process_source'), apply_link, ) ######################################################################## # Configuration ######################################################################## @conf def find_go_command(self): # find go command, we will use it to run go tools
incDirs = [x.parent.abspath() for x in f] dir = conf.root.find_dir(conf.env.JAVA_HOME[0]) f = dir.ant_glob('**/*jvm.(so|dll)') libDirs = [x.parent.abspath() for x in f] or [javaHome] for i, d in enumerate(libDirs): if conf.check(header_name='jni.h', define_name='HAVE_JNI_H', lib='jvm', libpath=d, includes=incDirs, uselib_store='JAVA', uselib='JAVA'): break else: conf.fatal('could not find lib jvm in %r (see config.log)' % libDirs) feature('javac')(apply_java) before_method('process_source')(apply_java) feature('javac')(use_javac_files) after_method('apply_java')(use_javac_files) feature('javac')(set_classpath) after_method('apply_java', 'propagate_uselib_vars', 'use_javac_files')(set_classpath) feature('jar')(jar_files) after_method('apply_java', 'use_javac_files')(jar_files) before_method('process_source')(jar_files) feature('jar')(use_jar_files) after_method('jar_files')(use_jar_files) conf(check_java_class) conf(check_jni_headers)
if isinstance(srcdir, Node.Node): srcdir = [srcdir] for x in Utils.to_list(srcdir): if isinstance(x, Node.Node): y = x else: y = self.path.find_dir(x) if not y: self.bld.fatal(f"Could not find the folder {x} from {self.path}") tmp.append(y) tsk.srcdir = tmp # reuse some code feature("scalac")(javaw.use_javac_files) after_method("apply_scalac")(javaw.use_javac_files) feature("scalac")(javaw.set_classpath) after_method("apply_scalac", "use_scalac_files")(javaw.set_classpath) SOURCE_RE = "**/*.scala" class scalac(javaw.javac): color = "GREEN" vars = ["CLASSPATH", "SCALACFLAGS", "SCALAC", "OUTDIR"] def runnable_status(self): """ Wait for dependent tasks to be complete, then read the file system to find the input nodes.
tsk.env.OUT = "/out:%s" % tsk.outputs[0].abspath() inst_to = getattr(self, "install_path", bintype == "exe" and "${BINDIR}" or "${LIBDIR}") if inst_to: # note: we are making a copy, so the files added to cs_task.outputs won't be installed automatically mod = getattr(self, "chmod", bintype == "exe" and Utils.O755 or Utils.O644) self.install_task = self.add_install_files( install_to=inst_to, install_from=self.cs_task.outputs[:], chmod=mod) feature("fs")(cs.use_cs) after_method("apply_fsc")(cs.use_cs) feature("fs")(cs.debug_cs) after_method("apply_fsc", "use_cs")(cs.debug_cs) class fsc(Task.Task): """ Compile F# files """ color = "YELLOW" run_str = "${FSC} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}" def configure(conf):
else: return -1 def grep_for_endianness_fun(self): self.create_task('grep_for_endianness', self.compiled_tasks[0].outputs[0]) def check_endianness(self): tmp = [] def check_msg(self): return tmp[0] self.check(fragment=ENDIAN_FRAGMENT, features='c grep_for_endianness', msg="Checking for endianness", define='ENDIANNESS', tmp=tmp, okmsg=check_msg) return tmp[0] feature('link_lib_test')(link_lib_test_fun) before_method('process_source')(link_lib_test_fun) conf(check_library) conf(check_inline) conf(check_large_file) feature('grep_for_endianness')(grep_for_endianness_fun) after_method('process_source')(grep_for_endianness_fun) conf(check_endianness)
if not hasattr(test.__class__, '__oldstr__'): test.__class__.__oldstr__ = test.__class__.__str__ test.__class__.__str__ = systest_task_str test.__class__.run = systest_task_run test.__unicode__ = systest_task_str test.sys = sysname test.ram = sdramname or sramname or "" test.rom = romname test.atstr = atstr test.filename = filename test.ut_exec = exec_list + param print(' '.join(test.ut_exec)) from waflib.TaskGen import feature, after_method, before_method, task_gen feature('systest')(make_systest) after_method('apply_link')(make_systest) # ASM hooks for the gcc compiler def s_hook(self,node): return self.create_compiled_task('c',node) TaskGen.extension('.S')(s_hook) MKPROM = Task.task_factory( 'MKPROM', func = '${MKPROM} ${_MKPROMFLAGS} -o ${TGT} ${SRC}', color = 'YELLOW') MKPROM_TSKS = list() def make_prom(self): """Create mkprom task"""
class macapp(Task.Task): color = "PINK" def run(self): self.outputs[0].parent.mkdir() shutil.copy2(self.inputs[0].srcpath(), self.outputs[0].abspath()) class macplist(Task.Task): color = "PINK" ext_in = [".bin"] def run(self): if getattr(self, "code", None): txt = self.code else: txt = self.inputs[0].read() self.outputs[0].write(txt) feature("c", "cxx")(set_macosx_deployment_target) taskgen_method(create_bundle_dirs) feature("cprogram", "cxxprogram")(create_task_macapp) after_method("apply_link")(create_task_macapp) feature("cprogram", "cxxprogram")(create_task_macplist) after_method("apply_link")(create_task_macplist) feature("cshlib", "cxxshlib")(apply_bundle) before_method("apply_link", "propagate_uselib_vars")(apply_bundle)
app_dirs = ['Contents', 'Contents/MacOS', 'Contents/Resources'] class macapp(Task.Task): color = 'PINK' def run(self): self.outputs[0].parent.mkdir() shutil.copy2(self.inputs[0].srcpath(), self.outputs[0].abspath()) class macplist(Task.Task): color = 'PINK' ext_in = ['.bin'] def run(self): if getattr(self, 'code', None): txt = self.code else: txt = self.inputs[0].read() self.outputs[0].write(txt) feature('c', 'cxx')(set_macosx_deployment_target) taskgen_method(create_bundle_dirs) feature('cprogram', 'cxxprogram')(create_task_macapp) after_method('apply_link')(create_task_macapp) feature('cprogram', 'cxxprogram')(create_task_macplist) after_method('apply_link')(create_task_macplist) feature('cshlib', 'cxxshlib')(apply_bundle) before_method('apply_link', 'propagate_uselib_vars')(apply_bundle)
# 5. 6c import create_plan9c_task(cgo_import) # 6. add some of the gcc tasks to compiled_tasks for task in tg.compiled_tasks: if task.inputs[0].name.endswith('_cgo_main.c'): continue self.compiled_tasks.append(task) # restore the group self.bld.set_group(current_group) decorate( feature('cgo'), before_method('apply_incpaths', 'propagate_uselib_vars'), after_method('apply_link', 'process_source'), process_use, ) decorate( feature('cgo'), after_method('process_use'), propagate_uselib_vars, ) def check_tool_loaded(conf, thetool): for tool in conf.tools: if tool['tool'] == thetool: return True return False def configure(conf):
srcdir = [srcdir] for x in Utils.to_list(srcdir): if isinstance(x, Node.Node): y = x else: y = self.path.find_dir(x) if not y: self.bld.fatal('Could not find the folder %s from %s' % (x, self.path)) tmp.append(y) tsk.srcdir = tmp # reuse some code feature('scalac')(javaw.use_javac_files) after_method('apply_scalac')(javaw.use_javac_files) feature('scalac')(javaw.set_classpath) after_method('apply_scalac', 'use_scalac_files')(javaw.set_classpath) SOURCE_RE = '**/*.scala' class scalac(javaw.javac): color = 'GREEN' vars = ['CLASSPATH', 'SCALACFLAGS', 'SCALAC', 'OUTDIR'] def runnable_status(self): """ Wait for dependent tasks to be complete, then read the file system to find the input nodes. """
conf.check( header_name="jni.h", define_name="HAVE_JNI_H", lib="jvm", libpath=d, includes=incDirs, uselib_store="JAVA", uselib="JAVA", ) except: pass else: break else: conf.fatal("could not find lib jvm in %r (see config.log)" % libDirs) feature("javac")(apply_java) before_method("process_source")(apply_java) feature("javac")(use_javac_files) after_method("apply_java")(use_javac_files) feature("javac")(set_classpath) after_method("apply_java", "propagate_uselib_vars", "use_javac_files")(set_classpath) feature("jar")(jar_files) after_method("apply_java", "use_javac_files")(jar_files) before_method("process_source")(jar_files) feature("jar")(use_jar_files) after_method("jar_files")(use_jar_files) conf(check_java_class) conf(check_jni_headers)
def runnable_status(self): return Task.SKIP_ME def add_those_o_files(self, node): tsk = self.create_task("fake_o", [], node) try: self.compiled_tasks.append(tsk) except AttributeError: self.compiled_tasks = [tsk] taskgen_method(create_compiled_task) taskgen_method(to_incnodes) feature("c", "cxx", "d", "go", "asm", "fc", "includes")(apply_incpaths) after_method("propagate_uselib_vars", "process_source")(apply_incpaths) feature("c", "cxx", "d", "go", "fc", "asm")(apply_link) after_method("process_source")(apply_link) taskgen_method(use_rec) feature("c", "cxx", "d", "use", "fc")(process_use) before_method("apply_incpaths", "propagate_uselib_vars")(process_use) after_method("apply_link", "process_source")(process_use) taskgen_method(add_objects_from_tgen) taskgen_method(get_uselib_vars) feature("c", "cxx", "d", "fc", "javac", "cs", "uselib")(propagate_uselib_vars) after_method("process_use")(propagate_uselib_vars) feature("cshlib", "cxxshlib", "fcshlib")(apply_implib) after_method("apply_link")(apply_implib) feature("cshlib", "cxxshlib", "dshlib", "fcshlib", "vnum")(apply_vnum) after_method("apply_link")(apply_vnum) conf(read_shlib)
self.generator.utest_result=tup testlock.acquire() try: bld=self.generator.bld Logs.debug("ut: %r",tup) try: bld.utest_results.append(tup) except AttributeError: bld.utest_results=[tup] finally: testlock.release() def summary(bld): lst=getattr(bld,'utest_results',[]) if lst: Logs.pprint('CYAN','execution summary') total=len(lst) tfail=len([x for x in lst if x[1]]) Logs.pprint('CYAN',' tests that pass %d/%d'%(total-tfail,total)) for(f,code,out,err)in lst: if not code: Logs.pprint('CYAN',' %s'%f) Logs.pprint('CYAN',' tests that fail %d/%d'%(tfail,total)) for(f,code,out,err)in lst: if code: Logs.pprint('CYAN',' %s'%f) def options(opt): opt.add_option('--alltests',action='store_true',default=False,help='Exec all unit tests',dest='all_tests') feature('test')(make_test) after_method('apply_link')(make_test)
if Options.options.want_rpath: def process_rpath(vars_,coreval): for d in vars_: var=d.upper() value=env['LIBPATH_'+var] if value: core=env[coreval] accu=[] for lib in value: if var!='QTCORE': if lib in core: continue accu.append('-Wl,--rpath='+lib) env['RPATH_'+var]=accu process_rpath(vars,'LIBPATH_QTCORE') process_rpath(vars_debug,'LIBPATH_QTCORE_DEBUG') def options(opt): opt.add_option('--want-rpath',action='store_true',default=False,dest='want_rpath',help='enable the rpath for qt libraries') opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext') for i in'qtdir qtbin qtlibs'.split(): opt.add_option('--'+i,type='string',default='',dest=i) if sys.platform=="darwin": opt.add_option('--no-qt4-framework',action="store_false",help='do not use the framework version of Qt4 in OS X',dest='use_qt4_osxframework',default=True) opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False) extension(*EXT_RCC)(create_rcc_task) extension(*EXT_UI)(create_uic_task) extension('.ts')(add_lang) feature('qt4')(apply_qt4) after_method('apply_link')(apply_qt4) extension(*EXT_QT4)(cxx_hook)
create_plan9c_task(cgo_import) # 6. add some of the gcc tasks to compiled_tasks for task in tg.compiled_tasks: if task.inputs[0].name.endswith('_cgo_main.c'): continue self.compiled_tasks.append(task) # restore the group self.bld.set_group(current_group) decorate( feature('cgo'), before_method('apply_incpaths', 'propagate_uselib_vars'), after_method('apply_link', 'process_source'), process_use, ) decorate( feature('cgo'), after_method('process_use'), propagate_uselib_vars, ) def check_tool_loaded(conf, thetool): for tool in conf.tools: if tool['tool'] == thetool: return True return False
for k in 'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split(): cls = Task.classes.get(k, None) if cls: cls.exec_command = exec_command_msvc cls.exec_response_command = exec_response_command cls.quote_response_command = quote_response_command cls.exec_mf = exec_mf conf(get_msvc_version) conf(gather_wsdk_versions) conf(gather_msvc_targets) conf(gather_wince_targets) conf(gather_msvc_versions) conf(gather_icl_versions) conf(get_msvc_versions) conf(print_all_msvc_detected) conf(detect_msvc) conf(find_lt_names_msvc) conf(libname_msvc) conf(check_lib_msvc) conf(check_libs_msvc) conf(no_autodetect) conf(autodetect) conf(find_msvc) conf(visual_studio_add_flags) conf(msvc_common_flags) after_method('apply_link')(apply_flags_msvc) feature('c', 'cxx')(apply_flags_msvc) feature('cprogram', 'cshlib', 'cxxprogram', 'cxxshlib')(apply_manifest) after_method('apply_link')(apply_manifest)
def options(opt): opt.add_option( "--nopyc", action="store_false", default=1, help="Do not install bytecode compiled .pyc files (configuration) [Default:install]", dest="pyc", ) opt.add_option( "--nopyo", action="store_false", default=1, help="Do not install optimised compiled .pyo files (configuration) [Default:install]", dest="pyo", ) extension(".py")(process_py) feature("py")(feature_py) feature("pyext")(init_pyext) before_method("propagate_uselib_vars", "apply_link")(init_pyext) after_method("apply_bundle")(init_pyext) feature("pyext")(set_bundle) before_method("apply_link", "apply_bundle")(set_bundle) before_method("propagate_uselib_vars")(init_pyembed) feature("pyembed")(init_pyembed) conf(get_python_variables) conf(check_python_headers) conf(check_python_version) conf(check_python_module)
no_nodes.append(x) self.source = no_nodes bintype = getattr(self, 'type', self.gen.endswith('.dll') and 'library' or 'exe') self.cs_task = tsk = self.create_task('fsc', cs_nodes, self.path.find_or_declare(self.gen)) tsk.env.CSTYPE = '/target:%s' % bintype tsk.env.OUT = '/out:%s' % tsk.outputs[0].abspath() inst_to = getattr(self, 'install_path', bintype=='exe' and '${BINDIR}' or '${LIBDIR}') if inst_to: # note: we are making a copy, so the files added to cs_task.outputs won't be installed automatically mod = getattr(self, 'chmod', bintype=='exe' and Utils.O755 or Utils.O644) self.install_task = self.add_install_files(install_to=inst_to, install_from=self.cs_task.outputs[:], chmod=mod) feature('fs')(cs.use_cs) after_method('apply_fsc')(cs.use_cs) feature('fs')(cs.debug_cs) after_method('apply_fsc', 'use_cs')(cs.debug_cs) class fsc(Task.Task): """ Compile F# files """ color = 'YELLOW' run_str = '${FSC} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}' def configure(conf): """ Find a F# compiler, set the variable FSC for the compiler and FS_NAME (mono or fsc) """
return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; ''' class grep_for_endianness(Task.Task): color='PINK' def run(self): txt=self.inputs[0].read(flags='rb').decode('iso8859-1') if txt.find('LiTTleEnDian')>-1: self.generator.tmp.append('little') elif txt.find('BIGenDianSyS')>-1: self.generator.tmp.append('big') else: return-1 def grep_for_endianness_fun(self): self.create_task('grep_for_endianness',self.compiled_tasks[0].outputs[0]) def check_endianness(self): tmp=[] def check_msg(self): return tmp[0] self.check(fragment=ENDIAN_FRAGMENT,features='c grep_for_endianness',msg="Checking for endianness",define='ENDIANNESS',tmp=tmp,okmsg=check_msg) return tmp[0] feature('link_lib_test')(link_lib_test_fun) before_method('process_source')(link_lib_test_fun) conf(check_library) conf(check_inline) conf(check_large_file) feature('grep_for_endianness')(grep_for_endianness_fun) after_method('process_source')(grep_for_endianness_fun) conf(check_endianness)
f=dir.ant_glob('**/(jni|jni_md).h') incDirs=[x.parent.abspath()for x in f] dir=conf.root.find_dir(conf.env.JAVA_HOME[0]) f=dir.ant_glob('**/*jvm.(so|dll|dylib)') libDirs=[x.parent.abspath()for x in f]or[javaHome] f=dir.ant_glob('**/*jvm.(lib)') if f: libDirs=[[x,y.parent.abspath()]for x in libDirs for y in f] for d in libDirs: try: conf.check(header_name='jni.h',define_name='HAVE_JNI_H',lib='jvm',libpath=d,includes=incDirs,uselib_store='JAVA',uselib='JAVA') except: pass else: break else: conf.fatal('could not find lib jvm in %r (see config.log)'%libDirs) feature('javac')(apply_java) before_method('process_source')(apply_java) feature('javac')(use_javac_files) after_method('apply_java')(use_javac_files) feature('javac')(set_classpath) after_method('apply_java','propagate_uselib_vars','use_javac_files')(set_classpath) feature('jar')(jar_files) after_method('apply_java','use_javac_files')(jar_files) before_method('process_source')(jar_files) feature('jar')(use_jar_files) after_method('jar_files')(use_jar_files) conf(check_java_class) conf(check_jni_headers)
) opt.add_option( "--header-ext", type="string", default="", help="header extension for moc files", dest="qt_header_ext" ) for i in "qtdir qtbin qtlibs".split(): opt.add_option("--" + i, type="string", default="", dest=i) if sys.platform == "darwin": opt.add_option( "--no-qt4-framework", action="store_false", help="do not use the framework version of Qt4 in OS X", dest="use_qt4_osxframework", default=True, ) opt.add_option( "--translate", action="store_true", help="collect translation strings", dest="trans_qt4", default=False ) extension(*EXT_RCC)(create_rcc_task) extension(*EXT_UI)(create_uic_task) extension(".ts")(add_lang) feature("qt4")(apply_qt4) after_method("apply_link")(apply_qt4) extension(*EXT_QT4)(cxx_hook) conf(find_qt4_binaries) conf(find_qt4_libraries) conf(simplify_qt4_libs) conf(add_qt4_rpath) conf(set_qt4_libs_to_check)
n1=dir.find_or_declare(['Contents','Info.plist']) plisttask.set_outputs([n1]) plisttask.mac_plist=self.mac_plist plisttask.install_path=os.path.join(self.install_path,name,'Contents') self.plisttask=plisttask def apply_bundle(self): if self.env['MACBUNDLE']or getattr(self,'mac_bundle',False): self.env['LINKFLAGS_cshlib']=self.env['LINKFLAGS_cxxshlib']=[] self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['macbundle_PATTERN'] use=self.use=self.to_list(getattr(self,'use',[])) if not'MACBUNDLE'in use: use.append('MACBUNDLE') app_dirs=['Contents','Contents/MacOS','Contents/Resources'] class macapp(Task.Task): color='PINK' def run(self): shutil.copy2(self.inputs[0].srcpath(),self.outputs[0].abspath()) class macplist(Task.Task): color='PINK' ext_in=['.bin'] def run(self): self.outputs[0].write(self.mac_plist) feature('c','cxx')(set_macosx_deployment_target) taskgen_method(create_bundle_dirs) feature('cprogram','cxxprogram')(create_task_macapp) after_method('apply_link')(create_task_macapp) feature('cprogram','cxxprogram')(create_task_macplist) after_method('apply_link')(create_task_macplist) feature('cshlib','cxxshlib')(apply_bundle) before_method('apply_link','propagate_uselib_vars')(apply_bundle)
try: self.compiled_tasks.append(task) except AttributeError: self.compiled_tasks = [task] def decorate(*args): decorators = args[:-1] func = args[-1] for d in reversed(decorators): func = d(func) decorate( feature('go'), after_method('propagate_uselib_vars', 'process_source'), apply_incpaths, ) decorate( feature('goprogram', 'gopackage'), after_method('process_source'), apply_link, ) ######################################################################## # Configuration ######################################################################## @conf def find_go_command(self):
node=x.find_node(y) if node: node.sig=Utils.h_file(node.abspath()) break else: continue break else: raise Errors.WafError('could not find library %r'%self.name) self.link_task=self.create_task('fake_%s'%self.lib_type,[],[node]) self.target=self.name taskgen_method(create_compiled_task) taskgen_method(to_incnodes) feature('c','cxx','d','go','asm','fc','includes')(apply_incpaths) after_method('propagate_uselib_vars','process_source')(apply_incpaths) feature('c','cxx','d','go','fc','asm')(apply_link) after_method('process_source')(apply_link) taskgen_method(use_rec) feature('c','cxx','d','use','fc')(process_use) before_method('apply_incpaths','propagate_uselib_vars')(process_use) after_method('apply_link','process_source')(process_use) taskgen_method(get_uselib_vars) feature('c','cxx','d','fc','javac','cs','uselib')(propagate_uselib_vars) after_method('process_use')(propagate_uselib_vars) feature('cshlib','cxxshlib')(apply_implib) after_method('apply_link')(apply_implib) feature('cshlib','cxxshlib','dshlib','fcshlib','vnum')(apply_vnum) after_method('apply_link')(apply_vnum) conf(read_shlib) conf(read_stlib)
return ret for k in'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split(): cls=Task.classes.get(k,None) if cls: cls.exec_command=exec_command_msvc cls.exec_response_command=exec_response_command cls.quote_response_command=quote_response_command cls.exec_mf=exec_mf conf(get_msvc_version) conf(gather_wsdk_versions) conf(gather_msvc_targets) conf(gather_wince_targets) conf(gather_msvc_versions) conf(gather_icl_versions) conf(get_msvc_versions) conf(print_all_msvc_detected) conf(detect_msvc) conf(find_lt_names_msvc) conf(libname_msvc) conf(check_lib_msvc) conf(check_libs_msvc) conf(no_autodetect) conf(autodetect) conf(find_msvc) conf(visual_studio_add_flags) conf(msvc_common_flags) after_method('apply_link')(apply_flags_msvc) feature('c','cxx')(apply_flags_msvc) feature('cprogram','cshlib','cxxprogram','cxxshlib')(apply_manifest) after_method('apply_link')(apply_manifest)
conf.env.CS_NAME = 'mono' def options(opt): opt.add_option('--with-csc-binary', type='string', dest='cscbinary') class fake_csshlib(Task.Task): color = 'YELLOW' inst_to = None def runnable_status(self): for x in self.outputs: x.sig = Utils.h_file(x.abspath()) return Task.SKIP_ME def read_csshlib(self, name, paths=[]): return self(name=name, features='fake_lib', lib_paths=paths, lib_type='csshlib') feature('cs')(apply_cs) before_method('process_source')(apply_cs) feature('cs')(use_cs) after_method('apply_cs')(use_cs) feature('cs')(debug_cs) after_method('apply_cs', 'use_cs')(debug_cs) conf(read_csshlib)
tsk.env.OUT = '/out:%s' % tsk.outputs[0].abspath() inst_to = getattr(self, 'install_path', bintype == 'exe' and '${BINDIR}' or '${LIBDIR}') if inst_to: # note: we are making a copy, so the files added to cs_task.outputs won't be installed automatically mod = getattr(self, 'chmod', bintype == 'exe' and Utils.O755 or Utils.O644) self.install_task = self.bld.install_files(inst_to, self.cs_task.outputs[:], env=self.env, chmod=mod) feature('fs')(cs.use_cs) after_method('apply_fsc')(cs.use_cs) feature('fs')(cs.debug_cs) after_method('apply_fsc', 'use_cs')(cs.debug_cs) class fsc(Task.Task): """ Compile F# files """ color = 'YELLOW' run_str = '${FSC} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}' def configure(conf): """
if node: node.sig = Utils.h_file(node.abspath()) break else: continue break else: raise Errors.WafError('could not find library %r' % self.name) self.link_task = self.create_task('fake_%s' % self.lib_type, [], [node]) self.target = self.name taskgen_method(create_compiled_task) taskgen_method(to_incnodes) feature('c', 'cxx', 'd', 'go', 'asm', 'fc', 'includes')(apply_incpaths) after_method('propagate_uselib_vars', 'process_source')(apply_incpaths) feature('c', 'cxx', 'd', 'go', 'fc', 'asm')(apply_link) after_method('process_source')(apply_link) taskgen_method(use_rec) feature('c', 'cxx', 'd', 'use', 'fc')(process_use) before_method('apply_incpaths', 'propagate_uselib_vars')(process_use) after_method('apply_link', 'process_source')(process_use) taskgen_method(get_uselib_vars) feature('c', 'cxx', 'd', 'fc', 'javac', 'cs', 'uselib')(propagate_uselib_vars) after_method('process_use')(propagate_uselib_vars) feature('cshlib', 'cxxshlib')(apply_implib) after_method('apply_link')(apply_implib) feature('cshlib', 'cxxshlib', 'dshlib', 'fcshlib', 'vnum')(apply_vnum) after_method('apply_link')(apply_vnum) conf(read_shlib) conf(read_stlib)
create_plan9c_task(cgo_import) # 6. add some of the gcc tasks to compiled_tasks for task in tg.compiled_tasks: if task.inputs[0].name.endswith("_cgo_main.c"): continue self.compiled_tasks.append(task) # restore the group self.bld.set_group(current_group) decorate( feature("cgo"), before_method("apply_incpaths", "propagate_uselib_vars"), after_method("apply_link", "process_source"), process_use, ) decorate(feature("cgo"), after_method("process_use"), propagate_uselib_vars) def check_tool_loaded(conf, thetool): for tool in conf.tools: if tool["tool"] == thetool: return True return False def configure(conf): # cgo depends on go tool if not check_tool_loaded(conf, "go"):