source: SConstruct @ 195

Last change on this file since 195 was 195, checked in by tim, 15 years ago

removed talloc from mainline build tree, opting instead to depend upon libtalloc-dev

win32 builds depend up on modified libtalloc stored outside of trunk

miscellaneous other build fixes

File size: 3.7 KB
Line 
1cflags = '-std=gnu99 -pedantic -Wall'
2
3libiconv_path='win32/libiconv/'
4libpthreads_path='win32/libpthreads/'
5libpthread_name='pthreadGC2'
6libtalloc_path='win32/libtalloc/'
7
8source_targets=('reglookup-trunk.tar.gz',)
9win32_targets=('reglookup-trunk-win32.zip',)
10
11def target2version(target):
12    return target.split('-')[1].split('.')[0]
13
14def version2input(version):
15    if version == 'trunk':
16        return 'trunk/'
17    else:
18        return 'releases/%s/' % version
19
20
21source_cmds='''
22rm -rf .release;
23svn export svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup/$SOURCE .release/%s;
24cd .release/%s && scons doc
25cd .release && tar cf %s.tar %s && gzip -9 %s.tar;
26mv .release/%s.tar.gz . && rm -rf .release
27'''
28
29win32_cmds='''
30rm -rf .release && mkdir -p .release/%s
31cp %s/src/*.exe .release/%s
32cp win32/libiconv/bin/*.dll win32/libpthreads/bin/*.dll win32/libtalloc/bin/*.dll .release/%s
33cd .release && zip -r %s.zip %s
34mv .release/%s.zip . && rm -rf .release
35'''
36
37def generate_cmds(source, target, env, for_signature):
38    ret_val = ''
39    for t in target:
40        t = str(t)
41        t_base = t.split('.tar.gz')[0].split('.zip')[0]
42        if t in source_targets:
43            ret_val += source_cmds % (t_base,t_base,t_base,
44                                      t_base,t_base,t_base)
45        elif t in win32_targets:
46            version = target2version(t)
47            input_prefix = version2input(version)
48
49            env['platform']='cygwin'
50            env['CC']='i586-mingw32msvc-cc'
51            env['AR']='i586-mingw32msvc-ar'
52            env['RANLIB']='i586-mingw32msvc-ranlib'
53           
54            env['CFLAGS']=cflags
55            env['CPPPATH']=[input_prefix+'include',
56                            libiconv_path+'include',
57                            libpthreads_path+'include',
58                            libtalloc_path+'include']
59            env['LIBPATH']=[input_prefix+'lib',
60                            libiconv_path+'lib',
61                            libpthreads_path+'lib',
62                            libtalloc_path+'lib']
63            env['LIBS']=['m', libpthread_name, 'iconv', 'regfi', 'talloc']
64
65           
66            # Libraries
67            lib_src = [input_prefix+'lib/regfi.c',
68                       input_prefix+'lib/winsec.c',
69                       input_prefix+'lib/range_list.c',
70                       input_prefix+'lib/lru_cache.c',
71                       input_prefix+'lib/void_stack.c']
72            libregfi_static = env.Library(lib_src)
73
74            extra_obj=['%s/lib/lib%s.a' % (libpthreads_path, libpthread_name),
75                       libiconv_path+'/lib/libiconv.dll.a',
76                       libtalloc_path+'/lib/libtalloc.dll.a',
77                       input_prefix+'lib/libregfi.a',]
78
79            # Executables
80            reglookup = env.Program(input_prefix+'src/reglookup.exe',
81                                    [input_prefix+'src/reglookup.c']+extra_obj)
82            reglookup_recover = env.Program(input_prefix+'src/reglookup-recover.exe',
83                                            [input_prefix+'src/reglookup-recover.c']+extra_obj)
84
85            ret_val += win32_cmds % (t_base,input_prefix,
86                                     t_base,t_base,t_base,t_base,t_base)
87
88        else:
89            return '#ERROR: cannot build "%s".  Acceptable targets: %s' % (t, repr(buildable_files))
90       
91    return ret_val
92
93
94
95release_builder = Builder(generator = generate_cmds,
96                          suffix = '.tar.gz',
97                          src_suffix = '',
98                          prefix='reglookup-')
99
100
101env = Environment()
102env['BUILDERS']['Release'] = release_builder
103
104
105for target in COMMAND_LINE_TARGETS:
106    env.Release(target, Dir(version2input(target2version(target))))
107
108
109Default(None)
Note: See TracBrowser for help on using the repository browser.