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