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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#!/usr/bin/env python
# This is the experimental scons build script for Samba 4. For a proper
# build use the old build system (configure + make). scons may
# eventually replace this system.
#
# Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL
import cPickle
# We don't care about NFS builds...
opts = Options(None, ARGUMENTS)
opts.AddOptions(
BoolOption('developer','enable developer flags', 0),
PathOption('prefix','installation prefix','/usr/local/samba'),
BoolOption('configure','run configure checks', False),
)
hostenv = Environment(
toolpath=['build/scons','.'],
tools=['default','pidl','proto','et','asn1'],
options=opts,
CPPPATH=['#include','#','#lib'],
CPPDEFINES={'_SAMBA_BUILD_': None},
)
hostenv.SetOption('max_drift', 1)
if hostenv['developer']:
hostenv.Append(CCFLAGS='-Wall')
hostenv.Append(CCFLAGS='-Wshadow')
hostenv.Append(CCFLAGS='-Werror-implicit-function-declaration')
hostenv.Append(CCFLAGS='-Wstrict-prototypes')
hostenv.Append(CCFLAGS='-Wpointer-arith')
hostenv.Append(CCFLAGS='-Wcast-qual')
hostenv.Append(CCFLAGS='-Wcast-align')
hostenv.Append(CCFLAGS='-Wwrite-strings')
hostenv.Append(CCFLAGS='-Wmissing-format-attribute')
hostenv.Append(CCFLAGS='-Wformat=2')
hostenv.Append(CCFLAGS='-Wno-format-y2k')
hostenv.Append(CCFLAGS='-Wno-declaration-after-statement')
# Store configuration data in a dictionary.
def saveconfig(data):
"""Save configuration dict to a file."""
cached = cPickle.dump(data, open('sconf.cache', 'w'))
def loadconfig():
"""Load configuration dict from a file."""
try:
return cPickle.load(open('sconf.cache', 'r'))
except IOError:
return None
defines = loadconfig()
if defines == None:
hostenv['configure'] = 1
defines = {}
Export('defines')
hostenv.Append(CPPPATH = ['#heimdal_build', '#heimdal/lib/krb5',
'#heimdal/lib/hdb', '#heimdal/lib/gssapi',
'#heimdal/lib/asn1', '#heimdal/lib/des',
'#heimdal/kdc', '#heimdal/lib/roken',
'#heimdal/lib/com_err'])
Export('hostenv')
buildenv = hostenv
Export('buildenv')
cross_compiling = 0
if cross_compiling:
buildenv = hostenv.Copy()
buildenv.BuildDir('build-env','.')
dynenv = hostenv.Copy()
paths = {
'BINDIR': 'bin',
'SBINDIR': 'sbin',
'CONFIGFILE': 'cfg',
'LOGFILEBASE': 'lfb',
'NCALRPCDIR': 'ncalrpc',
'LMHOSTSFILE': 'lmhosts',
'LIBDIR': 'libdir',
'SHLIBEXT': 'ext',
'LOCKDIR': 'lockdir',
'PIDDIR': 'piddir',
'PRIVATE_DIR': 'private',
'SWATDIR': 'swat'
}
Export('paths')
if hostenv['configure']:
conf = hostenv.Configure()
for h in ['sys/select.h','fcntl.h','sys/fcntl.h','sys/time.h'] + \
['utime.h','grp.h','sys/id.h','limits.h','memory.h'] + \
['compat.h','math.h','sys/param.h','ctype.h','sys/wait.h'] + \
['sys/resource.h','sys/ioctl.h','sys/ipc.h','sys/mode.h'] + \
['sys/mman.h','sys/filio.h','sys/priv.h','sys/shm.h','string.h'] + \
['strings.h','stdlib.h','sys/vfs.h','sys/fs/s5param.h','sys/filsys.h'] + \
['termios.h','termio.h','fnmatch.h','pwd.h','sys/termio.h'] + \
['sys/time.h','sys/statfs.h','sys/statvfs.h','stdarg.h'] + \
['security/pam_modules.h','security/_pam_macros.h','dlfcn.h'] + \
['sys/syslog.h','syslog.h','stdint.h','inttypes.h','locale.h'] + \
['shadow.h','nss.h','nss_common.h','ns_api.h','sys/security.h'] + \
['security/pam_appl.h','sys/capability.h','syscall.h','sys/syscall.h'] + \
['sys/acl.h']:
if conf.CheckCHeader(h):
defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1
for f in ['dlopen','dlsym','dlerror','waitpid','getcwd','strdup'] + \
['strndup','strnlen','strerror','chroot','bzero','memset','strlcpy'] + \
['strlcat','memmove','vsnprintf','snprintf','asprintf','vasprintf'] + \
['setsid','pipe','crypt16','getauthuid','strftime','sigprocmask'] + \
['sigblock','sigaction','innetgr','setnetgrent','getnetgrent'] + \
['endnetgrent','initgroups','setgroups','sysconf','mktime','rename'] + \
['ftruncate','chsize','getpwanam','setlinebuf','srandom','random'] + \
['srand','rand','setenv','usleep','syslog','vsyslog','timegm'] + \
['backtrace','setbuffer','pread','pwrite']:
if conf.CheckFunc(f):
defines['HAVE_' + f.upper()] = 1
conf.Finish()
[dynenv.Append(CPPDEFINES = {p: '\\"%s\\"' % paths[p]}) for p in paths]
dynconfig = dynenv.Object('dynconfig.c')
Export('dynconfig')
proto_files = []
Export('proto_files')
SConscript(
dirs=['lib','torture','rpc_server','cldap_server','libcli',
'nbt_server','client','ldap_server','libnet','nsswitch','web_server',
'smbd','dsdb','heimdal_build','ntptr','kdc','smb_server','ntvfs',
'winbind','scripting','auth'])
hostenv.CProtoHeader(target='include/proto.h',source=proto_files)
# Save configuration
if hostenv['configure']:
saveconfig(defines)
# How to create config.h file
def create_config_h(env, target, source):
fd = open(str(target[0]), 'w')
[fd.write('#define %s\n' % x) for x in defines]
fd.close()
def create_config_h_print(*args, **kwargs):
print 'Building config.h'
hostenv.Command('include/config.h', [],
Action(create_config_h, create_config_h_print))
hostenv.Append(CPPDEFINES = {'HAVE_CONFIG_H': 1})
|