From 25af398f885bf51b0c89837850888af115828f6b Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 15 Mar 2024 20:09:47 -0400 Subject: [PATCH] darwin.system_cmds: 735.50.6 -> 970.0.4 - Update to the latest available version from Apple; - Use Meson because dealing with xcbuild is too much trouble; and - Conditionally build certain programs when newer SDKs are available. --- .../darwin/apple-source-releases/default.nix | 5 +- .../apple-source-releases/macos-11.0.1.nix | 1 - .../system_cmds/default.nix | 247 ++++---- .../fix-implicit-declarations.patch | 48 -- .../system_cmds/meson.build | 544 ++++++++++++++++++ .../system_cmds/meson.options | 1 + 6 files changed, 696 insertions(+), 150 deletions(-) delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/system_cmds/fix-implicit-declarations.patch create mode 100644 pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.build create mode 100644 pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.options diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 978038fc111f..8a562cc82558 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -6,6 +6,9 @@ let # a stdenv out of something like this. With some care we can probably get rid of this, but for # now it's staying here. versions = { + "macos-14.3" = { + system_cmds = "970.0.4"; + }; "osx-10.12.6" = { xnu = "3789.70.16"; libiconv = "50"; @@ -306,7 +309,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { else macosPackages_11_0_1.network_cmds; file_cmds = applePackage "file_cmds" "osx-10.11.6" "sha256-JYy6HwmultKeZtLfaysbsyLoWg+OaTh7eJu54JkJC0Q=" {}; shell_cmds = applePackage "shell_cmds" "osx-10.11.6" "sha256-kmEOprkiJGMVcl7yHkGX8ymk/5KjE99gWuF8j2hK5hY=" {}; - system_cmds = applePackage "system_cmds" "osx-10.11.6" "sha256-KBdGlHeXo2PwgRQOOeElJ1RBqCY1Tdhn5KD42CMhdzI=" {}; + system_cmds = applePackage "system_cmds" "macos-14.3" "sha256-qFp9nkzsq9uQ7zoyfvO+3gvDlc7kaPvn6luvmO/Io30=" {}; text_cmds = applePackage "text_cmds" "osx-10.11.6" "sha256-KSebU7ZyUsPeqn51nzuGNaNxs9pvmlIQQdkWXIVzDxw=" {}; top = applePackage "top" "osx-10.11.6" "sha256-jbz64ODogtpNyLpXGSZj1jCBdFPVXcVcBkL1vc7g5qQ=" {}; PowerManagement = applePackage "PowerManagement" "osx-10.11.6" "sha256-bYGtYnBOcE5W03AZzfVTJXPZ6GgryGAMt/LgLPxFkVk=" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix b/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix index 0a70e648695d..b4a7bbc4df24 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix @@ -40,7 +40,6 @@ objc4 = applePackage' "objc4" "818.2" "macos-11.0.1" "0m8mk1qd18wqjfn2jsq2lx6fxv ppp = applePackage' "ppp" "877.40.2" "macos-11.0.1" "06xznc77j45zzi12m4cmr3jj853qlc8dbmynbg1z6m9qf5phdbgk" {}; removefile = applePackage' "removefile" "49.40.3" "macos-11.0.1" "0870ihxpmvj8ggaycwlismbgbw9768lz7w6mc9vxf8l6nlc43z4f" {}; shell_cmds = applePackage' "shell_cmds" "216.40.4" "macos-11.0.1" "0wbysc9lwf1xgl686r3yn95rndcmqlp17zc1ig9gsl5fxyy5bghh" {}; -system_cmds = applePackage' "system_cmds" "880.40.5" "macos-11.0.1" "064yqf84ny0cjpqmzmnhz05faay6axb2r4i6knnyc8n21yiip5dc" {}; text_cmds = applePackage' "text_cmds" "106" "macos-11.0.1" "17fn35m6i866zjrf8da6cq6crydp6vp4zq0aaab243rv1fx303yy" {}; top = applePackage' "top" "129" "macos-11.0.1" "0d9pqmv3mwkfcv7c05hfvnvnn4rbsl92plr5hsazp854pshzqw2k" {}; xnu = applePackage' "xnu" "7195.50.7.100.1" "macos-11.0.1" "11zjmpw11rcc6a0xlbwramra1rsr65s4ypnxwpajgbr2c657lipl" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix index f708d7740900..7bd3cae118eb 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix @@ -1,114 +1,161 @@ -{ stdenv, appleDerivation, lib -, libutil, Librpcsvc, apple_sdk, pam, CF, openbsm }: +{ + lib, + stdenv, + stdenvNoCC, + appleDerivation, + fetchFromGitHub, + runCommand, + gawk, + meson, + ninja, + pkg-config, + libdispatch, + libmalloc, + libplatform, + Librpcsvc, + libutil, + ncurses, + openbsm, + pam, + xnu, + CoreFoundation, + CoreSymbolication, + DirectoryService, + IOKit, + Kernel, + Libc, + OpenDirectory, + WebKit, +}: -appleDerivation { - # xcbuild fails with: - # /nix/store/fc0rz62dh8vr648qi7hnqyik6zi5sqx8-xcbuild-wrapper/nix-support/setup-hook: line 1: 9083 Segmentation fault: 11 xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build - # see issue facebook/xcbuild#188 - # buildInputs = [ xcbuild ]; +let + OpenDirectoryPrivate = stdenvNoCC.mkDerivation (finalAttrs: { + name = "apple-private-framework-OpenDirectory"; + version = "146"; - buildInputs = [ libutil Librpcsvc apple_sdk.frameworks.OpenDirectory pam CF - apple_sdk.frameworks.IOKit openbsm ]; - # env.NIX_CFLAGS_COMPILE = lib.optionalString hostPlatform.isi686 "-D__i386__" - # + lib.optionalString hostPlatform.isx86_64 "-D__x86_64__" - # + lib.optionalString hostPlatform.isAarch32 "-D__arm__"; - env.NIX_CFLAGS_COMPILE = toString ([ "-DDAEMON_UID=1" - "-DDAEMON_GID=1" - "-DDEFAULT_AT_QUEUE='a'" - "-DDEFAULT_BATCH_QUEUE='b'" - "-DPERM_PATH=\"/usr/lib/cron/\"" - "-DOPEN_DIRECTORY" - "-DNO_DIRECT_RPC" - "-DAPPLE_GETCONF_UNDERSCORE" - "-DAPPLE_GETCONF_SPEC" - "-DUSE_PAM" - "-DUSE_BSM_AUDIT" - "-D_PW_NAME_LEN=MAXLOGNAME" - "-D_PW_YPTOKEN=\"__YP!\"" - "-DAHZV1=64 " - "-DAU_SESSION_FLAG_HAS_TTY=0x4000" - "-DAU_SESSION_FLAG_HAS_AUTHENTICATED=0x4000" - ] ++ lib.optional (!stdenv.isLinux) " -D__FreeBSD__ "); + src = fetchFromGitHub { + owner = "apple-oss-distributions"; + repo = "OpenDirectory"; + rev = "OpenDirectory-${finalAttrs.version}"; + hash = "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A="; + }; - patches = [ - # Fix implicit declarations that cause builds to fail when built with clang 16. - ./fix-implicit-declarations.patch + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/include/CFOpenDirectory" "$out/include/OpenDirectory" + install -t "$out/include/CFOpenDirectory" \ + Core/CFOpenDirectoryPriv.h \ + Core/CFODTrigger.h + touch "$out/include/CFOpenDirectory/CFOpenDirectoryConstantsPriv.h" + install -t "$out/include/OpenDirectory" \ + Framework/OpenDirectoryPriv.h \ + Framework/NSOpenDirectoryPriv.h + + runHook postInstall + ''; + }); + + libmallocPrivate = stdenvNoCC.mkDerivation { + pname = "libmalloc-private"; + version = lib.getVersion libmalloc; + + inherit (libmalloc) src; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/include" + cp -r private/*.h "$out/include" + + runHook postInstall + ''; + }; + + # Private xnu headers that are part of the source tree but not in the xnu derivation. + xnuPrivate = stdenvNoCC.mkDerivation { + pname = "xnu-private"; + version = lib.getVersion xnu; + + inherit (xnu) src; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/include" + cp libsyscall/wrappers/spawn/spawn_private.h "$out/include" + + runHook postInstall + ''; + }; +in +appleDerivation (finalAttrs: { + nativeBuildInputs = [ + gawk + meson + ninja + pkg-config + ]; + + buildInputs = [ + libdispatch + libplatform + Librpcsvc + libutil + ncurses + openbsm + pam + xnu + CoreFoundation + CoreSymbolication + DirectoryService + IOKit + Kernel + OpenDirectory ]; postPatch = '' - substituteInPlace login.tproj/login.c \ - --replace bsm/audit_session.h bsm/audit.h - substituteInPlace login.tproj/login_audit.c \ - --replace bsm/audit_session.h bsm/audit.h - '' + lib.optionalString stdenv.isAarch64 '' - substituteInPlace sysctl.tproj/sysctl.c \ - --replace "GPROF_STATE" "0" - substituteInPlace login.tproj/login.c \ - --replace "defined(__arm__)" "defined(__arm__) || defined(__arm64__)" + # Replace hard-coded, impure system paths with the output path in the store. + sed -e "s|PATH=[^;]*|PATH='$out/bin'|" -i "pagesize/pagesize.sh" ''; - buildPhase = '' - for dir in *.tproj; do - name=$(basename $dir) - name=''${name%.tproj} - - CFLAGS="" - case $name in - arch) CFLAGS="-framework CoreFoundation";; - atrun) CFLAGS="-Iat.tproj";; - chkpasswd) - CFLAGS="-framework OpenDirectory -framework CoreFoundation -lpam";; - getconf) - for f in getconf.tproj/*.gperf; do - cfile=''${f%.gperf}.c - LC_ALL=C awk -f getconf.tproj/fake-gperf.awk $f > $cfile - done - ;; - iostat) CFLAGS="-framework IOKit -framework CoreFoundation";; - login) CFLAGS="-lbsm -lpam";; - nvram) CFLAGS="-framework CoreFoundation -framework IOKit";; - sadc) CFLAGS="-framework IOKit -framework CoreFoundation";; - sar) CFLAGS="-Isadc.tproj";; - esac - - echo "Building $name" - - case $name in - - # These are all broken currently. - arch) continue;; - chpass) continue;; - dirhelper) continue;; - dynamic_pager) continue;; - fs_usage) continue;; - latency) continue;; - pagesize) continue;; - passwd) continue;; - reboot) continue;; - sc_usage) continue;; - shutdown) continue;; - trace) continue;; - - *) cc $dir/*.c -I''${dir} $CFLAGS -o $name ;; - esac - done + # A vendored meson.build is used instead of the upstream Xcode project. + # This is done for a few reasons: + # - The upstream project causes `xcbuild` to crash. + # See: https://github.com/facebookarchive/xcbuild/issues/188; + # - Achieving the same flexibility regarding SDK version would require modifying the + # Xcode project, but modifying Xcode projects without using Xcode is painful; and + # - Using Meson allows the derivation to leverage the robust Meson support in nixpkgs, + # and it allows it to use Meson features to simplify the build (e.g., generators). + preConfigure = '' + substitute '${./meson.build}' meson.build \ + --subst-var-by kernel '${Kernel}' \ + --subst-var-by libc_private '${Libc}' \ + --subst-var-by libmalloc_private '${libmallocPrivate}' \ + --subst-var-by opendirectory '${OpenDirectory}' \ + --subst-var-by opendirectory_private '${OpenDirectoryPrivate}' \ + --subst-var-by xnu '${xnu}' \ + --subst-var-by xnu_private '${xnuPrivate}' \ + --subst-var-by version '${finalAttrs.version}' + cp '${./meson.options}' meson.options ''; - installPhase = '' - for dir in *.tproj; do - name=$(basename $dir) - name=''${name%.tproj} - [ -x $name ] && install -D $name $out/bin/$name - for n in 1 2 3 4 5 6 7 8 9; do - for f in $dir/*.$n; do - install -D $f $out/share/man/man$n/$(basename $f) - done - done - done - ''; + mesonFlags = [ (lib.mesonOption "sdk_version" stdenv.hostPlatform.darwinSdkVersion) ]; meta = { platforms = lib.platforms.darwin; - maintainers = with lib.maintainers; [ shlevy matthewbauer ]; + maintainers = with lib.maintainers; [ + shlevy + matthewbauer + ]; }; -} +}) diff --git a/pkgs/os-specific/darwin/apple-source-releases/system_cmds/fix-implicit-declarations.patch b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/fix-implicit-declarations.patch deleted file mode 100644 index b08f54045724..000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/system_cmds/fix-implicit-declarations.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff -ur a/getty.tproj/main.c b/getty.tproj/main.c ---- a/getty.tproj/main.c 2008-06-10 14:50:19.000000000 -0400 -+++ b/getty.tproj/main.c 2023-05-31 18:06:40.121028558 -0400 -@@ -67,6 +67,7 @@ - #include - #include - #include -+#include - #include - - #ifdef __APPLE__ -@@ -152,7 +153,7 @@ - static void putpad(const char *); - static void puts(const char *); - static void timeoverrun(int); --static char *getline(int); -+static char *get_line(int); - static void setttymode(int); - static int opentty(const char *, int); - -@@ -352,7 +353,7 @@ - if ((fd = open(IF, O_RDONLY)) != -1) { - char * cp; - -- while ((cp = getline(fd)) != NULL) { -+ while ((cp = get_line(fd)) != NULL) { - putf(cp); - } - close(fd); -@@ -744,7 +745,7 @@ - - - static char * --getline(int fd) -+get_line(int fd) - { - int i = 0; - static char linebuf[512]; ---- a/newgrp.tproj/newgrp.c 2021-10-06 01:38:52.000000000 -0400 -+++ b/newgrp.tproj/newgrp.c 2023-05-31 22:26:50.656157841 -0400 -@@ -47,6 +47,7 @@ - #include - #include - #ifdef __APPLE__ -+#include - #include - #endif /* __APPLE__ */ - static void addgroup(const char *grpname); diff --git a/pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.build b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.build new file mode 100644 index 000000000000..de73e88f5d4d --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.build @@ -0,0 +1,544 @@ +# 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 can’t 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') + diff --git a/pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.options b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.options new file mode 100644 index 000000000000..8c4ce874c64c --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/system_cmds/meson.options @@ -0,0 +1 @@ +option('sdk_version', type : 'string')