source: trunk/SConstruct @ 264

Last change on this file since 264 was 253, checked in by tim, 13 years ago

added preliminary interface to security descriptors in pyregfi
misc bug fixes

File size: 3.5 KB
RevLine 
[211]1import sys
[212]2import os
[234]3sys.dont_write_bytecode = True
[232]4from regfi_version import REGFI_VERSION
[211]5
[225]6cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
[232]7cflags += ' -DREGFI_VERSION=\'"%s"\'' % REGFI_VERSION
[225]8cflags += ' -ggdb'
[187]9
10lib_src = ['lib/regfi.c',
11           'lib/winsec.c',
12           'lib/range_list.c',
13           'lib/lru_cache.c',
14           'lib/void_stack.c']
15
[191]16env = Environment(CFLAGS=cflags,
17                  CPPPATH=['include', '/usr/local/include'],
18                  LIBPATH=['lib', '/usr/local/lib'],
[195]19                  LIBS=['m', 'pthread', 'regfi', 'talloc'])
[191]20
[194]21
[187]22# Libraries
23libregfi_static = env.Library(lib_src)
[203]24libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
[187]25
[189]26
[187]27# Executables
[191]28reglookup = env.Program(['src/reglookup.c'])
29reglookup_recover = env.Program(['src/reglookup-recover.c'])
[187]30
[189]31
[187]32# Documentation
33#  This only needs to be run during the release/packaging process
34man_fixup = "|sed 's/.SH DESCRIPTION/\\n.SH DESCRIPTION/'"
35man_builder = Builder(action='docbook2x-man --to-stdout $SOURCE'
36                      + man_fixup + '| gzip -9 > $TARGET',
37                      suffix = '.gz',
[189]38                      src_suffix = '.docbook')
[187]39env['BUILDERS']['ManPage'] = man_builder
40
41man_reglookup = env.ManPage('doc/reglookup.1.docbook')
42man_reglookup_recover = env.ManPage('doc/reglookup-recover.1.docbook')
43man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook')
44
[189]45# Installation
46prefix='/usr/local/'
[246]47if 'PREFIX' in os.environ:
48   prefix = os.environ['PREFIX']+'/'
49
[212]50install_items = [prefix+'bin',
51                 prefix+'lib',
52                 prefix+'include/regfi',
53                 prefix+'man']
54
[189]55env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
56env.Install(prefix+'lib', [libregfi, libregfi_static])
[193]57env.Install(prefix+'include/regfi', Glob('include/*.h'))
[189]58env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
59                                man_reglookup_timeline])
60
[212]61if sys.version_info[0] == 2:
62   install_items.append('pyregfi2-install.log')
[253]63   env.Command('pyregfi2-install.log', ['python/pyregfi/__init__.py',
64                                        'python/pyregfi/structures.py',
65                                        'python/pyregfi/winsec.py'],
[212]66               "python pyregfi-distutils.py install | tee pyregfi2-install.log")
[189]67
[212]68python_path = os.popen('which python3').read()
69if python_path != '':
70   install_items.append('pyregfi3-install.log')
[253]71   env.Command('pyregfi3-install.log', ['python/pyregfi/__init__.py',
72                                        'python/pyregfi/structures.py',
73                                        'python/pyregfi/winsec.py'],
[212]74               "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
75
[238]76# API documentation
77regfi_doc = env.Command('doc/devel/regfi/index.html',
78                        Glob('lib/*.c')+Glob('include/*.h')+['doc/devel/Doxyfile.regfi'],
79                        'doxygen doc/devel/Doxyfile.regfi')
80pyregfi_doc = env.Command('doc/devel/pyregfi/index.html',
81                          Glob('python/pyregfi/*.py')+['doc/devel/Doxyfile.pyregfi', regfi_doc],
82                          'doxygen doc/devel/Doxyfile.pyregfi')
[212]83
[238]84
[187]85# User Friendly Targets
86env.Alias('libregfi', libregfi)
87env.Alias('reglookup', reglookup)
88env.Alias('reglookup-recover', reglookup_recover)
89env.Alias('bin', [reglookup_recover, reglookup])
90env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
[238]91env.Alias('doc-devel', [regfi_doc, pyregfi_doc])
[212]92env.Alias('install', install_items)
[187]93
94Default('bin', libregfi)
Note: See TracBrowser for help on using the repository browser.