source: SConstruct @ 215

Last change on this file since 215 was 209, checked in by tim, 14 years ago

worked on pyregfi value data interface

added initial scons target for API/devel documentation

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