wscript 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2006 (ita)
  4. VERSION='0.0.1'
  5. APPNAME='d_test'
  6. top = '.'
  7. out = 'build'
  8. def options(opt):
  9. opt.load('compiler_d')
  10. def configure(conf):
  11. # why does dmd require -fPIC on everything?
  12. conf.env.DFLAGS='-fPIC'
  13. conf.load('compiler_d')
  14. conf.env.LIB_PTHREAD = ['pthread']
  15. conf.check_dlibrary()
  16. try:
  17. conf.check(features='d dprogram', fragment='int main() {return 0;}', compile_filename='test.d', dflags=['-version=Posix'])
  18. except:
  19. pass
  20. else:
  21. conf.env.append_value('DFLAGS', ['-version=Posix'])
  22. def build(bld):
  23. if bld.env.DLIBRARY != 'tango':
  24. bld.recurse('src')
  25. # here is how to use the object-oriented notation
  26. bld.stlib(
  27. source = 'testlib/code.d',
  28. includes = '.',
  29. name = 'testlib',
  30. target = 'testlib')
  31. bld.program(
  32. source = 'example.d',
  33. target = 'd_test',
  34. use = 'testlib PTHREAD',
  35. includes = '.')
  36. else:
  37. # bad pun hidden
  38. bld.program(source='foo.d', target='bar', use='hmm', includes=[bld.path])
  39. bld.stlib(source='hmm.d', target='hmm')
  40. #bld(features='d dshlib', source='shared.d', target='sha')
  41. # shared libs do not work here:
  42. # ldc -relocation-model=pic -L-shared shared.d -offoo
  43. # /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:
  44. # /disk/comp/ldc/bin/../lib/libtango.a(tango-core-rt-compiler-ldc-object_-O2.o):
  45. # relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC