1 | import sys |
---|
2 | import os |
---|
3 | #import distutils.sysconfig |
---|
4 | |
---|
5 | #cflags = '-std=gnu99 -pedantic -Wall' |
---|
6 | cflags = '-std=gnu99 -pedantic -Wall -fvisibility=hidden -ggdb' |
---|
7 | |
---|
8 | |
---|
9 | lib_src = ['lib/regfi.c', |
---|
10 | 'lib/winsec.c', |
---|
11 | 'lib/range_list.c', |
---|
12 | 'lib/lru_cache.c', |
---|
13 | 'lib/void_stack.c'] |
---|
14 | |
---|
15 | env = 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 |
---|
22 | libregfi_static = env.Library(lib_src) |
---|
23 | libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc']) |
---|
24 | |
---|
25 | |
---|
26 | # Executables |
---|
27 | reglookup = env.Program(['src/reglookup.c']) |
---|
28 | reglookup_recover = env.Program(['src/reglookup-recover.c']) |
---|
29 | |
---|
30 | |
---|
31 | # Documentation |
---|
32 | # This only needs to be run during the release/packaging process |
---|
33 | man_fixup = "|sed 's/.SH DESCRIPTION/\\n.SH DESCRIPTION/'" |
---|
34 | man_builder = Builder(action='docbook2x-man --to-stdout $SOURCE' |
---|
35 | + man_fixup + '| gzip -9 > $TARGET', |
---|
36 | suffix = '.gz', |
---|
37 | src_suffix = '.docbook') |
---|
38 | env['BUILDERS']['ManPage'] = man_builder |
---|
39 | |
---|
40 | man_reglookup = env.ManPage('doc/reglookup.1.docbook') |
---|
41 | man_reglookup_recover = env.ManPage('doc/reglookup-recover.1.docbook') |
---|
42 | man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook') |
---|
43 | |
---|
44 | # Installation |
---|
45 | prefix='/usr/local/' |
---|
46 | install_items = [prefix+'bin', |
---|
47 | prefix+'lib', |
---|
48 | prefix+'include/regfi', |
---|
49 | prefix+'man'] |
---|
50 | |
---|
51 | env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline']) |
---|
52 | env.Install(prefix+'lib', [libregfi, libregfi_static]) |
---|
53 | env.Install(prefix+'include/regfi', Glob('include/*.h')) |
---|
54 | env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover, |
---|
55 | man_reglookup_timeline]) |
---|
56 | |
---|
57 | if 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 | |
---|
62 | python_path = os.popen('which python3').read() |
---|
63 | if 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 |
---|
70 | env.Alias('libregfi', libregfi) |
---|
71 | env.Alias('reglookup', reglookup) |
---|
72 | env.Alias('reglookup-recover', reglookup_recover) |
---|
73 | env.Alias('bin', [reglookup_recover, reglookup]) |
---|
74 | env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline]) |
---|
75 | env.Alias('install', install_items) |
---|
76 | |
---|
77 | Default('bin', libregfi) |
---|