source: releases/0.0.1/SConstruct

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

Switched to python3 only, since supporting both 2.x and 3.x is such a pain

Added preliminary python-requests support to http2py

File size: 3.8 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                             'bin/bletchley-http2py', 'bin/bletchley-encode',
59                             'bin/bletchley-decode'])
60#libinstall = env.Install(destdir+libdir, [libbletchley, libbletchley_static])
61#env.Install(destdir+includedir+'/bletchley', Glob('include/*.h'))
62#env.Install(destdir+mandir+'/man1', [man_bletchley, man_bletchley_recover,
63#                                     man_bletchley_timeline])
64#if os.getuid() == 0:
65#   env.AddPostAction(libinstall, 'ldconfig')
66
67#if sys.version_info[0] == 2:
68#   install_items.append('bletchley-python2.log')
69#   env.Command('bletchley-python2.log', Glob('lib/bletchley/*.py')+Glob('lib/bletchley/CBC/*.py'),
70#               "python bletchley-distutils install --root=/%s | tee bletchley-python2.log" % destdir)
71
72python_path = os.popen('which python3').read()
73if python_path != '':
74   install_items.append('bletchley-python3.log')
75   env.Command('bletchley-python3.log', Glob('lib/bletchley/*.py')+Glob('lib/bletchley/CBC/*.py'),
76               "python3 bletchley-distutils install --root=/%s | tee bletchley-python3.log" % destdir)
77
78# API documentation
79#bletchley_doc = env.Command('doc/devel/bletchley/index.html',
80#                            Glob('lib/*.c')+Glob('include/*.h')+['doc/devel/Doxyfile.bletchley'],
81#                            'doxygen doc/devel/Doxyfile.bletchley')
82#pybletchley_doc = env.Command('doc/devel/pybletchley/index.html',
83#                              Glob('python/pybletchley/*.py')+['doc/devel/Doxyfile.pybletchley', bletchley_doc],
84#                              'doxygen doc/devel/Doxyfile.pybletchley')
85
86
87# User Friendly Targets
88env.Alias('bin', [bletchley_nextrand])
89#env.Alias('doc', [man_bletchley,man_bletchley_recover,man_bletchley_timeline])
90#env.Alias('doc-devel', [bletchley_doc, pybletchley_doc])
91env.Alias('install', install_items)
92
93Default('bin')
Note: See TracBrowser for help on using the repository browser.