~emersion/mrsh

ref: 9427393efbef94722d2ac610a06fed0dadf50094 mrsh/meson.build -rw-r--r-- 2.6 KiB
9427393eemersion Add frontend_ prefix to frontend files 3 years 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
project(
	'mrsh',
	'c',
	version: '0.0.0',
	license: 'MIT',
	meson_version: '>=0.43.0',
	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')

readline = cc.find_library('readline', required: false)

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/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/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 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',
)