[211] | 1 | import sys
|
---|
| 2 | import distutils.sysconfig
|
---|
| 3 |
|
---|
[187] | 4 | #cflags = '-std=gnu99 -pedantic -Wall'
|
---|
[201] | 5 | cflags = '-std=gnu99 -pedantic -Wall -fvisibility=hidden -ggdb'
|
---|
[187] | 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 |
|
---|
[191] | 14 | env = Environment(CFLAGS=cflags,
|
---|
| 15 | CPPPATH=['include', '/usr/local/include'],
|
---|
| 16 | LIBPATH=['lib', '/usr/local/lib'],
|
---|
[195] | 17 | LIBS=['m', 'pthread', 'regfi', 'talloc'])
|
---|
[191] | 18 |
|
---|
[194] | 19 |
|
---|
[187] | 20 | # Libraries
|
---|
| 21 | libregfi_static = env.Library(lib_src)
|
---|
[203] | 22 | libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
|
---|
[187] | 23 |
|
---|
[189] | 24 |
|
---|
[187] | 25 | # Executables
|
---|
[191] | 26 | reglookup = env.Program(['src/reglookup.c'])
|
---|
| 27 | reglookup_recover = env.Program(['src/reglookup-recover.c'])
|
---|
[187] | 28 |
|
---|
[189] | 29 |
|
---|
[187] | 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',
|
---|
[189] | 36 | src_suffix = '.docbook')
|
---|
[187] | 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 |
|
---|
[189] | 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])
|
---|
[211] | 48 | env.Install(distutils.sysconfig.get_python_lib()+'/pyregfi', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'])
|
---|
[193] | 49 | env.Install(prefix+'include/regfi', Glob('include/*.h'))
|
---|
[189] | 50 | env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
|
---|
| 51 | man_reglookup_timeline])
|
---|
| 52 |
|
---|
[211] | 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'])
|
---|
[189] | 56 |
|
---|
[187] | 57 | # User Friendly Targets
|
---|
| 58 | env.Alias('libregfi', libregfi)
|
---|
[211] | 59 | env.Alias('pyregfi', distutils.sysconfig.get_python_lib()+'/pyregfi')
|
---|
[187] | 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])
|
---|
[194] | 64 | env.Alias('install', [prefix+'bin',
|
---|
| 65 | prefix+'lib',
|
---|
| 66 | prefix+'include/regfi',
|
---|
[211] | 67 | distutils.sysconfig.get_python_lib()+'/pyregfi',
|
---|
[194] | 68 | prefix+'man'])
|
---|
[187] | 69 |
|
---|
| 70 | Default('bin', libregfi)
|
---|