wscript 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. """
  4. waf configure_all build_all
  5. """
  6. VERSION='1.0.0'
  7. APPNAME='app'
  8. top = '.'
  9. out = 'build'
  10. from waflib.extras import remote # optional
  11. from waflib.extras import distnet
  12. variants = [
  13. 'linux_64_debug',
  14. 'linux_64_release',
  15. 'linux_32_debug',
  16. 'linux_32_release',
  17. ]
  18. def options(opt):
  19. opt.load('distnet')
  20. opt.load('compiler_c')
  21. def configure(conf):
  22. conf.load('distnet')
  23. conf.load('compiler_c')
  24. if conf.variant == 'linux_64_release':
  25. conf.env.LIB_m = ['m']
  26. def build(bld):
  27. bld.shlib(source='prep.c', target='prepouet', includes='.', use='m')
  28. bld.shlib(source='main.c', target='pouet', includes='.', use='prepouet')
  29. def package(ctx):
  30. for v in variants:
  31. tar = 'build/%s.tarfile' % v
  32. inputs = ['build/%s/libpouet.so' % v, 'build/%s/libprepouet.so' % v]
  33. ctx.make_tarfile(tar, inputs)
  34. ctx.make_tarfile('build/noarch.tarfile', ['head.h', 'waf_pouet.py'])
  35. # testing..........................................................................................
  36. #
  37. from waflib import Utils
  38. class problem(object):
  39. def __init__(self):
  40. self.reader = distnet.package_reader()
  41. #self.reader.debug = 1
  42. self.vtable = {self.reader.myproject : [self.reader.myversion]}
  43. def add_constraint(self, pkgname, pkgver, text):
  44. self.reader.cache_constraints[(pkgname, pkgver)] = distnet.parse_constraints(text)
  45. def set_versions(self, pkgname, versions):
  46. self.vtable[pkgname] = Utils.to_list(versions)
  47. def test(ctx):
  48. p = problem()
  49. p.add_constraint(APPNAME, VERSION, 'app1,1.0.*\napp2,1.0.*')
  50. p.add_constraint('app1', '1.0.0', 'app3,1.0.*,')
  51. p.add_constraint('app2', '1.0.0', 'app3,2.0.*,')
  52. p.add_constraint('app3', '1.0.0', '')
  53. p.add_constraint('app3', '2.0.0', '')
  54. p.set_versions('app1', '1.0.0')
  55. p.set_versions('app2', '1.0.0')
  56. p.set_versions('app3', '1.0.0 2.0.0')
  57. versions, constraints = p.reader.solve(p.vtable, {}, p.reader.myproject, p.reader.myversion)
  58. #print versions
  59. #print constraints
  60. #for a, b in constraints.items():
  61. # print a, b
  62. p.reader.constraints = p.reader.solution_to_constraints(versions, constraints)
  63. p.reader.check_errors()