source: trunk/SConstruct @ 212

Last change on this file since 212 was 212, checked in by tim, 13 years ago

fixed python2 compatbility problems in pyregfi
added better install scripts for both python2 and python3

File size: 2.7 KB
Line 
1import sys
2import os
3#import distutils.sysconfig
4
5#cflags = '-std=gnu99 -pedantic -Wall'
6cflags = '-std=gnu99 -pedantic -Wall -fvisibility=hidden -ggdb'
7
8
9lib_src = ['lib/regfi.c',
10           'lib/winsec.c',
11           'lib/range_list.c',
12           'lib/lru_cache.c',
13           'lib/void_stack.c']
14
15env = Environment(CFLAGS=cflags,
16                  CPPPATH=['include', '/usr/local/include'],
17                  LIBPATH=['lib', '/usr/local/lib'],
18                  LIBS=['m', 'pthread', 'regfi', 'talloc'])
19
20
21# Libraries
22libregfi_static = env.Library(lib_src)
23libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
24
25
26# Executables
27reglookup = env.Program(['src/reglookup.c'])
28reglookup_recover = env.Program(['src/reglookup-recover.c'])
29
30
31# Documentation
32#  This only needs to be run during the release/packaging process
33man_fixup = "|sed 's/.SH DESCRIPTION/\\n.SH DESCRIPTION/'"
34man_builder = Builder(action='docbook2x-man --to-stdout $SOURCE'
35                      + man_fixup + '| gzip -9 > $TARGET',
36                      suffix = '.gz',
37                      src_suffix = '.docbook')
38env['BUILDERS']['ManPage'] = man_builder
39
40man_reglookup = env.ManPage('doc/reglookup.1.docbook')
41man_reglookup_recover = env.ManPage('doc/reglookup-recover.1.docbook')
42man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook')
43
44# Installation
45prefix='/usr/local/'
46install_items = [prefix+'bin',
47                 prefix+'lib',
48                 prefix+'include/regfi',
49                 prefix+'man']
50
51env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
52env.Install(prefix+'lib', [libregfi, libregfi_static])
53env.Install(prefix+'include/regfi', Glob('include/*.h'))
54env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
55                                man_reglookup_timeline])
56
57if sys.version_info[0] == 2:
58   install_items.append('pyregfi2-install.log')
59   env.Command('pyregfi2-install.log', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'],
60               "python pyregfi-distutils.py install | tee pyregfi2-install.log")
61
62python_path = os.popen('which python3').read()
63if python_path != '':
64   install_items.append('pyregfi3-install.log')
65   env.Command('pyregfi3-install.log', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'],
66               "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
67
68
69# User Friendly Targets
70env.Alias('libregfi', libregfi)
71env.Alias('reglookup', reglookup)
72env.Alias('reglookup-recover', reglookup_recover)
73env.Alias('bin', [reglookup_recover, reglookup])
74env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
75env.Alias('install', install_items)
76
77Default('bin', libregfi)
Note: See TracBrowser for help on using the repository browser.