[211] | 1 | import sys |
---|
[212] | 2 | import os |
---|
[211] | 3 | |
---|
[225] | 4 | cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden' |
---|
| 5 | cflags += ' -ggdb' |
---|
[187] | 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 | |
---|
[191] | 13 | env = Environment(CFLAGS=cflags, |
---|
| 14 | CPPPATH=['include', '/usr/local/include'], |
---|
| 15 | LIBPATH=['lib', '/usr/local/lib'], |
---|
[195] | 16 | LIBS=['m', 'pthread', 'regfi', 'talloc']) |
---|
[191] | 17 | |
---|
[194] | 18 | |
---|
[187] | 19 | # Libraries |
---|
| 20 | libregfi_static = env.Library(lib_src) |
---|
[203] | 21 | libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc']) |
---|
[187] | 22 | |
---|
[189] | 23 | |
---|
[187] | 24 | # Executables |
---|
[191] | 25 | reglookup = env.Program(['src/reglookup.c']) |
---|
| 26 | reglookup_recover = env.Program(['src/reglookup-recover.c']) |
---|
[187] | 27 | |
---|
[189] | 28 | |
---|
[187] | 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', |
---|
[189] | 35 | src_suffix = '.docbook') |
---|
[187] | 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 | |
---|
[189] | 42 | # Installation |
---|
| 43 | prefix='/usr/local/' |
---|
[212] | 44 | install_items = [prefix+'bin', |
---|
| 45 | prefix+'lib', |
---|
| 46 | prefix+'include/regfi', |
---|
| 47 | prefix+'man'] |
---|
| 48 | |
---|
[189] | 49 | env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline']) |
---|
| 50 | env.Install(prefix+'lib', [libregfi, libregfi_static]) |
---|
[193] | 51 | env.Install(prefix+'include/regfi', Glob('include/*.h')) |
---|
[189] | 52 | env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover, |
---|
| 53 | man_reglookup_timeline]) |
---|
| 54 | |
---|
[212] | 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") |
---|
[189] | 59 | |
---|
[212] | 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 | |
---|
[187] | 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]) |
---|
[212] | 73 | env.Alias('install', install_items) |
---|
[187] | 74 | |
---|
| 75 | Default('bin', libregfi) |
---|