wscript_build (1183B)
1 #! /usr/bin/env python 2 3 bld.shlib( 4 #packages = 'gtk+-2.0', 5 features = 'c cshlib', 6 target = 'hello-world', 7 #uselib = 'GTK GLIB', 8 source = 'hello.vala', 9 gir = 'hello-1.0', 10 #gir_path = '/tmp', 11 #vapi_path = '/tmp', 12 pkg_name = 'hello' 13 ) 14 15 16 bld(features = 'c cstlib foreign_generator', # be specific 17 source = '', # no source files 18 target = 'hello-world', # this is for the file name 19 name = 'hello-world-static', # and this is when you want to reuse from wscript files 20 srcgen = 'hello-world', 21 use = 'GTK GLIB', # mandatory here 22 ) 23 24 # --- support code for 'foreign_generator' above --- 25 26 from waflib import TaskGen 27 @TaskGen.feature('foreign_generator') 28 @TaskGen.before('apply_link') 29 def call_me_static(self): 30 for x in self.to_list(getattr(self, 'srcgen')): 31 tg = self.bld.get_tgen_by_name(x) 32 if not tg: 33 self.bld.fatal('No task generator by the name %r' % x) 34 tg.post() # required by "waf clean build --target=hello-world-static" 35 for tsk in tg.tasks: 36 for out in tsk.outputs: 37 if out.name.endswith('.c'): 38 self.create_compiled_task('c', out) 39 if not self.compiled_tasks: 40 self.fatal('No source file for %r? this is unexpected' % self.name)