waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

wscript (1403B)


      1 #! /usr/bin/env python
      2 
      3 def configure(conf):
      4 	pass
      5 
      6 def build(bld):
      7 	bld.process(name='foo', version='1.0')
      8 	bld.process(name='bar', use='foo')
      9 
     10 ########################################################################
     11 
     12 # user api
     13 from waflib.Build import BuildContext
     14 def process(ctx, *k, **kw):
     15 	kw['features'] = 'proc'
     16 	return ctx(*k, **kw)
     17 BuildContext.process = process
     18 
     19 # create the tasks
     20 from waflib.TaskGen import feature
     21 @feature('proc')
     22 def create_a_few_tasks(self):
     23 	fetch = self.create_task('process')
     24 	fetch.outputs = [self.path.find_or_declare(self.name + '.fetch')]
     25 	fetch.env.A = getattr(self, 'version', '') # rebuild if changes
     26 	configure = self.create_task('process', fetch.outputs)
     27 	configure.outputs = [self.path.find_or_declare(self.name + '.configure')]
     28 	build = self.create_task('process', configure.outputs)
     29 	build.outputs = [self.path.find_or_declare(self.name + '.build')]
     30 	self.install = install = self.create_task('process', build.outputs)
     31 	install.outputs = [self.path.find_or_declare(self.name + '.install')]
     32 
     33 	if getattr(self, 'use', None):
     34 		lst = self.to_list(self.use)
     35 		for x in lst:
     36 			tg = self.bld.get_tgen_by_name(x)
     37 			fetch.inputs.extend(tg.install.outputs)
     38 
     39 # task classes
     40 from waflib.Task import Task
     41 class process(Task):
     42 	vars = ['A', 'B'] # change env.A to trigger a rebuild...
     43 	def run(self):
     44 		# add your operations here
     45 		self.outputs[0].write('all ok')
     46