From 7b84d8950ca20173c90f5c34c1923e4d70f1a58d Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 16:39:09 -0400 Subject: [PATCH] darwin.shell_cmds: 187 -> 319.0.1 https://github.com/apple-oss-distributions/shell_cmds/compare/shell_cmds-187...shell_cmds-319.0.1 --- .../shell_cmds/meson.build.in | 25 +++++++++++++------ .../shell_cmds/package.nix | 25 +++++++++++++++++-- .../apple-source-releases/versions.json | 4 +-- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/meson.build.in b/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/meson.build.in index d2bc7cf19324..33612f0cd1f9 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/meson.build.in +++ b/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/meson.build.in @@ -15,18 +15,13 @@ host_cxx = meson.get_compiler('cpp') # pam = cc.find_library('pam') +libbsd = dependency('libbsd-overlay', required : false) libedit = dependency('libedit') libresolv = host_cc.find_library('resolv') libsbuf = host_cc.find_library('sbuf') libutil = host_cc.find_library('util') libxo = dependency('libxo') -xargs_deps = [ ] -# Versions of macOS prior to 11.0 do not support `strtonum` or `rpmatch` -if not host_cc.has_function('strtonum', prefix : '#include ') - xargs_deps += [ dependency('libbsd-overlay') ] -endif - # Generators bison = generator( @@ -52,7 +47,6 @@ single_file_cmds = [ 'kill', 'killall', 'lastcomm', - 'lockf', 'logname', 'mktemp', 'nice', @@ -263,6 +257,14 @@ foreach manpage : [ 'concatdb', 'mklocatedb' ] ) endforeach +executable( + 'lockf', + dependencies : [ libbsd ], + install : true, + sources : [ 'lockf/lockf.c' ], +) +install_man('lockf/lockf.1') + # Building `sh` requires several custom targets to generate files it needs. bash_bin = find_program('bash') @@ -344,6 +346,13 @@ install_man('sh/sh.1') # ) # install_man('su/su.1') +executable( + 'stdbuf', + install : true, + sources : [ 'stdbuf/stdbuf.c' ], +) +install_man('stdbuf/stdbuf.1') + executable( '[', install : true, @@ -406,7 +415,7 @@ install_man('who/who.1') executable( 'xargs', - dependencies : xargs_deps, + dependencies : [ libbsd ], include_directories : 'xargs', install : true, sources : [ diff --git a/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/package.nix b/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/package.nix index 88fbbf9fb66c..98c83c1b6306 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/package.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/package.nix @@ -2,8 +2,8 @@ lib, apple-sdk, bison, - buildPackages, clang, + fetchurl, libbsd, libedit, libresolv, @@ -17,6 +17,15 @@ let # nohup requires vproc_priv.h from launchd launchd = apple-sdk.sourceRelease "launchd"; + + oldTime_c = fetchurl { + url = "https://github.com/apple-oss-distributions/shell_cmds/raw/shell_cmds-207.11.1/time/time.c"; + hash = "sha256-f7aRwIaKq6r37jpw0V+1Z/sZs5Rm7vy2S774HNBnwmY="; + }; + oldTime_1 = fetchurl { + url = "https://github.com/apple-oss-distributions/shell_cmds/raw/shell_cmds-207.11.1/time/time.1"; + hash = "sha256-ZIbNJPHLQVGq2tdUB6j0DEp9Hie+XUZkfuQm676Vpwc="; + }; in mkAppleDerivation { releaseName = "shell_cmds"; @@ -26,7 +35,7 @@ mkAppleDerivation { "man" ]; - xcodeHash = "sha256-JXK5hIsNDjCh7n39IWvHK8O0A3ItBttDlnN1YmAn6y8="; + xcodeHash = "sha256-26N7AZV/G+ryc2Nu1v91rEdb1a6jDpnj6t5rzEG2YA4="; postPatch = '' @@ -40,6 +49,18 @@ mkAppleDerivation { for path in locate/locate/locate.updatedb.8 locate/locate/locate.rc locate/locate/updatedb.sh; do substituteInPlace $path --replace-fail '/etc/locate.rc' "$out/etc/locate.rc" done + '' + # Use an older version of `time.c` that’s compatible with the 10.12 SDK. + + lib.optionalString (lib.versionOlder (lib.getVersion apple-sdk) "10.13") '' + cp '${oldTime_c}' time/time.c + cp '${oldTime_1}' time/time.1 + '' + + lib.optionalString (lib.versionOlder (lib.getVersion apple-sdk) "11.0") '' + # `rpmatch` was added in 11.0, so revert it to a simpler check on older SDKs. + substituteInPlace find/misc.c \ + --replace-fail 'return (rpmatch(resp) == 1);' "return (resp[0] == 'y');" + # Add missing header for older SDKs. + sed -e '1i #include ' -i w/proc_compare.c ''; env.NIX_CFLAGS_COMPILE = "-I${launchd}/liblaunch"; diff --git a/pkgs/os-specific/darwin/apple-source-releases/versions.json b/pkgs/os-specific/darwin/apple-source-releases/versions.json index 506de775eb67..7dc2ce95ffcb 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/versions.json +++ b/pkgs/os-specific/darwin/apple-source-releases/versions.json @@ -92,8 +92,8 @@ "version": "75" }, "shell_cmds": { - "hash": "sha256-kmEOprkiJGMVcl7yHkGX8ymk/5KjE99gWuF8j2hK5hY=", - "version": "187" + "hash": "sha256-bcu9NNS7NW5oc5yrOk+GxZcQo0AP0+mOnph9HhLdRts=", + "version": "319.0.1" }, "system_cmds": { "hash": "sha256-qFp9nkzsq9uQ7zoyfvO+3gvDlc7kaPvn6luvmO/Io30=",