continue for y in names: 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)
pass def d_hook(self, node): if getattr(self, 'generate_headers', None): task = self.create_compiled_task('d_with_header', node) header_node = node.change_ext(self.env['DHEADER_ext']) task.outputs.append(header_node) else: task = self.create_compiled_task('d', node) return task def generate_header(self, filename, install_path=None): try: self.header_lst.append([filename, install_path]) except AttributeError: self.header_lst = [[filename, install_path]] def process_header(self): for i in getattr(self, 'header_lst', []): node = self.path.find_resource(i[0]) if not node: raise Errors.WafError('file %r not found on d obj' % i[0]) self.create_task('d_header', node, node.change_ext('.di')) extension('.d', '.di', '.D')(d_hook) taskgen_method(generate_header) feature('d')(process_header)
#! /usr/bin/env python # encoding: utf-8 # WARNING! All changes made to this file will be lost! from waflib import Task,Errors from waflib.TaskGen import taskgen_method,before def add_dbus_file(self,filename,prefix,mode): if not hasattr(self,'dbus_lst'): self.dbus_lst=[] if not'process_dbus'in self.meths: self.meths.append('process_dbus') self.dbus_lst.append([filename,prefix,mode]) def process_dbus(self): for filename,prefix,mode in getattr(self,'dbus_lst',[]): node=self.path.find_resource(filename) if not node: raise Errors.WafError('file not found '+filename) tsk=self.create_task('dbus_binding_tool',node,node.change_ext('.h')) tsk.env.DBUS_BINDING_TOOL_PREFIX=prefix tsk.env.DBUS_BINDING_TOOL_MODE=mode class dbus_binding_tool(Task.Task): color='BLUE' ext_out=['.h'] run_str='${DBUS_BINDING_TOOL} --prefix=${DBUS_BINDING_TOOL_PREFIX} --mode=${DBUS_BINDING_TOOL_MODE} --output=${TGT} ${SRC}' shell=True def configure(conf): dbus_binding_tool=conf.find_program('dbus-binding-tool',var='DBUS_BINDING_TOOL') taskgen_method(add_dbus_file) before('apply_core')(process_dbus)
def getstr(varname): return getattr(Options.options, varname, getattr(conf.env, varname, '')) gsettingsschemadir = getstr('GSETTINGSSCHEMADIR') if not gsettingsschemadir: datadir = getstr('DATADIR') if not datadir: prefix = conf.env['PREFIX'] datadir = os.path.join(prefix, 'share') gsettingsschemadir = os.path.join(datadir, 'glib-2.0', 'schemas') conf.env['GSETTINGSSCHEMADIR'] = gsettingsschemadir def options(opt): opt.add_option( '--gsettingsschemadir', help='GSettings schema location [Default: ${datadir}/glib-2.0/schemas]', default='', dest='GSETTINGSSCHEMADIR') taskgen_method(add_marshal_file) before_method('process_source')(process_marshal) taskgen_method(add_enums_from_template) taskgen_method(add_enums) before_method('process_source')(process_enums) taskgen_method(add_settings_schemas) taskgen_method(add_settings_enums) feature('glib2')(process_settings)
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)
class fake_o(Task.Task): 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)
if not x: continue for y in names: 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)
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)
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/svn/docs/wafbook/single.html#_obtaining_the_waf_file from waflib import Task,Errors from waflib.TaskGen import taskgen_method,before_method def add_dbus_file(self,filename,prefix,mode): if not hasattr(self,'dbus_lst'): self.dbus_lst=[] if not'process_dbus'in self.meths: self.meths.append('process_dbus') self.dbus_lst.append([filename,prefix,mode]) def process_dbus(self): for filename,prefix,mode in getattr(self,'dbus_lst',[]): node=self.path.find_resource(filename) if not node: raise Errors.WafError('file not found '+filename) tsk=self.create_task('dbus_binding_tool',node,node.change_ext('.h')) tsk.env.DBUS_BINDING_TOOL_PREFIX=prefix tsk.env.DBUS_BINDING_TOOL_MODE=mode class dbus_binding_tool(Task.Task): color='BLUE' ext_out=['.h'] run_str='${DBUS_BINDING_TOOL} --prefix=${DBUS_BINDING_TOOL_PREFIX} --mode=${DBUS_BINDING_TOOL_MODE} --output=${TGT} ${SRC}' shell=True def configure(conf): dbus_binding_tool=conf.find_program('dbus-binding-tool',var='DBUS_BINDING_TOOL') taskgen_method(add_dbus_file) before_method('apply_core')(process_dbus)
def d_hook(self,node): ext=Utils.destos_to_binfmt(self.env.DEST_OS)=='pe'and'obj'or'o' out='%s.%d.%s'%(node.name,self.idx,ext) def create_compiled_task(self,name,node): task=self.create_task(name,node,node.parent.find_or_declare(out)) try: self.compiled_tasks.append(task) except AttributeError: self.compiled_tasks=[task] return task if getattr(self,'generate_headers',None): tsk=create_compiled_task(self,'d_with_header',node) tsk.outputs.append(node.change_ext(self.env['DHEADER_ext'])) else: tsk=create_compiled_task(self,'d',node) return tsk def generate_header(self,filename,install_path=None): try: self.header_lst.append([filename,install_path]) except AttributeError: self.header_lst=[[filename,install_path]] def process_header(self): for i in getattr(self,'header_lst',[]): node=self.path.find_resource(i[0]) if not node: raise Errors.WafError('file %r not found on d obj'%i[0]) self.create_task('d_header',node,node.change_ext('.di')) extension('.d','.di','.D')(d_hook) taskgen_method(generate_header) feature('d')(process_header)
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 class fake_o(Task.Task): 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)
if not hasattr(self.bld,'_compile_schemas_registered'): self.bld.add_post_fun(compile_schemas_callback) self.bld._compile_schemas_registered=True Task.task_factory('glib_genmarshal',func=genmarshal_func,vars=['GLIB_GENMARSHAL_PREFIX','GLIB_GENMARSHAL'],color='BLUE',ext_out=['.h']) Task.task_factory('glib_mkenums','${GLIB_MKENUMS} ${GLIB_MKENUMS_OPTIONS} ${GLIB_MKENUMS_SOURCE} > ${GLIB_MKENUMS_TARGET}',color='PINK',ext_out=['.h']) Task.task_factory('glib_validate_schema','rm -f ${GLIB_VALIDATE_SCHEMA_OUTPUT} && ${GLIB_COMPILE_SCHEMAS} --dry-run ${GLIB_COMPILE_SCHEMAS_OPTIONS} && touch ${GLIB_VALIDATE_SCHEMA_OUTPUT}',color='PINK') def configure(conf): conf.find_program('glib-genmarshal',var='GLIB_GENMARSHAL') conf.find_perl_program('glib-mkenums',var='GLIB_MKENUMS') conf.find_program('glib-compile-schemas',var='GLIB_COMPILE_SCHEMAS',mandatory=False) def getstr(varname): return getattr(Options.options,varname,getattr(conf.env,varname,'')) gsettingsschemadir=getstr('GSETTINGSSCHEMADIR') if not gsettingsschemadir: datadir=getstr('DATADIR') if not datadir: prefix=conf.env['PREFIX'] datadir=os.path.join(prefix,'share') gsettingsschemadir=os.path.join(datadir,'glib-2.0','schemas') conf.env['GSETTINGSSCHEMADIR']=gsettingsschemadir def options(opt): opt.add_option('--gsettingsschemadir',help='GSettings schema location [Default: ${datadir}/glib-2.0/schemas]',default='',dest='GSETTINGSSCHEMADIR') taskgen_method(add_marshal_file) before('process_source')(process_marshal) taskgen_method(add_enums_from_template) taskgen_method(add_enums) before('process_source')(process_enums) taskgen_method(add_settings_schemas) taskgen_method(add_settings_enums) feature('glib2')(process_settings)