[0fa325b] | 1 | #! /usr/bin/env python |
---|
| 2 | # encoding: utf-8 |
---|
| 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
---|
| 4 | |
---|
[c101fe1] | 5 | import os,re |
---|
[0fa325b] | 6 | from waflib import Task,Utils,Node,Errors |
---|
| 7 | from waflib.TaskGen import after_method,before_method,feature,taskgen_method,extension |
---|
| 8 | from waflib.Tools import c_aliases,c_preproc,c_config,c_osx,c_tests |
---|
| 9 | from waflib.Configure import conf |
---|
| 10 | SYSTEM_LIB_PATHS=['/usr/lib64','/usr/lib','/usr/local/lib64','/usr/local/lib'] |
---|
| 11 | USELIB_VARS=Utils.defaultdict(set) |
---|
| 12 | USELIB_VARS['c']=set(['INCLUDES','FRAMEWORKPATH','DEFINES','CPPFLAGS','CCDEPS','CFLAGS','ARCH']) |
---|
| 13 | USELIB_VARS['cxx']=set(['INCLUDES','FRAMEWORKPATH','DEFINES','CPPFLAGS','CXXDEPS','CXXFLAGS','ARCH']) |
---|
| 14 | USELIB_VARS['d']=set(['INCLUDES','DFLAGS']) |
---|
| 15 | USELIB_VARS['includes']=set(['INCLUDES','FRAMEWORKPATH','ARCH']) |
---|
| 16 | USELIB_VARS['cprogram']=USELIB_VARS['cxxprogram']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS','FRAMEWORK','FRAMEWORKPATH','ARCH']) |
---|
| 17 | USELIB_VARS['cshlib']=USELIB_VARS['cxxshlib']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS','FRAMEWORK','FRAMEWORKPATH','ARCH']) |
---|
| 18 | USELIB_VARS['cstlib']=USELIB_VARS['cxxstlib']=set(['ARFLAGS','LINKDEPS']) |
---|
| 19 | USELIB_VARS['dprogram']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS']) |
---|
| 20 | USELIB_VARS['dshlib']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS']) |
---|
| 21 | USELIB_VARS['dstlib']=set(['ARFLAGS','LINKDEPS']) |
---|
| 22 | USELIB_VARS['asm']=set(['ASFLAGS']) |
---|
| 23 | @taskgen_method |
---|
| 24 | def create_compiled_task(self,name,node): |
---|
| 25 | out='%s.%d.o'%(node.name,self.idx) |
---|
| 26 | task=self.create_task(name,node,node.parent.find_or_declare(out)) |
---|
| 27 | try: |
---|
| 28 | self.compiled_tasks.append(task) |
---|
| 29 | except AttributeError: |
---|
| 30 | self.compiled_tasks=[task] |
---|
| 31 | return task |
---|
| 32 | @taskgen_method |
---|
| 33 | def to_incnodes(self,inlst): |
---|
| 34 | lst=[] |
---|
| 35 | seen=set([]) |
---|
| 36 | for x in self.to_list(inlst): |
---|
| 37 | if x in seen or not x: |
---|
| 38 | continue |
---|
| 39 | seen.add(x) |
---|
| 40 | if isinstance(x,Node.Node): |
---|
| 41 | lst.append(x) |
---|
| 42 | else: |
---|
| 43 | if os.path.isabs(x): |
---|
| 44 | lst.append(self.bld.root.make_node(x)or x) |
---|
| 45 | else: |
---|
| 46 | if x[0]=='#': |
---|
| 47 | p=self.bld.bldnode.make_node(x[1:]) |
---|
| 48 | v=self.bld.srcnode.make_node(x[1:]) |
---|
| 49 | else: |
---|
| 50 | p=self.path.get_bld().make_node(x) |
---|
| 51 | v=self.path.make_node(x) |
---|
| 52 | if p.is_child_of(self.bld.bldnode): |
---|
| 53 | p.mkdir() |
---|
| 54 | lst.append(p) |
---|
| 55 | lst.append(v) |
---|
| 56 | return lst |
---|
| 57 | @feature('c','cxx','d','asm','fc','includes') |
---|
| 58 | @after_method('propagate_uselib_vars','process_source') |
---|
| 59 | def apply_incpaths(self): |
---|
| 60 | lst=self.to_incnodes(self.to_list(getattr(self,'includes',[]))+self.env['INCLUDES']) |
---|
| 61 | self.includes_nodes=lst |
---|
| 62 | self.env['INCPATHS']=[x.abspath()for x in lst] |
---|
| 63 | class link_task(Task.Task): |
---|
| 64 | color='YELLOW' |
---|
| 65 | inst_to=None |
---|
| 66 | chmod=Utils.O755 |
---|
| 67 | def add_target(self,target): |
---|
| 68 | if isinstance(target,str): |
---|
| 69 | pattern=self.env[self.__class__.__name__+'_PATTERN'] |
---|
| 70 | if not pattern: |
---|
| 71 | pattern='%s' |
---|
| 72 | folder,name=os.path.split(target) |
---|
[c101fe1] | 73 | if self.__class__.__name__.find('shlib')>0 and getattr(self.generator,'vnum',None): |
---|
| 74 | nums=self.generator.vnum.split('.') |
---|
| 75 | if self.env.DEST_BINFMT=='pe': |
---|
| 76 | name=name+'-'+nums[0] |
---|
| 77 | elif self.env.DEST_OS=='openbsd': |
---|
[904702d] | 78 | pattern='%s.%s'%(pattern,nums[0]) |
---|
| 79 | if len(nums)>=2: |
---|
| 80 | pattern+='.%s'%nums[1] |
---|
[0fa325b] | 81 | tmp=folder+os.sep+pattern%name |
---|
| 82 | target=self.generator.path.find_or_declare(tmp) |
---|
| 83 | self.set_outputs(target) |
---|
| 84 | class stlink_task(link_task): |
---|
| 85 | run_str='${AR} ${ARFLAGS} ${AR_TGT_F}${TGT} ${AR_SRC_F}${SRC}' |
---|
[904702d] | 86 | chmod=Utils.O644 |
---|
[0fa325b] | 87 | def rm_tgt(cls): |
---|
| 88 | old=cls.run |
---|
| 89 | def wrap(self): |
---|
| 90 | try:os.remove(self.outputs[0].abspath()) |
---|
| 91 | except OSError:pass |
---|
| 92 | return old(self) |
---|
| 93 | setattr(cls,'run',wrap) |
---|
| 94 | rm_tgt(stlink_task) |
---|
| 95 | @feature('c','cxx','d','fc','asm') |
---|
| 96 | @after_method('process_source') |
---|
| 97 | def apply_link(self): |
---|
| 98 | for x in self.features: |
---|
| 99 | if x=='cprogram'and'cxx'in self.features: |
---|
| 100 | x='cxxprogram' |
---|
| 101 | elif x=='cshlib'and'cxx'in self.features: |
---|
| 102 | x='cxxshlib' |
---|
| 103 | if x in Task.classes: |
---|
| 104 | if issubclass(Task.classes[x],link_task): |
---|
| 105 | link=x |
---|
| 106 | break |
---|
| 107 | else: |
---|
| 108 | return |
---|
| 109 | objs=[t.outputs[0]for t in getattr(self,'compiled_tasks',[])] |
---|
| 110 | self.link_task=self.create_task(link,objs) |
---|
| 111 | self.link_task.add_target(self.target) |
---|
| 112 | try: |
---|
| 113 | inst_to=self.install_path |
---|
| 114 | except AttributeError: |
---|
| 115 | inst_to=self.link_task.__class__.inst_to |
---|
| 116 | if inst_to: |
---|
[904702d] | 117 | self.install_task=self.bld.install_files(inst_to,self.link_task.outputs[:],env=self.env,chmod=self.link_task.chmod,task=self.link_task) |
---|
[0fa325b] | 118 | @taskgen_method |
---|
| 119 | def use_rec(self,name,**kw): |
---|
| 120 | if name in self.tmp_use_not or name in self.tmp_use_seen: |
---|
| 121 | return |
---|
| 122 | try: |
---|
| 123 | y=self.bld.get_tgen_by_name(name) |
---|
| 124 | except Errors.WafError: |
---|
| 125 | self.uselib.append(name) |
---|
| 126 | self.tmp_use_not.add(name) |
---|
| 127 | return |
---|
| 128 | self.tmp_use_seen.append(name) |
---|
| 129 | y.post() |
---|
| 130 | y.tmp_use_objects=objects=kw.get('objects',True) |
---|
| 131 | y.tmp_use_stlib=stlib=kw.get('stlib',True) |
---|
| 132 | try: |
---|
| 133 | link_task=y.link_task |
---|
| 134 | except AttributeError: |
---|
| 135 | y.tmp_use_var='' |
---|
| 136 | else: |
---|
| 137 | objects=False |
---|
| 138 | if not isinstance(link_task,stlink_task): |
---|
| 139 | stlib=False |
---|
| 140 | y.tmp_use_var='LIB' |
---|
| 141 | else: |
---|
| 142 | y.tmp_use_var='STLIB' |
---|
| 143 | p=self.tmp_use_prec |
---|
| 144 | for x in self.to_list(getattr(y,'use',[])): |
---|
[904702d] | 145 | if self.env["STLIB_"+x]: |
---|
| 146 | continue |
---|
[0fa325b] | 147 | try: |
---|
| 148 | p[x].append(name) |
---|
| 149 | except KeyError: |
---|
| 150 | p[x]=[name] |
---|
| 151 | self.use_rec(x,objects=objects,stlib=stlib) |
---|
| 152 | @feature('c','cxx','d','use','fc') |
---|
| 153 | @before_method('apply_incpaths','propagate_uselib_vars') |
---|
| 154 | @after_method('apply_link','process_source') |
---|
| 155 | def process_use(self): |
---|
| 156 | use_not=self.tmp_use_not=set([]) |
---|
| 157 | self.tmp_use_seen=[] |
---|
| 158 | use_prec=self.tmp_use_prec={} |
---|
| 159 | self.uselib=self.to_list(getattr(self,'uselib',[])) |
---|
| 160 | self.includes=self.to_list(getattr(self,'includes',[])) |
---|
| 161 | names=self.to_list(getattr(self,'use',[])) |
---|
| 162 | for x in names: |
---|
| 163 | self.use_rec(x) |
---|
| 164 | for x in use_not: |
---|
| 165 | if x in use_prec: |
---|
| 166 | del use_prec[x] |
---|
| 167 | out=[] |
---|
| 168 | tmp=[] |
---|
| 169 | for x in self.tmp_use_seen: |
---|
| 170 | for k in use_prec.values(): |
---|
| 171 | if x in k: |
---|
| 172 | break |
---|
| 173 | else: |
---|
| 174 | tmp.append(x) |
---|
| 175 | while tmp: |
---|
| 176 | e=tmp.pop() |
---|
| 177 | out.append(e) |
---|
| 178 | try: |
---|
| 179 | nlst=use_prec[e] |
---|
| 180 | except KeyError: |
---|
| 181 | pass |
---|
| 182 | else: |
---|
| 183 | del use_prec[e] |
---|
| 184 | for x in nlst: |
---|
| 185 | for y in use_prec: |
---|
| 186 | if x in use_prec[y]: |
---|
| 187 | break |
---|
| 188 | else: |
---|
| 189 | tmp.append(x) |
---|
| 190 | if use_prec: |
---|
| 191 | raise Errors.WafError('Cycle detected in the use processing %r'%use_prec) |
---|
| 192 | out.reverse() |
---|
| 193 | link_task=getattr(self,'link_task',None) |
---|
| 194 | for x in out: |
---|
| 195 | y=self.bld.get_tgen_by_name(x) |
---|
| 196 | var=y.tmp_use_var |
---|
| 197 | if var and link_task: |
---|
[904702d] | 198 | if var=='LIB'or y.tmp_use_stlib or x in names: |
---|
[0fa325b] | 199 | self.env.append_value(var,[y.target[y.target.rfind(os.sep)+1:]]) |
---|
| 200 | self.link_task.dep_nodes.extend(y.link_task.outputs) |
---|
| 201 | tmp_path=y.link_task.outputs[0].parent.path_from(self.bld.bldnode) |
---|
[904702d] | 202 | self.env.append_unique(var+'PATH',[tmp_path]) |
---|
[0fa325b] | 203 | else: |
---|
| 204 | if y.tmp_use_objects: |
---|
| 205 | self.add_objects_from_tgen(y) |
---|
| 206 | if getattr(y,'export_includes',None): |
---|
| 207 | self.includes.extend(y.to_incnodes(y.export_includes)) |
---|
[c101fe1] | 208 | if getattr(y,'export_defines',None): |
---|
| 209 | self.env.append_value('DEFINES',self.to_list(y.export_defines)) |
---|
[0fa325b] | 210 | for x in names: |
---|
| 211 | try: |
---|
| 212 | y=self.bld.get_tgen_by_name(x) |
---|
[904702d] | 213 | except Errors.WafError: |
---|
[0fa325b] | 214 | if not self.env['STLIB_'+x]and not x in self.uselib: |
---|
| 215 | self.uselib.append(x) |
---|
| 216 | else: |
---|
[904702d] | 217 | for k in self.to_list(getattr(y,'use',[])): |
---|
[0fa325b] | 218 | if not self.env['STLIB_'+k]and not k in self.uselib: |
---|
| 219 | self.uselib.append(k) |
---|
| 220 | @taskgen_method |
---|
| 221 | def accept_node_to_link(self,node): |
---|
| 222 | return not node.name.endswith('.pdb') |
---|
| 223 | @taskgen_method |
---|
| 224 | def add_objects_from_tgen(self,tg): |
---|
| 225 | try: |
---|
| 226 | link_task=self.link_task |
---|
| 227 | except AttributeError: |
---|
| 228 | pass |
---|
| 229 | else: |
---|
| 230 | for tsk in getattr(tg,'compiled_tasks',[]): |
---|
| 231 | for x in tsk.outputs: |
---|
| 232 | if self.accept_node_to_link(x): |
---|
| 233 | link_task.inputs.append(x) |
---|
| 234 | @taskgen_method |
---|
| 235 | def get_uselib_vars(self): |
---|
| 236 | _vars=set([]) |
---|
| 237 | for x in self.features: |
---|
| 238 | if x in USELIB_VARS: |
---|
| 239 | _vars|=USELIB_VARS[x] |
---|
| 240 | return _vars |
---|
| 241 | @feature('c','cxx','d','fc','javac','cs','uselib','asm') |
---|
| 242 | @after_method('process_use') |
---|
| 243 | def propagate_uselib_vars(self): |
---|
| 244 | _vars=self.get_uselib_vars() |
---|
| 245 | env=self.env |
---|
[904702d] | 246 | app=env.append_value |
---|
| 247 | feature_uselib=self.features+self.to_list(getattr(self,'uselib',[])) |
---|
| 248 | for var in _vars: |
---|
| 249 | y=var.lower() |
---|
| 250 | val=getattr(self,y,[]) |
---|
| 251 | if val: |
---|
| 252 | app(var,self.to_list(val)) |
---|
| 253 | for x in feature_uselib: |
---|
| 254 | val=env['%s_%s'%(var,x)] |
---|
| 255 | if val: |
---|
| 256 | app(var,val) |
---|
[0fa325b] | 257 | @feature('cshlib','cxxshlib','fcshlib') |
---|
| 258 | @after_method('apply_link') |
---|
| 259 | def apply_implib(self): |
---|
| 260 | if not self.env.DEST_BINFMT=='pe': |
---|
| 261 | return |
---|
| 262 | dll=self.link_task.outputs[0] |
---|
| 263 | if isinstance(self.target,Node.Node): |
---|
| 264 | name=self.target.name |
---|
| 265 | else: |
---|
| 266 | name=os.path.split(self.target)[1] |
---|
| 267 | implib=self.env['implib_PATTERN']%name |
---|
| 268 | implib=dll.parent.find_or_declare(implib) |
---|
| 269 | self.env.append_value('LINKFLAGS',self.env['IMPLIB_ST']%implib.bldpath()) |
---|
| 270 | self.link_task.outputs.append(implib) |
---|
| 271 | if getattr(self,'defs',None)and self.env.DEST_BINFMT=='pe': |
---|
| 272 | node=self.path.find_resource(self.defs) |
---|
| 273 | if not node: |
---|
| 274 | raise Errors.WafError('invalid def file %r'%self.defs) |
---|
| 275 | if'msvc'in(self.env.CC_NAME,self.env.CXX_NAME): |
---|
| 276 | self.env.append_value('LINKFLAGS','/def:%s'%node.path_from(self.bld.bldnode)) |
---|
| 277 | self.link_task.dep_nodes.append(node) |
---|
| 278 | else: |
---|
| 279 | self.link_task.inputs.append(node) |
---|
[904702d] | 280 | if getattr(self,'install_task',None): |
---|
| 281 | try: |
---|
| 282 | inst_to=self.install_path_implib |
---|
| 283 | except AttributeError: |
---|
| 284 | try: |
---|
| 285 | inst_to=self.install_path |
---|
| 286 | except AttributeError: |
---|
| 287 | inst_to='${IMPLIBDIR}' |
---|
| 288 | self.install_task.dest='${BINDIR}' |
---|
| 289 | if not self.env.IMPLIBDIR: |
---|
| 290 | self.env.IMPLIBDIR=self.env.LIBDIR |
---|
| 291 | self.implib_install_task=self.bld.install_files(inst_to,implib,env=self.env,chmod=self.link_task.chmod,task=self.link_task) |
---|
| 292 | re_vnum=re.compile('^([1-9]\\d*|0)([.]([1-9]\\d*|0)[.]([1-9]\\d*|0))?$') |
---|
[0fa325b] | 293 | @feature('cshlib','cxxshlib','dshlib','fcshlib','vnum') |
---|
| 294 | @after_method('apply_link','propagate_uselib_vars') |
---|
| 295 | def apply_vnum(self): |
---|
| 296 | if not getattr(self,'vnum','')or os.name!='posix'or self.env.DEST_BINFMT not in('elf','mac-o'): |
---|
| 297 | return |
---|
| 298 | link=self.link_task |
---|
[c101fe1] | 299 | if not re_vnum.match(self.vnum): |
---|
| 300 | raise Errors.WafError('Invalid version %r for %r'%(self.vnum,self)) |
---|
[0fa325b] | 301 | nums=self.vnum.split('.') |
---|
| 302 | node=link.outputs[0] |
---|
| 303 | libname=node.name |
---|
| 304 | if libname.endswith('.dylib'): |
---|
| 305 | name3=libname.replace('.dylib','.%s.dylib'%self.vnum) |
---|
| 306 | name2=libname.replace('.dylib','.%s.dylib'%nums[0]) |
---|
| 307 | else: |
---|
| 308 | name3=libname+'.'+self.vnum |
---|
| 309 | name2=libname+'.'+nums[0] |
---|
| 310 | if self.env.SONAME_ST: |
---|
| 311 | v=self.env.SONAME_ST%name2 |
---|
| 312 | self.env.append_value('LINKFLAGS',v.split()) |
---|
[c101fe1] | 313 | if self.env.DEST_OS!='openbsd': |
---|
[904702d] | 314 | outs=[node.parent.find_or_declare(name3)] |
---|
| 315 | if name2!=name3: |
---|
| 316 | outs.append(node.parent.find_or_declare(name2)) |
---|
| 317 | self.create_task('vnum',node,outs) |
---|
[0fa325b] | 318 | if getattr(self,'install_task',None): |
---|
| 319 | self.install_task.hasrun=Task.SKIP_ME |
---|
| 320 | bld=self.bld |
---|
| 321 | path=self.install_task.dest |
---|
[c101fe1] | 322 | if self.env.DEST_OS=='openbsd': |
---|
| 323 | libname=self.link_task.outputs[0].name |
---|
| 324 | t1=bld.install_as('%s%s%s'%(path,os.sep,libname),node,env=self.env,chmod=self.link_task.chmod) |
---|
| 325 | self.vnum_install_task=(t1,) |
---|
| 326 | else: |
---|
| 327 | t1=bld.install_as(path+os.sep+name3,node,env=self.env,chmod=self.link_task.chmod) |
---|
| 328 | t3=bld.symlink_as(path+os.sep+libname,name3) |
---|
[904702d] | 329 | if name2!=name3: |
---|
| 330 | t2=bld.symlink_as(path+os.sep+name2,name3) |
---|
| 331 | self.vnum_install_task=(t1,t2,t3) |
---|
| 332 | else: |
---|
| 333 | self.vnum_install_task=(t1,t3) |
---|
[0fa325b] | 334 | if'-dynamiclib'in self.env['LINKFLAGS']: |
---|
| 335 | try: |
---|
| 336 | inst_to=self.install_path |
---|
| 337 | except AttributeError: |
---|
| 338 | inst_to=self.link_task.__class__.inst_to |
---|
| 339 | if inst_to: |
---|
| 340 | p=Utils.subst_vars(inst_to,self.env) |
---|
| 341 | path=os.path.join(p,self.link_task.outputs[0].name) |
---|
| 342 | self.env.append_value('LINKFLAGS',['-install_name',path]) |
---|
| 343 | class vnum(Task.Task): |
---|
| 344 | color='CYAN' |
---|
| 345 | quient=True |
---|
| 346 | ext_in=['.bin'] |
---|
[904702d] | 347 | def keyword(self): |
---|
| 348 | return'Symlinking' |
---|
[0fa325b] | 349 | def run(self): |
---|
| 350 | for x in self.outputs: |
---|
| 351 | path=x.abspath() |
---|
| 352 | try: |
---|
| 353 | os.remove(path) |
---|
| 354 | except OSError: |
---|
| 355 | pass |
---|
| 356 | try: |
---|
| 357 | os.symlink(self.inputs[0].name,path) |
---|
| 358 | except OSError: |
---|
| 359 | return 1 |
---|
| 360 | class fake_shlib(link_task): |
---|
| 361 | def runnable_status(self): |
---|
| 362 | for t in self.run_after: |
---|
| 363 | if not t.hasrun: |
---|
| 364 | return Task.ASK_LATER |
---|
| 365 | for x in self.outputs: |
---|
| 366 | x.sig=Utils.h_file(x.abspath()) |
---|
| 367 | return Task.SKIP_ME |
---|
| 368 | class fake_stlib(stlink_task): |
---|
| 369 | def runnable_status(self): |
---|
| 370 | for t in self.run_after: |
---|
| 371 | if not t.hasrun: |
---|
| 372 | return Task.ASK_LATER |
---|
| 373 | for x in self.outputs: |
---|
| 374 | x.sig=Utils.h_file(x.abspath()) |
---|
| 375 | return Task.SKIP_ME |
---|
| 376 | @conf |
---|
[c101fe1] | 377 | def read_shlib(self,name,paths=[],export_includes=[],export_defines=[]): |
---|
| 378 | return self(name=name,features='fake_lib',lib_paths=paths,lib_type='shlib',export_includes=export_includes,export_defines=export_defines) |
---|
[0fa325b] | 379 | @conf |
---|
[c101fe1] | 380 | def read_stlib(self,name,paths=[],export_includes=[],export_defines=[]): |
---|
| 381 | return self(name=name,features='fake_lib',lib_paths=paths,lib_type='stlib',export_includes=export_includes,export_defines=export_defines) |
---|
[0fa325b] | 382 | lib_patterns={'shlib':['lib%s.so','%s.so','lib%s.dylib','lib%s.dll','%s.dll'],'stlib':['lib%s.a','%s.a','lib%s.dll','%s.dll','lib%s.lib','%s.lib'],} |
---|
| 383 | @feature('fake_lib') |
---|
| 384 | def process_lib(self): |
---|
| 385 | node=None |
---|
| 386 | names=[x%self.name for x in lib_patterns[self.lib_type]] |
---|
| 387 | for x in self.lib_paths+[self.path]+SYSTEM_LIB_PATHS: |
---|
| 388 | if not isinstance(x,Node.Node): |
---|
| 389 | x=self.bld.root.find_node(x)or self.path.find_node(x) |
---|
| 390 | if not x: |
---|
| 391 | continue |
---|
| 392 | for y in names: |
---|
| 393 | node=x.find_node(y) |
---|
| 394 | if node: |
---|
| 395 | node.sig=Utils.h_file(node.abspath()) |
---|
| 396 | break |
---|
| 397 | else: |
---|
| 398 | continue |
---|
| 399 | break |
---|
| 400 | else: |
---|
| 401 | raise Errors.WafError('could not find library %r'%self.name) |
---|
| 402 | self.link_task=self.create_task('fake_%s'%self.lib_type,[],[node]) |
---|
| 403 | self.target=self.name |
---|
| 404 | class fake_o(Task.Task): |
---|
| 405 | def runnable_status(self): |
---|
| 406 | return Task.SKIP_ME |
---|
| 407 | @extension('.o','.obj') |
---|
| 408 | def add_those_o_files(self,node): |
---|
| 409 | tsk=self.create_task('fake_o',[],node) |
---|
| 410 | try: |
---|
| 411 | self.compiled_tasks.append(tsk) |
---|
| 412 | except AttributeError: |
---|
| 413 | self.compiled_tasks=[tsk] |
---|
| 414 | @feature('fake_obj') |
---|
| 415 | @before_method('process_source') |
---|
| 416 | def process_objs(self): |
---|
| 417 | for node in self.to_nodes(self.source): |
---|
| 418 | self.add_those_o_files(node) |
---|
| 419 | self.source=[] |
---|
| 420 | @conf |
---|
| 421 | def read_object(self,obj): |
---|
| 422 | if not isinstance(obj,self.path.__class__): |
---|
| 423 | obj=self.path.find_resource(obj) |
---|
| 424 | return self(features='fake_obj',source=obj,name=obj.name) |
---|