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