[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 | |
---|
| 5 | import sys |
---|
| 6 | from waflib import ConfigSet,Logs,Options,Scripting,Task,Build,Configure,Node,Runner,TaskGen,Utils,Errors,Context |
---|
| 7 | sys.modules['Environment']=ConfigSet |
---|
| 8 | ConfigSet.Environment=ConfigSet.ConfigSet |
---|
| 9 | sys.modules['Logs']=Logs |
---|
| 10 | sys.modules['Options']=Options |
---|
| 11 | sys.modules['Scripting']=Scripting |
---|
| 12 | sys.modules['Task']=Task |
---|
| 13 | sys.modules['Build']=Build |
---|
| 14 | sys.modules['Configure']=Configure |
---|
| 15 | sys.modules['Node']=Node |
---|
| 16 | sys.modules['Runner']=Runner |
---|
| 17 | sys.modules['TaskGen']=TaskGen |
---|
| 18 | sys.modules['Utils']=Utils |
---|
| 19 | from waflib.Tools import c_preproc |
---|
| 20 | sys.modules['preproc']=c_preproc |
---|
| 21 | from waflib.Tools import c_config |
---|
| 22 | sys.modules['config_c']=c_config |
---|
| 23 | ConfigSet.ConfigSet.copy=ConfigSet.ConfigSet.derive |
---|
| 24 | ConfigSet.ConfigSet.set_variant=Utils.nada |
---|
| 25 | Build.BuildContext.add_subdirs=Build.BuildContext.recurse |
---|
| 26 | Build.BuildContext.new_task_gen=Build.BuildContext.__call__ |
---|
| 27 | Build.BuildContext.is_install=0 |
---|
| 28 | Node.Node.relpath_gen=Node.Node.path_from |
---|
| 29 | def name_to_obj(self,s,env=None): |
---|
| 30 | Logs.warn('compat: change "name_to_obj(name, env)" by "get_tgen_by_name(name)"') |
---|
| 31 | return self.get_tgen_by_name(s) |
---|
| 32 | Build.BuildContext.name_to_obj=name_to_obj |
---|
| 33 | def env_of_name(self,name): |
---|
| 34 | try: |
---|
| 35 | return self.all_envs[name] |
---|
| 36 | except KeyError: |
---|
| 37 | Logs.error('no such environment: '+name) |
---|
| 38 | return None |
---|
| 39 | Build.BuildContext.env_of_name=env_of_name |
---|
| 40 | def set_env_name(self,name,env): |
---|
| 41 | self.all_envs[name]=env |
---|
| 42 | return env |
---|
| 43 | Configure.ConfigurationContext.set_env_name=set_env_name |
---|
| 44 | def retrieve(self,name,fromenv=None): |
---|
| 45 | try: |
---|
| 46 | env=self.all_envs[name] |
---|
| 47 | except KeyError: |
---|
| 48 | env=ConfigSet.ConfigSet() |
---|
| 49 | self.prepare_env(env) |
---|
| 50 | self.all_envs[name]=env |
---|
| 51 | else: |
---|
| 52 | if fromenv:Logs.warn("The environment %s may have been configured already"%name) |
---|
| 53 | return env |
---|
| 54 | Configure.ConfigurationContext.retrieve=retrieve |
---|
| 55 | Configure.ConfigurationContext.sub_config=Configure.ConfigurationContext.recurse |
---|
| 56 | Configure.ConfigurationContext.check_tool=Configure.ConfigurationContext.load |
---|
| 57 | Configure.conftest=Configure.conf |
---|
| 58 | Configure.ConfigurationError=Errors.ConfigurationError |
---|
| 59 | Options.OptionsContext.sub_options=Options.OptionsContext.recurse |
---|
| 60 | Options.OptionsContext.tool_options=Context.Context.load |
---|
| 61 | Options.Handler=Options.OptionsContext |
---|
| 62 | Task.simple_task_type=Task.task_type_from_func=Task.task_factory |
---|
| 63 | Task.TaskBase.classes=Task.classes |
---|
| 64 | def setitem(self,key,value): |
---|
| 65 | if key.startswith('CCFLAGS'): |
---|
| 66 | key=key[1:] |
---|
| 67 | self.table[key]=value |
---|
| 68 | ConfigSet.ConfigSet.__setitem__=setitem |
---|
| 69 | @TaskGen.feature('d') |
---|
| 70 | @TaskGen.before('apply_incpaths') |
---|
| 71 | def old_importpaths(self): |
---|
| 72 | if getattr(self,'importpaths',[]): |
---|
| 73 | self.includes=self.importpaths |
---|
| 74 | from waflib import Context |
---|
| 75 | eld=Context.load_tool |
---|
| 76 | def load_tool(*k,**kw): |
---|
| 77 | ret=eld(*k,**kw) |
---|
| 78 | if'set_options'in ret.__dict__: |
---|
| 79 | Logs.warn('compat: rename "set_options" to options') |
---|
| 80 | ret.options=ret.set_options |
---|
| 81 | if'detect'in ret.__dict__: |
---|
| 82 | Logs.warn('compat: rename "detect" to "configure"') |
---|
| 83 | ret.configure=ret.detect |
---|
| 84 | return ret |
---|
| 85 | Context.load_tool=load_tool |
---|
| 86 | rev=Context.load_module |
---|
| 87 | def load_module(path): |
---|
| 88 | ret=rev(path) |
---|
| 89 | if'set_options'in ret.__dict__: |
---|
| 90 | Logs.warn('compat: rename "set_options" to "options" (%r)'%path) |
---|
| 91 | ret.options=ret.set_options |
---|
| 92 | if'srcdir'in ret.__dict__: |
---|
| 93 | Logs.warn('compat: rename "srcdir" to "top" (%r)'%path) |
---|
| 94 | ret.top=ret.srcdir |
---|
| 95 | if'blddir'in ret.__dict__: |
---|
| 96 | Logs.warn('compat: rename "blddir" to "out" (%r)'%path) |
---|
| 97 | ret.out=ret.blddir |
---|
| 98 | return ret |
---|
| 99 | Context.load_module=load_module |
---|
| 100 | old_post=TaskGen.task_gen.post |
---|
| 101 | def post(self): |
---|
| 102 | self.features=self.to_list(self.features) |
---|
| 103 | if'cc'in self.features: |
---|
| 104 | Logs.warn('compat: the feature cc does not exist anymore (use "c")') |
---|
| 105 | self.features.remove('cc') |
---|
| 106 | self.features.append('c') |
---|
| 107 | if'cstaticlib'in self.features: |
---|
| 108 | Logs.warn('compat: the feature cstaticlib does not exist anymore (use "cstlib" or "cxxstlib")') |
---|
| 109 | self.features.remove('cstaticlib') |
---|
| 110 | self.features.append(('cxx'in self.features)and'cxxstlib'or'cstlib') |
---|
| 111 | if getattr(self,'ccflags',None): |
---|
| 112 | Logs.warn('compat: "ccflags" was renamed to "cflags"') |
---|
| 113 | self.cflags=self.ccflags |
---|
| 114 | return old_post(self) |
---|
| 115 | TaskGen.task_gen.post=post |
---|
| 116 | def waf_version(*k,**kw): |
---|
| 117 | Logs.warn('wrong version (waf_version was removed in waf 1.6)') |
---|
| 118 | Utils.waf_version=waf_version |
---|
| 119 | import os |
---|
| 120 | @TaskGen.feature('c','cxx','d') |
---|
| 121 | @TaskGen.before('apply_incpaths','propagate_uselib_vars') |
---|
| 122 | @TaskGen.after('apply_link','process_source') |
---|
| 123 | def apply_uselib_local(self): |
---|
| 124 | env=self.env |
---|
| 125 | from waflib.Tools.ccroot import stlink_task |
---|
| 126 | self.uselib=self.to_list(getattr(self,'uselib',[])) |
---|
| 127 | self.includes=self.to_list(getattr(self,'includes',[])) |
---|
| 128 | names=self.to_list(getattr(self,'uselib_local',[])) |
---|
| 129 | get=self.bld.get_tgen_by_name |
---|
| 130 | seen=set([]) |
---|
| 131 | tmp=Utils.deque(names) |
---|
| 132 | if tmp: |
---|
| 133 | Logs.warn('compat: "uselib_local" is deprecated, replace by "use"') |
---|
| 134 | while tmp: |
---|
| 135 | lib_name=tmp.popleft() |
---|
| 136 | if lib_name in seen: |
---|
| 137 | continue |
---|
| 138 | y=get(lib_name) |
---|
| 139 | y.post() |
---|
| 140 | seen.add(lib_name) |
---|
| 141 | if getattr(y,'uselib_local',None): |
---|
| 142 | for x in self.to_list(getattr(y,'uselib_local',[])): |
---|
| 143 | obj=get(x) |
---|
| 144 | obj.post() |
---|
| 145 | if getattr(obj,'link_task',None): |
---|
| 146 | if not isinstance(obj.link_task,stlink_task): |
---|
| 147 | tmp.append(x) |
---|
| 148 | if getattr(y,'link_task',None): |
---|
| 149 | link_name=y.target[y.target.rfind(os.sep)+1:] |
---|
| 150 | if isinstance(y.link_task,stlink_task): |
---|
| 151 | env.append_value('STLIB',[link_name]) |
---|
| 152 | else: |
---|
| 153 | env.append_value('LIB',[link_name]) |
---|
| 154 | self.link_task.set_run_after(y.link_task) |
---|
| 155 | self.link_task.dep_nodes+=y.link_task.outputs |
---|
| 156 | tmp_path=y.link_task.outputs[0].parent.bldpath() |
---|
| 157 | if not tmp_path in env['LIBPATH']: |
---|
| 158 | env.prepend_value('LIBPATH',[tmp_path]) |
---|
| 159 | for v in self.to_list(getattr(y,'uselib',[])): |
---|
| 160 | if not env['STLIB_'+v]: |
---|
| 161 | if not v in self.uselib: |
---|
| 162 | self.uselib.insert(0,v) |
---|
| 163 | if getattr(y,'export_includes',None): |
---|
| 164 | self.includes.extend(y.to_incnodes(y.export_includes)) |
---|
| 165 | @TaskGen.feature('cprogram','cxxprogram','cstlib','cxxstlib','cshlib','cxxshlib','dprogram','dstlib','dshlib') |
---|
| 166 | @TaskGen.after('apply_link') |
---|
| 167 | def apply_objdeps(self): |
---|
| 168 | names=getattr(self,'add_objects',[]) |
---|
| 169 | if not names: |
---|
| 170 | return |
---|
| 171 | names=self.to_list(names) |
---|
| 172 | get=self.bld.get_tgen_by_name |
---|
| 173 | seen=[] |
---|
| 174 | while names: |
---|
| 175 | x=names[0] |
---|
| 176 | if x in seen: |
---|
| 177 | names=names[1:] |
---|
| 178 | continue |
---|
| 179 | y=get(x) |
---|
| 180 | if getattr(y,'add_objects',None): |
---|
| 181 | added=0 |
---|
| 182 | lst=y.to_list(y.add_objects) |
---|
| 183 | lst.reverse() |
---|
| 184 | for u in lst: |
---|
| 185 | if u in seen:continue |
---|
| 186 | added=1 |
---|
| 187 | names=[u]+names |
---|
| 188 | if added:continue |
---|
| 189 | y.post() |
---|
| 190 | seen.append(x) |
---|
| 191 | for t in getattr(y,'compiled_tasks',[]): |
---|
| 192 | self.link_task.inputs.extend(t.outputs) |
---|
| 193 | @TaskGen.after('apply_link') |
---|
| 194 | def process_obj_files(self): |
---|
| 195 | if not hasattr(self,'obj_files'): |
---|
| 196 | return |
---|
| 197 | for x in self.obj_files: |
---|
| 198 | node=self.path.find_resource(x) |
---|
| 199 | self.link_task.inputs.append(node) |
---|
| 200 | @TaskGen.taskgen_method |
---|
| 201 | def add_obj_file(self,file): |
---|
| 202 | if not hasattr(self,'obj_files'):self.obj_files=[] |
---|
| 203 | if not'process_obj_files'in self.meths:self.meths.append('process_obj_files') |
---|
| 204 | self.obj_files.append(file) |
---|
| 205 | old_define=Configure.ConfigurationContext.__dict__['define'] |
---|
| 206 | @Configure.conf |
---|
| 207 | def define(self,key,val,quote=True): |
---|
| 208 | old_define(self,key,val,quote) |
---|
| 209 | if key.startswith('HAVE_'): |
---|
| 210 | self.env[key]=1 |
---|
| 211 | old_undefine=Configure.ConfigurationContext.__dict__['undefine'] |
---|
| 212 | @Configure.conf |
---|
| 213 | def undefine(self,key): |
---|
| 214 | old_undefine(self,key) |
---|
| 215 | if key.startswith('HAVE_'): |
---|
| 216 | self.env[key]=0 |
---|
| 217 | def set_incdirs(self,val): |
---|
| 218 | Logs.warn('compat: change "export_incdirs" by "export_includes"') |
---|
| 219 | self.export_includes=val |
---|
| 220 | TaskGen.task_gen.export_incdirs=property(None,set_incdirs) |
---|