source: SConstruct @ 1

Last change on this file since 1 was 1, checked in by tmorgan, 12 years ago

moved to dedicated repository

File size: 3.7 KB
Line 
1import sys
2import os
3sys.dont_write_bytecode = True
4from bletchley_version import BLETCHLEY_VERSION
5
6cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
7cflags += ' -DBLETCHLEY_VERSION=\'"%s"\'' % BLETCHLEY_VERSION
8cflags += ' -ggdb'
9
10#lib_src = ['lib/bletchley.c',
11#           'lib/winsec.c',
12#           'lib/range_list.c',
13#           'lib/lru_cache.c',
14#           'lib/void_stack.c']
15
16cc=os.environ.get('CC', 'gcc')
17env = Environment(ENV=os.environ,
18                  CC=cc,
19                  CFLAGS=cflags,
20                  CPPPATH=['include', '/usr/local/include'],
21                  LIBPATH=['lib', '/usr/local/lib'],
22                  LIBS=[])
23
24# Libraries
25#libbletchley_static = env.Library(lib_src)
26#libbletchley = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'],
27#                                 LINKFLAGS="-shared -fPIC -Wl,-soname,libbletchley.so.%s" % BLETCHLEY_VERSION)
28
29
30# Executable binaries
31bletchley_nextrand = env.Program('bin/bletchley-nextrand', ['src/nextrand.c'])
32
33
34# Documentation
35#  This only needs to be run during the release/packaging process
36#man_fixup = "|sed 's/.SH DESCRIPTION/\\n.SH DESCRIPTION/'"
37#man_builder = Builder(action='docbook2x-man --to-stdout $SOURCE'
38#                      + man_fixup + '| gzip -9 > $TARGET',
39#                      suffix = '.gz',
40#                      src_suffix = '.docbook')
41#env['BUILDERS']['ManPage'] = man_builder
42
43#man_bletchley = env.ManPage('doc/bletchley.1.docbook')
44#man_bletchley_recover = env.ManPage('doc/bletchley-recover.1.docbook')
45#man_bletchley_timeline = env.ManPage('doc/bletchley-timeline.1.docbook')
46
47# Installation
48prefix     = os.environ.get('PREFIX','/usr/local')+'/'
49destdir    = os.environ.get('DESTDIR','')
50bindir     = os.environ.get('BINDIR', prefix + 'bin')
51libdir     = os.environ.get('LIBDIR', prefix + 'lib')
52includedir = os.environ.get('INCLUDEDIR', prefix + 'include')
53mandir     = os.environ.get('MANDIR', prefix + 'man')
54
55install_items = [destdir + bindir]
56
57env.Install(destdir+bindir, [bletchley_nextrand, 'bin/bletchley-analyze'])
58#libinstall = env.Install(destdir+libdir, [libbletchley, libbletchley_static])
59#env.Install(destdir+includedir+'/bletchley', Glob('include/*.h'))
60#env.Install(destdir+mandir+'/man1', [man_bletchley, man_bletchley_recover,
61#                                     man_bletchley_timeline])
62#if os.getuid() == 0:
63#   env.AddPostAction(libinstall, 'ldconfig')
64
65if sys.version_info[0] == 2:
66   install_items.append('bletchley-python2.log')
67   env.Command('bletchley-python2.log', Glob('lib/bletchley/*.py')+Glob('lib/bletchley/PaddingOracle/*.py'),
68               "python bletchley-distutils install --root=/%s | tee bletchley-python2.log" % destdir)
69
70python_path = os.popen('which python3').read()
71if python_path != '':
72   install_items.append('bletchley-python3.log')
73   env.Command('bletchley-python3.log', Glob('lib/bletchley/*.py')+Glob('lib/bletchley/PaddingOracle/*.py'),
74               "python3 bletchley-distutils install --root=/%s | tee bletchley-python3.log" % destdir)
75
76# API documentation
77#bletchley_doc = env.Command('doc/devel/bletchley/index.html',
78#                            Glob('lib/*.c')+Glob('include/*.h')+['doc/devel/Doxyfile.bletchley'],
79#                            'doxygen doc/devel/Doxyfile.bletchley')
80#pybletchley_doc = env.Command('doc/devel/pybletchley/index.html',
81#                              Glob('python/pybletchley/*.py')+['doc/devel/Doxyfile.pybletchley', bletchley_doc],
82#                              'doxygen doc/devel/Doxyfile.pybletchley')
83
84
85# User Friendly Targets
86env.Alias('bin', [bletchley_nextrand])
87#env.Alias('doc', [man_bletchley,man_bletchley_recover,man_bletchley_timeline])
88#env.Alias('doc-devel', [bletchley_doc, pybletchley_doc])
89env.Alias('install', install_items)
90
91Default('bin')
Note: See TracBrowser for help on using the repository browser.