source: SConstruct@ 206

Last change on this file since 206 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
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
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='''
[187]22rm -rf .release;
[189]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
[187]27'''
28
[191]29win32_cmds='''
30rm -rf .release && mkdir -p .release/%s
31cp %s/src/*.exe .release/%s
[195]32cp win32/libiconv/bin/*.dll win32/libpthreads/bin/*.dll win32/libtalloc/bin/*.dll .release/%s
[191]33cd .release && zip -r %s.zip %s
34mv .release/%s.zip . && rm -rf .release
35'''
[187]36
[189]37def generate_cmds(source, target, env, for_signature):
38 ret_val = ''
39 for t in target:
[191]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',
[195]57 libpthreads_path+'include',
58 libtalloc_path+'include']
[191]59 env['LIBPATH']=[input_prefix+'lib',
60 libiconv_path+'lib',
[195]61 libpthreads_path+'lib',
62 libtalloc_path+'lib']
63 env['LIBS']=['m', libpthread_name, 'iconv', 'regfi', 'talloc']
[191]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',
[195]76 libtalloc_path+'/lib/libtalloc.dll.a',
77 input_prefix+'lib/libregfi.a',]
[191]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
[189]88 else:
89 return '#ERROR: cannot build "%s". Acceptable targets: %s' % (t, repr(buildable_files))
[191]90
[189]91 return ret_val
[187]92
[188]93
[191]94
[189]95release_builder = Builder(generator = generate_cmds,
96 suffix = '.tar.gz',
97 src_suffix = '',
98 prefix='reglookup-')
[188]99
[191]100
[189]101env = Environment()
102env['BUILDERS']['Release'] = release_builder
[188]103
[189]104
[195]105for target in COMMAND_LINE_TARGETS:
[191]106 env.Release(target, Dir(version2input(target2version(target))))
[189]107
[191]108
[187]109Default(None)
Note: See TracBrowser for help on using the repository browser.