-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwscript
124 lines (100 loc) · 5.09 KB
/
wscript
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#! /usr/bin/env python
# encoding: utf-8
from waflib.Task import Task
from waflib.TaskGen import extension
class idl_header(Task):
run_str = '../bin/pidl/pidl --header ${TGT[0].abspath()} ${SRC}'
color = 'BLUE'
ext_out = ['.h']
class idl_parser(Task):
run_str = '../bin/pidl/pidl --ndr-parser ${TGT[0].abspath()} ${SRC}'
color = 'BLUE'
ext_out = ['.h']
@extension('.idl')
def process_idl(self, node):
header_node = node.change_ext('.h')
self.create_task('idl_header', node, [header_node ])
c_node = node.change_ext('.c')
if c_node.name[:len('ndr_')] != 'ndr_':
c_node.name = 'ndr_' + c_node.name
self.create_task('idl_parser', node, [ c_node ])
self.source.append(c_node)
def dist(ctx):
ctx.base_name = 'siahsd'
ctx.algo = 'tar.bz2'
ctx.excl = ' **/.waf-1* **/*~ **/*.o **/*.swp **/.lock-w*'
ctx.files = ctx.path.ant_glob('**/wscript')
def configure(conf):
conf.env.CC = 'gcc'
conf.load('gcc')
# Check for glib
conf.check_cfg(package='glib-2.0', uselib_store='glib-2.0',
args=['--cflags', '--libs'])
# Check for talloc
conf.check_cfg(package='talloc', uselib_store='talloc',
args=['--cflags', '--libs' ])
# Check for tevent
conf.check_cfg(package='tevent', uselib_store='samba',
args=['--cflags', '--libs' ])
# Check for samba-4.0
conf.check_cfg(package='samba-util', uselib_store='samba',
args=['--cflags', '--libs' ])
# Check for ndr
conf.check_cfg(package='ndr', uselib_store='samba',
args=['--cflags', '--libs'])
# Check for headers
conf.check(header_name='stdio.h', features='c cprogram')
conf.check(header_name='stdlib.h', features='c cprogram')
conf.check(header_name='stdint.h', features='c cprogram')
conf.check(header_name='stdbool.h', features='c cprogram')
conf.check(header_name='sys/time.h', features='c cprogram')
conf.check(header_name='sys/types.h', features='c cprogram')
conf.check(header_name='sys/stat.h', features='c cprogram')
conf.check(header_name='netinet/in.h', features='c cprogram')
conf.check(header_name='arpa/inet.h', features='c cprogram')
conf.check(header_name='unistd.h', features='c cprogram')
conf.check(header_name='string.h', features='c cprogram')
conf.check(header_name='fcntl.h', features='c cprogram')
conf.check(header_name='errno.h', features='c cprogram')
# Used libraries
conf.check(header_name='talloc.h', use='samba', features='c cprogram')
conf.check(header_name='glib.h', use='glib-2.0', features='c cprogram')
conf.check(header_name='dbi/dbi.h', features='c cprogram')
conf.check(header_name='util/data_blob.h', use='samba', features='c cprogram')
#conf.check(header_name='core/ntstatus.h', use='samba', features='c cprogram')
#conf.check(header_name='charset.h', use='samba', features='c cprogram')
conf.check_cc(lib='dbi', uselib_store='dbi')
conf.check_cc(lib='talloc', uselib_store='samba')
conf.check_cc(lib='ndr', uselib_store='ndr')
conf.check_cc(lib='gmp', uselib_store='nettle')
conf.check_cc(lib='hogweed', uselib_store='nettle')
conf.check_cc(lib='nettle', uselib_store='nettle')
# Purposefully at the bottom because waf configuration tests fail with -Wstrict-prototypes and -Werror
conf.env.LDFLAGS = ['-fPIC', '-pie', '-z', 'relro', '-z', 'now', '-fstack-protector', '-L/usr/local/samba/lib']
conf.env.CFLAGS = ['-O0', '-g', '-ggdb', '-std=gnu99', '-Wall', '-Wextra', '-Winit-self', '-Wformat-security','-Wshadow', '-pedantic',
'-Wpointer-arith', '-Wcast-align', '-Wwrite-strings', '-Wno-unused-parameter',
'-Werror-implicit-function-declaration', '-Wstrict-prototypes', '-fPIC', '-pie', '-fstack-protector',
'-D_FORTIFY_SOURCE=2']
def build(bld):
bld.stlib(source="database.c", target="database", use='glib-2.0')
bld.stlib(source="status.c", target="status", use='glib-2.0')
bld.stlib(source="hook_script.c", target="hook_script", use='glib-2.0')
bld.stlib(source="config.c", target="config", use='glib-2.0 database jsonbot hook_script')
bld.stlib(source="sia.c", target="sia", use='glib-2.0')
bld.stlib(source="siahs.c", target="siahs", use='glib-2.0')
bld.stlib(source="jsonbot.c", target="jsonbot", use='glib-2.0')
bld.program(
source = 'siahsd.c',
target = 'siahsd',
use = [ 'database', 'config', 'status', 'sia', 'siahs', 'jsonbot', 'hook_script', 'dbi', 'talloc', 'glib-2.0', 'nettle' ])
bld.program(
source = 'secip.idl secipd.c crc16.c',
target = 'secipd',
use = [ 'database', 'config', 'status', 'sia', 'siahs', 'jsonbot', 'hook_script', 'dbi', 'samba', 'glib-2.0', 'nettle', 'ndr' ])
bld.program(
source = 'chiron.idl chirond.c',
target = 'chirond',
use = [ 'database', 'config', 'status', 'sia', 'jsonbot', 'dbi', 'samba', 'glib-2.0', 'nettle', 'ndr' ])
pass
def clean(ctx):
pass