~emersion/mrsh

ref: bda92abbcf206e6374593ee7e1962ba6341be98e mrsh/meson.build -rw-r--r-- 3.0 KiB View raw
bda92abbemersion Fix error handling in basic frontend 1 year, 2 months ago
                                                                                
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
project(
	'mrsh',
	'c',
	version: '0.0.0',
	license: 'MIT',
	meson_version: '>=0.37.1',
	default_options: [
		'c_std=c99',
		'warning_level=2',
		'werror=true',
	],
)

add_project_arguments('-Wno-unused-parameter', language: 'c')
add_project_arguments('-Wno-missing-braces', language: 'c')
add_project_arguments('-Wno-missing-field-initializers', language: 'c')

cc = meson.get_compiler('c')

if get_option('readline') != 'disabled'
	if get_option('readline-provider') == 'readline'
		readline = cc.find_library(
			'readline',
			required: get_option('readline') == 'enabled',
		)
		add_project_arguments('-DHAVE_READLINE', language: 'c')
	else # editline
		readline = dependency(
			'libedit',
			required: get_option('readline') == 'enabled',
		)
		add_project_arguments('-DHAVE_EDITLINE', language: 'c')
	endif
endif

mrsh_inc = include_directories('include')

install_subdir('include/mrsh', install_dir: get_option('includedir'))

libmrsh_sym_path = meson.current_source_dir() + '/libmrsh.sym'

lib_mrsh = library(
	meson.project_name(),
	files(
		'arithm.c',
		'array.c',
		'ast_print.c',
		'ast.c',
		'buffer.c',
		'builtin/alias.c',
		'builtin/builtin.c',
		'builtin/cd.c',
		'builtin/colon.c',
		'builtin/dot.c',
		'builtin/eval.c',
		'builtin/exit.c',
		'builtin/export.c',
		'builtin/false.c',
		'builtin/getopts.c',
		'builtin/pwd.c',
		'builtin/read.c',
		'builtin/set.c',
		'builtin/shift.c',
		'builtin/times.c',
		'builtin/true.c',
		'builtin/type.c',
		'builtin/umask.c',
		'builtin/unalias.c',
		'builtin/unset.c',
		'hashtable.c',
		'parser/arithm.c',
		'parser/parser.c',
		'parser/program.c',
		'parser/word.c',
		'shell/arithm.c',
		'shell/path.c',
		'shell/process.c',
		'shell/redir.c',
		'shell/shell.c',
		'shell/task/assignment.c',
		'shell/task/ast.c',
		'shell/task/async.c',
		'shell/task/binop.c',
		'shell/task/command_builtin.c',
		'shell/task/command_function.c',
		'shell/task/command_process.c',
		'shell/task/command.c',
		'shell/task/for_clause.c',
		'shell/task/function_definition.c',
		'shell/task/if_clause.c',
		'shell/task/list.c',
		'shell/task/loop_clause.c',
		'shell/task/pipeline.c',
		'shell/task/subshell.c',
		'shell/task/task.c',
		'shell/task/word.c',
		'shell/word.c',
	),
	include_directories: mrsh_inc,
	version: meson.project_version(),
	link_args: ['-Wl,--version-script=' + libmrsh_sym_path],
	install: true,
)

mrsh = declare_dependency(
	link_with: lib_mrsh,
	include_directories: mrsh_inc,
)

shell_deps = [mrsh]
shell_files = [
	'main.c'
]
if get_option('readline') != 'disabled' and readline.found()
	shell_deps += [readline]
	shell_files += ['frontend/readline.c']
else
	shell_files += ['frontend/basic.c']
endif

mrsh_exe = executable(
	'mrsh',
	files(shell_files),
	dependencies: shell_deps,
	install: true,
)

executable(
	'highlight',
	files([
		'highlight.c',
	]),
	dependencies: [mrsh],
)

subdir('test')

pkgconfig = import('pkgconfig')
pkgconfig.generate(
	libraries: lib_mrsh,
	version: meson.project_version(),
	filebase: meson.project_name(),
	name: meson.project_name(),
	description: 'POSIX shell library',
)