darwin.system_cmds: use default SDK on Darwin (14.4)
This commit is contained in:
@@ -15,9 +15,11 @@ add_project_arguments(
|
||||
'-DPRIVATE=1',
|
||||
# From bsd/sys/private_event.h in xnu
|
||||
'-Dkqueue_id_t=uint64_t',
|
||||
# These are not defined automatically by Clang. Not having them defined causes compilation failures.
|
||||
'-DTARGET_OS_EXCLAVECORE=0',
|
||||
'-DTARGET_OS_EXCLAVEKIT=0',
|
||||
language : 'c',
|
||||
)
|
||||
sdk_version = get_option('sdk_version')
|
||||
|
||||
|
||||
# Dependencies
|
||||
@@ -39,15 +41,7 @@ dbm = cc.find_library('dbm')
|
||||
ncurses = dependency('ncurses')
|
||||
openbsm = cc.find_library('bsm')
|
||||
pam = cc.find_library('pam')
|
||||
|
||||
# Feature Tests
|
||||
if sdk_version.version_compare('<12')
|
||||
add_project_arguments(
|
||||
'-DIOMainPort=IOMasterPort',
|
||||
'-DkIOMainPortDefault=kIOMasterPortDefault',
|
||||
language : 'c'
|
||||
)
|
||||
endif
|
||||
util = cc.find_library('util')
|
||||
|
||||
|
||||
# Generators
|
||||
@@ -278,14 +272,11 @@ executable(
|
||||
|
||||
executable(
|
||||
'latency',
|
||||
build_by_default : sdk_version.version_compare('>=12'),
|
||||
dependencies : [ ncurses ],
|
||||
install : sdk_version.version_compare('>=12'),
|
||||
dependencies : [ util, ncurses ],
|
||||
install : true,
|
||||
sources : 'latency/latency.c',
|
||||
)
|
||||
if sdk_version.version_compare('>=12')
|
||||
install_man('latency/latency.1')
|
||||
endif
|
||||
install_man('latency/latency.1')
|
||||
|
||||
executable(
|
||||
'login',
|
||||
@@ -303,27 +294,21 @@ executable(
|
||||
|
||||
executable(
|
||||
'lskq',
|
||||
build_by_default : sdk_version.version_compare('>=12'),
|
||||
install : sdk_version.version_compare('>=12'),
|
||||
install : true,
|
||||
sources : 'lskq/lskq.c',
|
||||
)
|
||||
if sdk_version.version_compare('>=12')
|
||||
install_man('lskq/lskq.1')
|
||||
endif
|
||||
install_man('lskq/lskq.1')
|
||||
|
||||
executable(
|
||||
'lsmp',
|
||||
build_by_default : sdk_version.version_compare('>=12'),
|
||||
install : sdk_version.version_compare('>=12'),
|
||||
install : true,
|
||||
sources : [
|
||||
'lsmp/lsmp.c',
|
||||
'lsmp/port_details.c',
|
||||
'lsmp/task_details.c'
|
||||
]
|
||||
)
|
||||
if sdk_version.version_compare('>=12')
|
||||
install_man('lsmp/lsmp.1')
|
||||
endif
|
||||
install_man('lsmp/lsmp.1')
|
||||
|
||||
executable(
|
||||
'ltop',
|
||||
@@ -469,14 +454,11 @@ install_man('sa/sa.8')
|
||||
|
||||
executable(
|
||||
'sc_usage',
|
||||
build_by_default : sdk_version.version_compare('>=12'),
|
||||
dependencies : ncurses,
|
||||
install : sdk_version.version_compare('>=12'),
|
||||
dependencies : [ncurses, util],
|
||||
install : true,
|
||||
sources : 'sc_usage/sc_usage.c',
|
||||
)
|
||||
if sdk_version.version_compare('>=12')
|
||||
install_man('sc_usage/sc_usage.1')
|
||||
endif
|
||||
install_man('sc_usage/sc_usage.1')
|
||||
|
||||
executable('shutdown',
|
||||
# Requires IOKitUser kext APIs
|
||||
@@ -599,4 +581,3 @@ executable(
|
||||
sources : 'zprint/zprint.c',
|
||||
)
|
||||
# install_man('zprint/zprint.1')
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
option('sdk_version', type : 'string')
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
apple-sdk,
|
||||
apple-sdk_12,
|
||||
libutil,
|
||||
mkAppleDerivation,
|
||||
ncurses,
|
||||
openpam,
|
||||
@@ -13,12 +13,12 @@
|
||||
let
|
||||
libdispatch = apple-sdk.sourceRelease "libdispatch"; # Has to match the version of the SDK
|
||||
|
||||
Libc = apple-sdk_12.sourceRelease "Libc";
|
||||
libmalloc = apple-sdk_12.sourceRelease "libmalloc";
|
||||
OpenDirectory = apple-sdk_12.sourceRelease "OpenDirectory";
|
||||
Libc = apple-sdk.sourceRelease "Libc";
|
||||
libmalloc = apple-sdk.sourceRelease "libmalloc";
|
||||
OpenDirectory = apple-sdk.sourceRelease "OpenDirectory";
|
||||
|
||||
libplatform = apple-sdk_12.sourceRelease "libplatform";
|
||||
xnu = apple-sdk_12.sourceRelease "xnu";
|
||||
libplatform = apple-sdk.sourceRelease "libplatform";
|
||||
xnu = apple-sdk.sourceRelease "xnu";
|
||||
|
||||
privateHeaders = stdenvNoCC.mkDerivation {
|
||||
name = "system_cmds-deps-private-headers";
|
||||
@@ -43,6 +43,7 @@ let
|
||||
install -D -t "$out/include" \
|
||||
'${libmalloc}/private/stack_logging.h' \
|
||||
'${libplatform}/private/_simple.h' \
|
||||
'${xnu}/libsyscall/wrappers/libproc/libproc_private.h' \
|
||||
'${xnu}/libsyscall/wrappers/spawn/spawn_private.h'
|
||||
touch "$out/include/btm.h"
|
||||
|
||||
@@ -71,13 +72,29 @@ let
|
||||
|
||||
install -D -t "$out/include/sys" \
|
||||
'${xnu}/bsd/sys/csr.h' \
|
||||
'${xnu}/bsd/sys/event_private.h' \
|
||||
'${xnu}/bsd/sys/pgo.h' \
|
||||
'${xnu}/bsd/sys/kdebug_private.h' \
|
||||
'${xnu}/bsd/sys/kern_memorystatus.h' \
|
||||
'${xnu}/bsd/sys/proc_info_private.h' \
|
||||
'${xnu}/bsd/sys/reason.h' \
|
||||
'${xnu}/bsd/sys/resource.h' \
|
||||
'${xnu}/bsd/sys/resource_private.h' \
|
||||
'${xnu}/bsd/sys/spawn_internal.h' \
|
||||
'${xnu}/bsd/sys/stackshot.h'
|
||||
|
||||
cat <<EOF > "$out/include/sys/kdebug.h"
|
||||
#pragma once
|
||||
#include_next <sys/kdebug.h>
|
||||
#include <sys/kdebug_private.h>
|
||||
EOF
|
||||
|
||||
cat <<EOF > "$out/include/sys/proc_info.h"
|
||||
#pragma once
|
||||
#include_next <sys/proc_info.h>
|
||||
#include <sys/proc_info_private.h>
|
||||
EOF
|
||||
|
||||
# Older source releases depend on CrashReporterClient.h, but it’s not publicly available.
|
||||
touch "$out/include/CrashReporterClient.h"
|
||||
'';
|
||||
@@ -94,6 +111,12 @@ mkAppleDerivation {
|
||||
|
||||
# Requires BackgroundTaskManagement.framework headers.
|
||||
sed -e '/ if (os_feature_enabled(cronBTMToggle, cronBTMCheck))/,/ }/d' -i atrun/atrun.c
|
||||
|
||||
# Fix format security errors
|
||||
for src in latency/latency.c sc_usage/sc_usage.c; do
|
||||
substituteInPlace $src \
|
||||
--replace-fail 'printw(tbuf)' 'printw("%s", tbuf);'
|
||||
done
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
@@ -104,13 +127,12 @@ mkAppleDerivation {
|
||||
|
||||
buildInputs = [
|
||||
apple-sdk.privateFrameworksHook
|
||||
libutil
|
||||
ncurses
|
||||
openpam
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
|
||||
mesonFlags = [ (lib.mesonOption "sdk_version" stdenv.hostPlatform.darwinSdkVersion) ];
|
||||
|
||||
meta.description = "System commands for Darwin";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user