wscript_build 1.2 KB

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