forked from boytm/mproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
53 lines (42 loc) · 2.06 KB
/
Copy pathSConstruct
File metadata and controls
53 lines (42 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#env = Environment(CCFLAGS = '-g -O0 -Wall')
env = Environment(CCFLAGS = '-g -O2 -Wall')
env['CPPPATH'] = []
env['LIBS'] = []
env['CPPDEFINES'] = {}
env['EVHTP_DIR'] = 'libevhtp'
conf = Configure(env)
if not conf.CheckLibWithHeader('event', 'event2/event.h', 'c'):
print 'libevent 2.12+ required!'
Exit(1)
if not conf.CheckHeader('sys/un.h'):
conf.env.Append(CPPDEFINES = "NO_SYS_UN")
if not conf.CheckHeader('sys/queue.h'):
env.Command('$EVHTP_DIR/compat/sys/queue.h', '$EVHTP_DIR/compat/sys/queue.h.in', 'cp $SOURCES $TARGET')
if not conf.CheckHeader('sys/tree.h'):
env.Command('$EVHTP_DIR/compat/sys/tree.h', '$EVHTP_DIR/compat/sys/tree.h.in', 'cp $SOURCES $TARGET')
if not conf.CheckFunc('strndup'):
conf.env.Append(CPPDEFINES = 'NO_STRNDUP=1')
if not conf.CheckFunc('strnlen'):
conf.env.Append(CPPDEFINES = 'NO_STRNLEN=1')
if conf.CheckHeader('openssl/evp.h'):
conf.env.Append(CPPDEFINES = ['USE_CRYPTO_OPENSSL=1', 'ENABLE_SS=1'])
if conf.CheckFunc('splice'):
conf.env.Append(CPPDEFINES = 'HAVE_SPLICE=1')
env.Append(CPPDEFINES={"EVHTP_SYS_ARCH" : (8 * conf.CheckTypeSize("size_t"))})
env = conf.Finish()
if env['PLATFORM'] in ('win32', 'mingw'):
env['LIBS'] += "ws2_32"
env.Decider('timestamp-match')
env.Command('$EVHTP_DIR/evhtp-config.h', 'evhtp-config.h.win32', 'cp $SOURCES $TARGET')
env.Append(CPPPATH = ['libevhtp', 'libevhtp/compat'])
libevhtp_srcs = Split('libevhtp/evhtp.c libevhtp/evhtp_numtoa.c libevhtp/evthr.c libevhtp/htparse.c')
libevhtp_objs = [env.Object(i) for i in libevhtp_srcs]
env.Program('evhtp_get', ['evhtp_get.c', ] + libevhtp_objs,
LIBS = ['event', 'pthread', 'rt'],
LIBPATH = ['/usr/local/lib', '/usr/lib', ])
evhtp_proxy = env.Program('mproxy', Split('evhtp_proxy.c evhtp_sock_relay.c lru.c connector.c ss_connector.c encrypt.c utils.c log.c') + libevhtp_objs,
CCFLAGS = env['CCFLAGS'] + ' ',
LIBS = ['event', 'crypto', 'pthread', 'rt'],
LIBPATH = ['/usr/local/lib', '/usr/lib', ])
env.Install('/usr/local/bin', evhtp_proxy)
env.Alias('install', '/usr/local/bin')