core/pkgs/by-name/da/darwin/packages/apple-source-releases/system_cmds/meson.build
2024-05-13 11:34:52 -04:00

545 lines
13 KiB
Meson
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Build settings based on the upstream Xcode project.
# See: https://github.com/apple-oss-distributions/system_cmds/blob/main/system_cmds.xcodeproj/project.pbxproj
# Project settings
project('system_cmds', 'c', version : '@version@')
if host_machine.system() != 'linux'
add_project_arguments('-D__FreeBSD__', language : 'c')
endif
sdk_version = get_option('sdk_version')
# Dependencies
cc = meson.get_compiler('c')
# Upstream uses awk to process `.gperf` files instead of gperf, which cant process them.
fake_gperf = find_program('awk', required : true)
## Frameworks
core_foundation = dependency('appleframeworks', modules : 'CoreFoundation')
core_symbolication = dependency('appleframeworks', modules : 'CoreSymbolication')
directory_service = dependency('appleframeworks', modules : 'DirectoryService')
iokit = dependency('appleframeworks', modules : 'IOKit')
kernel = declare_dependency(include_directories : '@kernel@/Library/Frameworks/Kernel.framework/Headers')
open_directory = dependency('appleframeworks', modules : 'OpenDirectory')
## Private Headers
cfopen_directory = declare_dependency(
dependencies : declare_dependency(
compile_args :[ '-iframework', '@opendirectory@/Library/Frameworks/OpenDirectory.framework/Frameworks' ],
),
include_directories : '@opendirectory_private@/include',
)
libc_private = declare_dependency(include_directories : '@libc_private@/include')
libmalloc_private = declare_dependency(include_directories : '@libmalloc_private@/include')
xnu_include_dirs = [
'@xnu@/include/bsd',
'@xnu@/include/libkern',
'@xnu@/include/iokit',
'@xnu@/include/osfmk',
'@xnu_private@/include'
]
if sdk_version.version_compare('>=10.13')
xnu_include_dirs += '@xnu@/include/san'
endif
xnu_private = declare_dependency(
compile_args : [
# Suppresses suffixing symbols with '$UNIX2003', which causes link failures.
'-D__DARWIN_ONLY_UNIX_CONFORMANCE=1',
# Make sure Darwin is correctly detected as macOS
'-DPLATFORM_MacOSX=1',
# Access private definitions
'-DPRIVATE=1'
],
include_directories : xnu_include_dirs
)
## Libraries
ncurses = dependency('ncurses')
openbsm = cc.find_library('bsm')
pam = cc.find_library('pam')
# Feature Tests
if sdk_version.version_compare('<12')
add_project_arguments('-DkIOMainPortDefault=kIOMasterPortDefault', language : 'c')
add_project_arguments('-DIOMainPort=IOMasterPort', language : 'c')
endif
# Generators
pgperf = generator(
fake_gperf,
arguments : [ '-f', meson.source_root() + '/getconf/fake-gperf.awk', '@INPUT@' ],
capture : true,
output : '@BASENAME@.gperf.c'
)
# Binaries
executable('ac', install : true, sources : 'ac/ac.c')
install_man('ac/ac.8')
executable('accton', install : true, sources : 'accton/accton.c')
install_man('accton/accton.8')
executable(
'arch',
build_by_default : sdk_version.version_compare('>=11'),
install : sdk_version.version_compare('>=11'),
sources : 'arch/arch.c'
)
install_man(
'arch/arch.1',
'arch/machine.1'
)
executable(
'at',
c_args : [
'-DDAEMON_UID=1',
'-DDAEMON_GID=1',
'-DDEFAULT_AT_QUEUE=\'a\'',
'-DDEFAULT_BATCH_QUEUE=\'b\'',
'-DPERM_PATH="/usr/lib/cron"',
],
install : true,
sources : [
'at/at.c',
'at/panic.c',
'at/parsetime.c',
'at/perm.c'
]
)
install_man('at/at.1')
executable(
'atrun',
c_args : [ '-DDAEMON_UID=1', '-DDAEMON_GID=1' ],
include_directories : 'at',
install : true,
sources : [
'atrun/atrun.c',
'atrun/gloadavg.c'
]
)
install_man('atrun/atrun.8')
executable(
'chkpasswd',
c_args : '-DUSE_PAM',
dependencies : [ core_foundation, open_directory, pam ],
install : true,
sources : [
'chkpasswd/file_passwd.c',
'chkpasswd/nis_passwd.c',
'chkpasswd/od_passwd.c',
'chkpasswd/pam_passwd.c',
'chkpasswd/passwd.c',
'chkpasswd/stringops.c'
]
)
install_man('chkpasswd/chkpasswd.8')
executable(
'chpass',
dependencies : [ cfopen_directory, directory_service, open_directory ],
install : true,
sources : [
'chpass/chpass.c',
'chpass/edit.c',
'chpass/field.c',
'chpass/open_directory.c',
'chpass/table.c',
'chpass/util.c'
]
)
install_man('chpass/chpass.1')
executable('cpuctl', install : true, sources : 'cpuctl/cpuctl.c')
install_man('cpuctl/cpuctl.8')
executable('dmesg', install : true, sources : 'dmesg/dmesg.c')
install_man('dmesg/dmesg.8')
executable(
'dynamic_pager',
c_args : '-DNO_DIRECT_RPC',
install : true,
sources : 'dynamic_pager/dynamic_pager.c'
)
install_man('dynamic_pager/dynamic_pager.8')
executable(
'fs_usage',
# Requires 'ktrace/session.h'
build_by_default : false,
install : false,
sources : 'fs_usage/fs_usage.c'
)
# install_man('fs_usage/fs_usage.1')
executable(
'gcore',
# Requires XPC private APIs
build_by_default : false and sdk_version.version_compare('>=11'),
install : false and sdk_version.version_compare('>=11'),
sources : [
'gcore/convert.c',
'gcore/corefile.c',
'gcore/dyld.c',
'gcore/dyld_shared_cache.c',
'gcore/main.c',
'gcore/sparse.c',
'gcore/threads.c',
'gcore/utils.c',
'gcore/vanilla.c',
'gcore/vm.c'
]
)
# install_man('gcore/gcore-internal.1', 'gcore/gcore.1')
executable(
'getconf',
c_args : '-DAPPLE_GETCONF_UNDERSCORE',
include_directories : 'getconf',
install : true,
sources : [
'getconf/getconf.c',
] + pgperf.process(
[
'getconf/confstr.gperf',
'getconf/limits.gperf',
'getconf/unsigned_limits.gperf',
'getconf/progenv.gperf',
'getconf/sysconf.gperf',
'getconf/pathconf.gperf'
]
)
)
install_man('getconf/getconf.1')
executable(
'getty',
install : true,
sources : [
'getty/chat.c',
'getty/init.c',
'getty/main.c',
'getty/subr.c'
]
)
install_man(
'getty/getty.8',
'getty/gettytab.5',
'getty/ttys.5'
)
executable('hostinfo', install : true, sources : 'hostinfo/hostinfo.c')
install_man('hostinfo/hostinfo.8')
executable(
'iosim',
dependencies : [ core_foundation, iokit ],
include_directories : 'at',
install : true,
sources : 'iosim/iosim.c'
)
install_man('iosim/iosim.1')
executable(
'iostat',
dependencies : [ core_foundation, iokit ],
install : true,
sources : 'iostat/iostat.c'
)
install_man('iostat/iostat.8')
executable(
'kpgo',
dependencies : [ xnu_private ],
install : true,
sources : 'kpgo/kpgo.c'
)
# No man pages for `kpgo`
executable(
'latency',
build_by_default : sdk_version.version_compare('>=12'),
dependencies : ncurses,
install : sdk_version.version_compare('>=12'),
sources : 'latency/latency.c'
)
if sdk_version.version_compare('>=12')
install_man('latency/latency.1')
endif
executable(
'login',
# Requires SoftLinking/WeakLinking.h and end-point security entitlements
build_by_default : false,
c_args : '-DUSE_BSM_AUDIT=1',
dependencies : [ openbsm, xnu_private ],
install : false,
sources : [
'login/login.c',
'login/login_audit.c'
]
)
# install_man('login/login.1')
executable(
'lskq',
build_by_default : sdk_version.version_compare('>=12'),
install : sdk_version.version_compare('>=12'),
sources : 'lskq/lskq.c'
)
if sdk_version.version_compare('>=12')
install_man('lskq/lskq.1')
endif
executable(
'lsmp',
build_by_default : sdk_version.version_compare('>=12'),
install : sdk_version.version_compare('>=12'),
sources : [
'lsmp/lsmp.c',
'lsmp/port_details.c',
'lsmp/task_details.c'
]
)
if sdk_version.version_compare('>=12')
install_man('lsmp/lsmp.1')
endif
executable(
'ltop',
install : true,
sources : 'ltop/ltop.c'
)
install_man('ltop/ltop.1')
executable('mean', install : true, sources : 'mean/mean.c')
# No man pages for `mean`.
executable(
'memory_pressure',
dependencies : [ xnu_private ],
install : true,
sources : 'memory_pressure/memory_pressure.c'
)
install_man('memory_pressure/memory_pressure.1')
executable('mkfile', install : true, sources : 'mkfile/mkfile.c')
install_man('mkfile/mkfile.8')
executable(
'mslutil',
build_by_default : sdk_version.version_compare('>=10.13'),
dependencies : [ libmalloc_private ],
install : sdk_version.version_compare('>=10.13'),
sources : 'mslutil/mslutil.c'
)
if sdk_version.version_compare('>=10.13')
install_man('mslutil/mslutil.1')
endif
executable('newgrp', install : true, sources : 'newgrp/newgrp.c')
install_man('newgrp/newgrp.1')
executable('nologin', install : true, sources : 'nologin/nologin.c')
install_man(
'nologin/nologin.5',
'nologin/nologin.8'
)
executable(
'nvram',
c_args : '-DTARGET_OS_BRIDGE=0',
dependencies : [ iokit, libc_private, xnu_private ],
install : true,
sources : 'nvram/nvram.c'
)
install_man('nvram/nvram.8')
custom_target(
'pagesize',
command : [ 'cp', '@INPUT@', '@OUTPUT@' ],
install : true,
install_dir : get_option('bindir'),
install_mode : 'r-xr-xr-x',
input : 'pagesize/pagesize.sh',
output : 'pagesize'
)
install_man('pagesize/pagesize.1')
executable(
'passwd',
dependencies : [ cfopen_directory, directory_service, open_directory, pam ],
install : true,
sources : [
'passwd/file_passwd.c',
'passwd/nis_passwd.c',
'passwd/od_passwd.c',
'passwd/pam_passwd.c',
'passwd/passwd.c'
]
)
install_man('passwd/passwd.1')
executable(
'proc_uuid_policy',
install : true,
sources : 'proc_uuid_policy/proc_uuid_policy.c'
)
install_man('proc_uuid_policy/proc_uuid_policy.1')
executable('purge', install : true, sources : 'purge/purge.c')
install_man('purge/purge.8')
executable(
'pwd_mkdb',
c_args : [ '-D_PW_NAME_LEN=MAXLOGNAME', '-D_PW_YPTOKEN="__YP!"' ],
install : true,
sources : [
'pwd_mkdb/pw_scan.c',
'pwd_mkdb/pwd_mkdb.c'
]
)
install_man('pwd_mkdb/pwd_mkdb.8')
executable(
'reboot',
# Requires IOKitUser kext APIs
build_by_default : false,
install : false,
sources : 'reboot/reboot.c'
)
# install_man('reboot/reboot.8')
executable(
'sa',
c_args : '-DAHZV1',
install : true,
sources : [
'sa/db.c',
'sa/main.c',
'sa/pdb.c',
'sa/usrdb.c'
]
)
install_man('sa/sa.8')
executable(
'sc_usage',
build_by_default : sdk_version.version_compare('>=12'),
dependencies : ncurses,
install : sdk_version.version_compare('>=12'),
sources : 'sc_usage/sc_usage.c'
)
if sdk_version.version_compare('>=12')
install_man('sc_usage/sc_usage.1')
endif
executable('shutdown',
# Requires IOKitUser kext APIs
build_by_default : false,
install : false,
sources : 'shutdown/shutdown.c'
)
# install_man('shutdown/shutdown.8')
executable(
'stackshot',
build_by_default : sdk_version.version_compare('>=10.13'),
dependencies : [ xnu_private ],
install : sdk_version.version_compare('>=10.13'),
sources : 'stackshot/stackshot.c'
)
# No man pages for `stackshot`.
executable('sync', install : true, sources : 'sync/sync.c')
# No man pages for `sync`.
executable('sysctl', install : true, sources : 'sysctl/sysctl.c')
install_man(
'sysctl/sysctl.8',
'sysctl/sysctl.conf.5'
)
executable(
'taskpolicy',
build_by_default : sdk_version.version_compare('>=11'),
dependencies : [ xnu_private ],
install : sdk_version.version_compare('>=11'),
sources : 'taskpolicy/taskpolicy.c'
)
if sdk_version.version_compare('>=11')
install_man('taskpolicy/taskpolicy.8')
endif
executable('vifs', install : true, sources : 'vifs/vifs.c')
install_man('vifs/vifs.8')
executable(
'vipw',
install : true,
sources : [
'vipw/pw_util.c',
'vipw/vipw.c'
]
)
install_man('vipw/vipw.8')
executable('vm_purgeable_stat',
build_by_default : sdk_version.version_compare('>=11'),
install : sdk_version.version_compare('>=11'),
sources : 'vm_purgeable_stat/vm_purgeable_stat.c'
)
if sdk_version.version_compare('>=11')
install_man('vm_purgeable_stat/vm_purgeable_stat.1')
endif
executable('vm_stat', install : true, sources : 'vm_stat/vm_stat.c')
install_man('vm_stat/vm_stat.1')
executable('wait4path', install : true, sources : 'wait4path/wait4path.c')
install_man('wait4path/wait4path.1')
executable('wordexp-helper', install : true, sources : 'wordexp-helper/wordexp-helper.c')
# No man pages for `wordexp-helper`.
executable('zdump', include_directories : 'zic', install : true, sources : 'zdump/zdump.c')
install_man('zdump/zdump.8')
executable('zic', install : true, sources : 'zic/zic.c')
install_man('zic/zic.8')
executable(
'zlog',
build_by_default : sdk_version.version_compare('>=11'),
c_args : '-DKERN_NOT_FOUND=56',
dependencies : core_symbolication,
install : sdk_version.version_compare('>=11'),
sources : [
'zlog/SymbolicationHelper.c',
'zlog/zlog.c',
]
)
if sdk_version.version_compare('>=11')
install_man('zlog/zlog.1')
endif
executable(
'zprint',
# Requires IOKitUser kext APIs
build_by_default : false,
dependencies: [ kernel ],
install : false,
sources : 'zprint/zprint.c'
)
# install_man('zprint/zprint.1')