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