Changeset 232 for SConstruct
- Timestamp:
- 04/28/11 12:45:10 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SConstruct
r226 r232 1 import sys 2 import os 3 1 4 cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -DREGFI_WIN32' 2 5 3 libiconv_path=' win32/libiconv/'4 libpthreads_path=' win32/libpthreads/'6 libiconv_path='.export/win32/libiconv/' 7 libpthreads_path='.export/win32/libpthreads/' 5 8 libpthread_name='pthreadGC2' 6 libtalloc_path=' win32/libtalloc/'9 libtalloc_path='.export/win32/libtalloc/' 7 10 8 source_targets=(' reglookup-src-trunk.tar.gz',)9 win32_targets=(' reglookup-win32-trunk.zip',)10 doc_targets=(' reglookup-doc-trunk.tar.gz',)11 all_targets = source_targets+win32_targets+doc_targets 11 source_targets=('src-trunk',) 12 win32_targets=('win32-trunk',) 13 doc_targets=('doc-trunk',) 14 all_targets = source_targets+win32_targets+doc_targets 12 15 13 def target2version(target): 16 17 18 def parse_target(target): 14 19 chunks = target.split('-') 15 if len(chunks) != 3:20 if len(chunks) != 2: 16 21 return None 17 return chunks [2].split('.')[0]22 return chunks 18 23 19 24 def version2input(version): … … 24 29 25 30 26 source_cmds='''27 rm -rf . release;28 svn export svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup/$SOURCE .release/%s;29 cd .release/%s && sconsdoc30 cd .release && tar cf %s.tar %s && gzip -9 %s.tar; 31 mv .release/%s.tar.gz . && rm -rf .release 31 export_cmds=''' 32 rm -rf .export 33 svn export --depth files svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup .export 34 svn export svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup/doc .export/doc 35 svn export svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup/win32 .export/win32 36 svn export svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup/%s .export/%s 32 37 ''' 33 38 39 version_cmds=''' 40 echo 'REGFI_VERSION="%s"' > .export/%s/regfi_version.py 41 ''' 42 43 cleanup_cmds=''' 44 rm -rf .export 45 ''' 46 47 source_cmds=''' 48 cd %s && scons doc 49 mv %s %s && tar cf %s.tar %s && gzip -9 %s.tar; 50 '''+cleanup_cmds 51 34 52 win32_cmds=''' 35 rm -rf .release &&mkdir -p .release/%s/python/pyregfi53 mkdir -p .release/%s/python/pyregfi 36 54 cp %s/src/*.exe .release/%s 37 55 … … 39 57 cp %s/python/pyregfi/*.py .release/%s/python/pyregfi 40 58 41 cp win32/libiconv/bin/*.dll win32/libpthreads/bin/*.dllwin32/libtalloc/bin/*.dll trunk/lib/*.dll .release/%s59 cp .export/win32/libiconv/bin/*.dll .export/win32/libpthreads/bin/*.dll .export/win32/libtalloc/bin/*.dll trunk/lib/*.dll .release/%s 42 60 cd .release && zip -r %s.zip %s 43 61 mv .release/%s.zip . && rm -rf .release 44 ''' 62 '''+cleanup_cmds 45 63 46 64 doc_cmds=''' 47 rm -rf .release; 48 svn export svn+ssh://sentinelchicken.org/home/projects/subversion/reglookup/ .release; 49 cd .release && doxygen Doxyfile.regfi 50 cd .release && doxygen Doxyfile.pyregfi 51 mv .release/doc .release/%s 52 cd .release && tar cf %s.tar %s && gzip -9 %s.tar; 53 mv .release/%s.tar.gz . && rm -rf .release 54 ''' 65 cd .export && doxygen Doxyfile.regfi 66 cd .export && doxygen Doxyfile.pyregfi 67 mv .export/doc .export/%s 68 cd .export && tar cf %s.tar %s && gzip -9 %s.tar 69 mv .export/%s.tar.gz . 70 '''+cleanup_cmds 55 71 56 72 def generate_cmds(source, target, env, for_signature): 57 73 ret_val = '' 74 input_prefix = str(source[0])+'/' 75 58 76 for t in target: 59 t = str(t) 60 t_base = t.split('.tar.gz')[0].split('.zip')[0] 61 if t in source_targets: 62 ret_val += source_cmds % (t_base,t_base,t_base, 63 t_base,t_base,t_base) 64 elif t in win32_targets: 65 version = target2version(t) 66 input_prefix = version2input(version) 77 ttype,version = parse_target(str(t)) 78 t_base = 'reglookup-%s-%s' % (ttype, version) 67 79 80 if ttype == 'src': 81 ret_val += source_cmds % (input_prefix, input_prefix, t_base, t_base, t_base, t_base) 82 elif ttype == 'win32': 68 83 env['platform']='cygwin' 69 84 env['CC']='i586-mingw32msvc-cc' … … 122 137 123 138 ret_val += win32_cmds % (t_base,input_prefix,t_base,input_prefix, 124 t_base,input_prefix, 125 t_base,t_base,t_base,t_base ,t_base)139 t_base,input_prefix,t_base, 140 t_base,t_base,t_base,t_base) 126 141 127 elif t in doc_targets:142 elif ttype == 'doc': 128 143 ret_val += doc_cmds % (t_base,t_base,t_base,t_base,t_base) 129 144 … … 131 146 132 147 133 134 148 release_builder = Builder(generator = generate_cmds, 135 suffix = ' .tar.gz',149 suffix = '', 136 150 src_suffix = '', 137 prefix='reglookup-') 138 151 prefix='') 139 152 140 153 env = Environment() 154 env['ENV']['SSH_AGENT_PID'] = os.environ['SSH_AGENT_PID'] 155 env['ENV']['SSH_AUTH_SOCK'] = os.environ['SSH_AUTH_SOCK'] 141 156 env['BUILDERS']['Release'] = release_builder 142 157 … … 145 160 146 161 for target in COMMAND_LINE_TARGETS: 147 AlwaysBuild(target)148 162 if target not in all_targets: 149 163 print('ERROR: cannot build "%s". Acceptable targets: %s' 150 164 % (target, repr(all_targets))) 151 break 152 env.Release(target, Dir(version2input(target2version(target)))) 165 sys.exit(1) 166 AlwaysBuild(target) 167 ttype,version = parse_target(target) 168 169 i = version2input(version) 170 env.Execute(export_cmds % (i, i)) 171 if version != 'trunk': 172 env.Execute(version_cmds % (version, i)) 173 env.Release(target, Dir('.export/'+i)) 153 174 154 175 Default(None)
Note: See TracChangeset
for help on using the changeset viewer.