-
Notifications
You must be signed in to change notification settings - Fork 2
/
wscript
162 lines (133 loc) · 5.12 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
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# WAF build script - this file is part of ZFS-Fuse, a port of the Solaris ZFS to Linux
#
# Sandeep S Srinivasa <sandys(at)gmail(dot)com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# $Id$
"""
This is a WAF build script (http://code.google.com/p/waf/).
It can be used as an alternative build system to autotools
for zfs-fuse.
"""
import Build, Configure, Options, Runner, Task, Utils
import sys, os, subprocess, shutil
from distutils import version
from Logs import error, debug, warn
APPNAME = 'zfs-fuse'
VERSION = '0.7.0'
srcdir = '.'
blddir = '__build'
subdirs = """
src/lib/libsolcompat/
src/lib/libumem/
src/lib/libavl/
src/lib/libsolkerncompat/
src/lib/libnvpair/
src/lib/libuutil/
src/lib/libzpool/
src/lib/libzfs/
src/lib/libzfscommon/
src/zfs-fuse/
src/cmd/zfs/
src/cmd/zpool/
src/cmd/zstreamdump/
src/cmd/zdb/
src/cmd/ztest/
""".split()
#####
#Cmd Line Options
####
def set_options(opt):
opt.add_option('--prefix', type='string',help='set install path prefix', dest='usr_prefix')
opt.add_option('--build', action='store', default='debug,release', help='Choose \'debug/release/debug,release\'')
def init(ctx):
import Configure
####
#Configuration
####
def configure(conf):
# import Options # getting the user-provided options to the configuration section
# if Options.options.usr_prefix
# Options.prefix = Options.options.usr_prefix
conf.check_tool('gcc glib2')
# conf.env.CCFLAGS = ['-Wall']
conf.env.ASFLAGS = ["-c"]
conf.env.CCFLAGS = ['-pipe', '-Wall', '-std=gnu99', '-Wno-switch', '-Wno-unused', '-Wno-missing-braces', '-Wno-parentheses', '-Wno-uninitialized', '-fno-strict-aliasing', '-D_GNU_SOURCE', '-DLINUX_AIO']
conf.env.INCLUDEDIR = ['/usr/include/']
# conf.env['INCLUDEDIR'] = '/usr/include'
# conf.define('_FILE_OFFSET_BITS', 64)
# conf.write_config_header('config.h')
conf.check(header_name="aio.h", uselib_store='aio_defines', mandatory=True)
conf.check(lib='aio', uselib_store='aio_lib', mandatory=True)
conf.check(lib='ssl', uselib_store='openssl', mandatory=True)
conf.check(lib='crypto', uselib_store='crypto', mandatory=True)
conf.check(lib='pthread', uselib_store='pthread_lib', mandatory=True)
conf.check_cc(lib='fuse', uselib_store='fuse_lib', mandatory=True)
conf.check_cc(lib='dl', uselib_store='dl_lib', mandatory=True)
conf.check_cc(lib='z', uselib_store='z_lib', mandatory=True)
conf.check_cc(lib='m', uselib_store='m_lib', mandatory=True)
conf.check_cc(header_name='fuse/fuse_lowlevel.h', includes=['/usr/include/'],
ccflags='-D_FILE_OFFSET_BITS=64', uselib_store='fuse_defines', mandatory=True)
conf.check(
fragment='#include <sys/types.h>\n #include <attr/xattr.h>\nint main() { return 0; }\n',
define_name='xattr_defines',
execute=1,
define_ret=1,
mandatory=True,
msg='Checking for <attr/xattr.h>')
conf.check_cc(lib='rt', uselib_store='rt_lib', mandatory=True)
conf.check_tool('gas')
#if not conf.env.AS: conf.env.AS = conf.env.CC
conf.env.AS = conf.env.CC
###################### install configuration ################
conf.check_tool('gnu_dirs')
warn(" setting MANDIR = %s" % conf.env.MANDIR)
conf.env.PREFIX = '/'
conf.env.MANDIR = '/usr/share/man/man8'
dbg = conf.env.copy()
rel = conf.env.copy()
dbg.set_variant('debug')
conf.set_env_name('debug', dbg)
conf.setenv('debug')
#sss - this is a hack. dunno why ASFLAGS dont propagate. maybe a bug
conf.env.ASFLAGS='-c'
conf.env.CCFLAGS += ['-DDBG_ENABLED']
rel.set_variant('release')
conf.set_env_name('release', rel)
conf.setenv('release')
#sss - this is a hack. dunno why ASFLAGS dont propagate. maybe a bug
conf.env.ASFLAGS='-c'
conf.env.CCFLAGS += ['-O2']
conf.sub_config("src/lib/libumem")
####
#Build
####
def build(bld):
bld.add_subdirs(subdirs)
bld.includes = '/usr/include/'
#man_list = bld.path.ant_glob('doc/*.gz')
bld.install_files('${MANDIR}', 'doc/*.gz')
# enable the debug or the release variant, depending on the one wanted
for obj in bld.all_task_gen[:]:
debug_obj = obj.clone('debug')
release_obj = obj.clone('release')
#disable "default"
obj.posted = 1
# disable the unwanted variant(s)
build_type = Options.options.build
if build_type.find('debug') < 0:
debug_obj.posted = 1
if build_type.find('release') < 0:
release_obj.posted = 1