forked from chendo/fish
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwscript
206 lines (180 loc) · 4.8 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# /usr/bin/env python
import re
import Options
import sys, os, shutil
from Utils import cmd_output, subst_vars
from os.path import join, dirname, abspath
from logging import fatal
cwd = os.getcwd()
VERSION="1.23.1.1"
APPNAME="fish"
srcdir = '.'
blddir = 'build'
sources_for_tasks = {
'fish': """
src/function.c
src/builtin.c
src/complete.c
src/env.c
src/exec.c
src/expand.c
src/highlight.c
src/history.c
src/kill.c
src/parser.c
src/proc.c
src/reader.c
src/sanity.c
src/tokenizer.c
src/wildcard.c
src/wgetopt.c
src/wutil.c
src/input.c
src/output.c
src/intern.c
src/env_universal.c
src/env_universal_common.c
src/input_common.c
src/event.c
src/signal.c
src/io.c
src/parse_util.c
src/common.c
src/screen.c
src/path.c
src/parser_keywords.c
src/fish.c
""",
'fishd': """
src/fishd.c
src/env_universal_common.c
src/wutil.c
src/print_help.c
src/common.c
""",
'fish_pager': """
src/fish_pager.c
src/output.c
src/wutil.c
src/input_common.c
src/env_universal.c
src/env_universal_common.c
src/common.c
src/print_help.c
""",
'fish_indent': """
src/fish_indent.c
src/print_help.c
src/common.c
src/parser_keywords.c
src/wutil.c
src/tokenizer.c
""",
'mimedb': """
src/mimedb.c
src/print_help.c
src/xdgmimealias.c
src/xdgmime.c
src/xdgmimeglob.c
src/xdgmimeint.c
src/xdgmimemagic.c
src/xdgmimeparent.c
src/wutil.c
src/common.c
""",
'set_color': """
src/set_color.c
src/print_help.c
src/common.c
src/wutil.c
"""
}
def mkdir_p(dir):
if not os.path.exists (dir):
os.makedirs (dir)
def set_options(opt):
opt.tool_options('compiler_cc')
opt.tool_options('misc')
opt.add_option( '--debug'
, action='store_true'
, default=False
, help='Build debug variant [Default: False]'
, dest='debug'
)
def configure(conf):
mkdir_p('build/cache/')
conf.check_tool('compiler_cc')
conf.env["USE_DEBUG"] = Options.options.debug
conf.check(lib='dl', uselib_store='DL')
conf.env.append_value("CCFLAGS", "-rdynamic")
conf.env.append_value("LINKFLAGS_DL", "-rdynamic")
#if Options.options.debug:
# conf.check(lib='profiler', uselib_store='PROFILER')
#if Options.options.efence:
# conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE')
# conf.sub_config('deps/libeio')
# conf.sub_config('deps/libev')
# conf_subproject(conf, 'deps/udns', './configure')
conf.define("HAVE_CONFIG_H", 1)
conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
# LFS
conf.env.append_value('CCFLAGS', '-D_LARGEFILE_SOURCE')
conf.env.append_value('CCFLAGS', '-D_FILE_OFFSET_BITS=64')
# platform
platform_def = '-DPLATFORM=' + sys.platform
conf.env.append_value('CCFLAGS', platform_def)
# Split off debug variant before adding variant specific defines
debug_env = conf.env.copy()
conf.set_env_name('debug', debug_env)
# Configure debug variant
conf.setenv('debug')
debug_env.set_variant('debug')
debug_env.append_value('CCFLAGS', ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra'])
conf.write_config_header("config.h")
# Configure default variant
conf.setenv('default')
conf.env.append_value('CCFLAGS', ['-DNDEBUG', '-O3'])
conf.write_config_header("config.h")
def build_task(bld, name, extra_linkflags = None):
task = bld.new_task_gen("cc", "program")
task.name = name
task.target = name
task.source = sources_for_tasks[name]
task.ccflags = [
"-std=c99",
"-g",
"-O2",
"-Wall",
"-rdynamic",
"-iquote../include"
]
task.defines = map(lambda s: subst_vars(s, bld.env), [
'PREFIX=L"${PREFIX}"',
'DATADIR=L"${PREFIX}/share"',
'SYSCONFDIR=L"${PREFIX}/etc"',
'LOCALEDIR="${PREFIX}/share/locale"'
])
task.includes = """
src/
"""
task.linkflags = [
"-lncurses"
]
if extra_linkflags != None:
task.linkflags.append(extra_linkflags)
bld.install_files('${PREFIX}/bin/', [name], chmod = 0755)
task.chmod = 0755
return task
def build(bld):
build_task(bld, "fish", "-liconv")
build_task(bld, "fishd", "-liconv")
build_task(bld, "fish_pager", "-liconv")
build_task(bld, "fish_indent")
build_task(bld, "mimedb")
build_task(bld, "set_color")
bld.install_files('${PREFIX}/bin/', 'bin/seq', chmod = 0755)
bld.install_files('${PREFIX}/etc/fish/', 'etc/config.fish')
bld.install_files('${PREFIX}/share/fish/', 'share/config.fish')
bld.install_files('${PREFIX}/share/fish/completions/', 'share/completions/*')
bld.install_files('${PREFIX}/share/fish/functions/', 'share/functions/*')
bld.install_files('${PREFIX}/share/man/man1/', 'share/man/*')