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
RevLine 
[191]1cflags = '-std=gnu99 -pedantic -Wall'
[189]2
[191]3libiconv_path='win32/libiconv/'
4libpthreads_path='win32/libpthreads/'
5libpthread_name='pthreadGC2'
[195]6libtalloc_path='win32/libtalloc/'
[191]7
[209]8source_targets=('reglookup-src-trunk.tar.gz',)
9win32_targets=('reglookup-win32-trunk.zip',)
10doc_targets=('reglookup-doc-trunk.tar.gz',)
[191]11
12def target2version(target):
[209]13    return target.split('-')[2].split('.')[0]
[191]14
15def version2input(version):
16    if version == 'trunk':
17        return 'trunk/'
18    else:
19        return 'releases/%s/' % version
20
21
22source_cmds='''
[187]23rm -rf .release;
[189]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
[187]28'''
29
[191]30win32_cmds='''
31rm -rf .release && mkdir -p .release/%s
32cp %s/src/*.exe .release/%s
[195]33cp win32/libiconv/bin/*.dll win32/libpthreads/bin/*.dll win32/libtalloc/bin/*.dll .release/%s
[191]34cd .release && zip -r %s.zip %s
35mv .release/%s.zip . && rm -rf .release
36'''
[187]37
[209]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
[189]47def generate_cmds(source, target, env, for_signature):
48    ret_val = ''
49    for t in target:
[191]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',
[195]67                            libpthreads_path+'include',
68                            libtalloc_path+'include']
[191]69            env['LIBPATH']=[input_prefix+'lib',
70                            libiconv_path+'lib',
[195]71                            libpthreads_path+'lib',
72                            libtalloc_path+'lib']
73            env['LIBS']=['m', libpthread_name, 'iconv', 'regfi', 'talloc']
[191]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',
[195]86                       libtalloc_path+'/lib/libtalloc.dll.a',
87                       input_prefix+'lib/libregfi.a',]
[191]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
[209]98        elif t in doc_targets:
99            ret_val += doc_cmds % (t_base,t_base,t_base,t_base,t_base)
100
[189]101        else:
[209]102            return '#ERROR: cannot build "%s".  Acceptable targets: %s'\
103                   % (t, repr(source_targets+win32_targets+doc_targets))
[191]104       
[189]105    return ret_val
[187]106
[188]107
[191]108
[189]109release_builder = Builder(generator = generate_cmds,
110                          suffix = '.tar.gz',
111                          src_suffix = '',
112                          prefix='reglookup-')
[188]113
[191]114
[189]115env = Environment()
116env['BUILDERS']['Release'] = release_builder
[188]117
[189]118
[195]119for target in COMMAND_LINE_TARGETS:
[191]120    env.Release(target, Dir(version2input(target2version(target))))
[189]121
[191]122
[187]123Default(None)
Note: See TracBrowser for help on using the repository browser.