darwin.shell_cmds: remove code for macOS < 11

This commit is contained in:
Emily
2024-11-18 00:14:01 +00:00
parent 94bc3e473a
commit bd002ebb74
2 changed files with 18 additions and 47 deletions
@@ -15,7 +15,6 @@ 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')
@@ -259,7 +258,6 @@ endforeach
executable(
'lockf',
dependencies : [ libbsd ],
install : true,
sources : [ 'lockf/lockf.c' ],
)
@@ -415,7 +413,6 @@ install_man('who/who.1')
executable(
'xargs',
dependencies : [ libbsd ],
include_directories : 'xargs',
install : true,
sources : [
@@ -4,7 +4,6 @@
bison,
clang,
fetchurl,
libbsd,
libedit,
libresolv,
libsbuf,
@@ -17,15 +16,6 @@
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";
@@ -37,31 +27,18 @@ mkAppleDerivation {
xcodeHash = "sha256-26N7AZV/G+ryc2Nu1v91rEdb1a6jDpnj6t5rzEG2YA4=";
postPatch =
''
# Fix `mktemp` templates
substituteInPlace sh/mkbuiltins \
--replace-fail '-t ka' '-t ka.XXXXXX'
substituteInPlace sh/mktokens \
--replace-fail '-t ka' '-t ka.XXXXXX'
postPatch = ''
# Fix `mktemp` templates
substituteInPlace sh/mkbuiltins \
--replace-fail '-t ka' '-t ka.XXXXXX'
substituteInPlace sh/mktokens \
--replace-fail '-t ka' '-t ka.XXXXXX'
# Update `/etc/locate.rc` paths to point to the store.
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` thats 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 <sys/time.h>' -i w/proc_compare.c
'';
# Update `/etc/locate.rc` paths to point to the store.
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
'';
env.NIX_CFLAGS_COMPILE = "-I${launchd}/liblaunch";
@@ -72,16 +49,13 @@ mkAppleDerivation {
pkg-config
];
buildInputs =
[
libedit
libresolv
libsbuf
libutil
libxo
]
# xargs needs `strtonum`, which was added in 11.0.
++ lib.optionals (lib.versionOlder (lib.getVersion apple-sdk) "11.0") [ libbsd ];
buildInputs = [
libedit
libresolv
libsbuf
libutil
libxo
];
postInstall = ''
# Patch the shebangs to use `sh` from shell_cmds.