1 # Build settings based on the upstream Xcode project.
2 # See: https://github.com/apple-oss-distributions/shell_cmds/blob/main/shell_cmds.xcodeproj/project.pbxproj
5 project('shell_cmds', 'c', 'cpp', version : '@version@')
6 add_global_arguments('-D__FBSDID=__RCSID', language : 'c')
11 build_cc = meson.get_compiler('c', native : true)
13 host_cc = meson.get_compiler('c')
14 host_cxx = meson.get_compiler('cpp')
17 # pam = cc.find_library('pam')
18 libbsd = dependency('libbsd-overlay', required : false)
19 libedit = dependency('libedit')
20 libresolv = host_cc.find_library('resolv')
21 libsbuf = host_cc.find_library('sbuf')
22 libutil = host_cc.find_library('util')
23 libxo = dependency('libxo')
28 find_program('bison', required : true),
29 arguments : ['@INPUT@', '--header=@OUTPUT0@', '--output=@OUTPUT1@'],
30 output : [ '@BASENAME@.tab.h', '@BASENAME@.tab.c'],
36 ## These commands all are single files with a man page.
53 'nohup', # needs vproc_priv.h
75 foreach cmd : single_file_cmds
79 sources : [ f'@cmd@/@cmd@.c' ],
81 foreach section : [ 1, 2, 3, 4, 5, 6, 7, 8 ]
82 if fs.exists(f'@cmd@/@cmd@.@section@')
83 install_man(f'@cmd@/@cmd@.@section@')
90 install_dir : get_option('bindir'),
91 install_mode : 'r-xr-xr-x',
98 foreach alias : run_command('cat', 'xcodescripts/builtins.txt', check : true).stdout().strip().split('\n')
101 install_dir : get_option('bindir'),
102 pointing_to : 'alias',
108 dependencies : libsbuf,
110 sources : [ 'apply/apply.c' ],
112 install_man('apply/apply.1')
116 include_directories : 'date',
123 install_man('date/date.1')
127 include_directories : 'env',
134 install_man('env/env.1')
140 bison.process('expr/expr.y')
143 install_man('expr/expr.1')
147 c_args : [ '-D_DARWIN_USE_64_BIT_INODE' ],
148 include_directories : 'find',
158 bison.process('find/getdate.y'),
161 install_man('find/find.1')
165 include_directories : 'hexdump',
171 'hexdump/hexsyntax.c',
172 'hexdump/odsyntax.c',
182 install_dir : get_option('bindir'),
183 pointing_to : 'hexdump',
188 c_args : [ '-DUSE_BSM_AUDIT' ],
189 include_directories : 'id',
193 # 'id/open_directory.c', # Not actually used and doesn’t compile anyway.
201 foreach cmd : [ 'groups', 'whoami' ]
204 install_dir : get_option('bindir'),
211 include_directories : 'locate/locate',
214 'locate/locate/locate.c',
215 'locate/locate/util.c',
220 include_directories : 'locate/locate',
222 sources : [ 'locate/bigram/locate.bigram.c', ],
226 include_directories : 'locate/locate',
228 sources : [ 'locate/code/locate.code.c', ],
231 'locate/locate/locate.rc',
232 install_dir : get_option('sysconfdir'),
235 'locate/locate/concatdb.sh',
236 'locate/locate/updatedb.sh',
237 'locate/locate/mklocatedb.sh',
238 install_dir : get_option('libexecdir'),
239 install_mode : 'r-xr-xr-x',
247 'locate/locate/locate.1',
248 'locate/locate/locate.updatedb.8',
249 'locate/bigram/locate.bigram.8',
250 'locate/code/locate.code.8',
252 foreach manpage : [ 'concatdb', 'mklocatedb' ]
254 f'locate.@manpage@.8',
255 install_dir : get_option('mandir') + '/man8',
256 pointing_to : 'locate.updatedb.8',
262 dependencies : [ libbsd ],
264 sources : [ 'lockf/lockf.c' ],
266 install_man('lockf/lockf.1')
268 # Building `sh` requires several custom targets to generate files it needs.
270 bash_bin = find_program('bash')
271 mknodes = executable('mknodes', sources : 'sh/mknodes.c', native : true)
272 mksyntax = executable('mksyntax', sources : 'sh/mksyntax.c', native : true)
274 builtins = custom_target(
275 command : [ bash_bin, '@SOURCE_ROOT@/sh/mkbuiltins', '@SOURCE_ROOT@/sh'],
276 output : [ 'builtins.c', 'builtins.h' ],
279 nodes = custom_target(
280 command : [ mknodes, '@SOURCE_ROOT@/sh/nodetypes', '@SOURCE_ROOT@/sh/nodes.c.pat' ],
281 output : [ 'nodes.c', 'nodes.h' ],
284 syntax = custom_target(
285 command : [ mksyntax ],
286 output : [ 'syntax.c', 'syntax.h' ],
289 tokens = custom_target(
290 command : [ bash_bin, '@SOURCE_ROOT@/sh/mktokens' ],
296 c_args : [ '-DSHELL' ],
297 dependencies : [ libedit ],
298 include_directories : [ 'sh', 'sh/bltin' ],
334 install_man('sh/sh.1')
336 # Requires entitlements
339 # dependencies : pam,
340 # sources : [ 'su/su.c' ],
344 # install_dir : get_option('sysconfdir') + 'pam.d',
347 # install_man('su/su.1')
352 sources : [ 'stdbuf/stdbuf.c' ],
354 install_man('stdbuf/stdbuf.1')
359 sources : [ 'test/test.c' ],
367 install_dir : get_option('bindir'),
375 sources : [ 'users/users.cc' ],
377 install_man('users/users.1')
385 dependencies : [ libresolv, libsbuf, libutil, libxo ],
386 include_directories : 'w',
401 install_dir : get_option('bindir'),
412 sources : [ 'who/who.c' ],
414 install_man('who/who.1')
418 dependencies : [ libbsd ],
419 include_directories : 'xargs',
426 install_man('xargs/xargs.1')