1
from waflib.Task import Task
2
from waflib.TaskGen import extension
12
ctx.load('compiler_c')
13
ctx.add_option('--datadir',type='string',default='',dest='datadir',help='read-only application data')
16
conf.load('compiler_c')
18
conf.env.CPPFLAGS = ['-Wall', '-Werror', '-g3', '-fstrict-aliasing', '-Wp,-D_FORTIFY_SOURCE=2',
19
'-Wmissing-prototypes', '-Wstrict-prototypes']
21
prefix = conf.options.prefix
22
conf.env.includedir = os.path.join(prefix, "include")
23
libdir = os.path.join(prefix, "lib")
24
mapistore_path = os.path.join(prefix, 'private/mapistore')
27
return getattr(conf.options,varname,'')
29
datadir=getstr('datadir')
30
if not datadir:datadir=os.path.join(prefix,'share')
31
conf.env.datadir = datadir
33
conf.define('MAPISTORE_MAPPING_PATH', mapistore_path)
34
conf.define('MAPISTORE_DBPATH', os.path.join(mapistore_path, "mapistore.ldb"))
35
conf.define('MAPISTORE_LDIF', datadir)
36
conf.define('MAPISTORE_BACKEND_INSTALLDIR', os.path.join(libdir, "mapistore_backends"))
37
conf.define('MAPISTORE_DB_NAMEDPROPS_PATH', os.path.join(mapistore_path, "mapistore_named_properties.ldb"))
39
conf.check_cfg(atleast_pkgconfig_version='0.20')
41
conf.check_cfg(package='ndr',
42
args=['ndr >= 0.0.1', '--cflags', '--libs'],
44
msg="Checking for 'ndr 0.0.1'")
46
conf.check_cfg(package='tdb',
47
args=['tdb >= 1.2.9', '--cflags', '--libs'],
49
msg="Checking for 'tdb 1.2.9'")
51
conf.check_cfg(package='talloc',
52
args=['talloc >= 2.0.5', '--cflags', '--libs'],
53
uselib_store='TALLOC',
54
msg="Checking for 'talloc 2.0.5'")
56
conf.check_cfg(package='samba-hostconfig',
57
args=['--cflags', '--libs'],
58
uselib_store='SAMBA-HOSTCONFIG',
59
msg="Checking for 'samba-hostconfig 0.0.1'")
61
conf.check_cfg(package='libocpf',
62
args=['libocpf >= 0.11', '--cflags', '--libs'],
64
msg="Checking for 'ocpf 0.11'")
66
conf.check_cfg(package='ldb',
67
args=['--cflags', '--libs'],
69
msg="Checking for 'ldb 1.0.1'")
72
conf.find_program('pidl', var='PIDL')
73
except ctx.errors.ConfigurationError:
74
self.fatal("PIDL compiler not found")
76
print("prefix is " + conf.options.prefix)
79
if ctx.cmd == 'install':
80
ctx.exec_command('/sbin/ldconfig')
83
run_str = '${PIDL} --outputdir=indexing --header --ndr-parser -- ${SRC}'
85
ext_out = ['.h', '.c']
88
def process_idl(self, node):
89
ndr_node = node.change_ext('.c')
92
ndr_node.name.index("ndr_")
94
ndr_node.name = "ndr_" + ndr_node.name
95
h_node = node.change_ext('.h')
96
self.create_task('idl', node, [ndr_node, h_node])
97
self.source.append(ndr_node)
101
features = 'c cshlib',
103
'indexing/mapistore_indexing_db.idl',
104
'mapistore_interface.c',
105
'mapistore_processing.c',
106
'mapistore_backend.c',
107
'mapistore_backend_defaults.c',
108
'mapistore_backend_public.c',
109
'mapistore_tdb_wrap.c',
110
'mapistore_ldb_wrap.c',
111
'mapistore_namedprops.c',
112
'mapistore_indexing.c',
113
'database/mapistoredb.c',
114
'database/mapistoredb_conf.c',
115
'database/mapistoredb_namedprops.c',
116
'indexing/mapistore_indexing.c',
118
target = 'mapistore',
119
includes = ['.', '../../', 'build/indexing'],
120
use = ['NDR', 'LDB', 'TDB', 'TALLOC', 'SAMBA-HOSTCONFIG'])
123
features = 'c cshlib',
124
source = ['backends/mapistore_fsocpf.c'],
125
target = 'mapistore_fsocpf',
126
includes = ['.', '../../'],
127
use = ['mapistore', 'OCPF'])
130
features = 'c cshlib',
131
source = ['backends/mapistore_mstoredb.c'],
132
target = 'mapistore_mstoredb',
133
includes = ['.', '../../', 'build/indexing'],
134
use = ['mapistore', 'LDB'])
138
source='libmapistore.pc.in',
139
target='libmapistore.pc',
140
install_path='${LIBDIR}/pkgconfig',
141
PACKAGE_VERSION = VERSION,
142
exec_prefix= bld.options.prefix,
143
datadir = bld.env.datadir,
144
includedir = bld.env.includedir,
145
LIBS = '-ltalloc -ltdb -lsamba-hostconfig')
148
bld.symlink_as('${PREFIX}/lib/libmapistore.so.0', 'libmapistore.so')
149
bld.install_as('${PREFIX}/lib/mapistore_backends/mapistore_mstoredb.so', 'libmapistore_mstoredb.so')
150
bld.install_as('${PREFIX}/lib/mapistore_backends/mapistore_fsocpf.so', 'libmapistore_fsocpf.so')
151
bld.install_files('${PREFIX}/include/mapistore',
153
'mapistore_errors.h',
155
'mapistore_backend.h',
156
'mapistore_common.h'])
157
bld.install_files('${PREFIX}/lib/pkgconfig', 'libmapistore.pc')
159
bld.add_post_fun(post)