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