darwin.IOKitTools: init at 125
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# Build settings based on the upstream Xcode project.
|
||||
# See: https://github.com/apple-oss-distributions/IOKitTools/blob/main/IOKitTools.xcodeproj/project.pbxproj
|
||||
|
||||
# Project settings
|
||||
project('IOKitTools', 'c', version : '@version@')
|
||||
|
||||
|
||||
# Dependencies
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
ncurses = dependency('ncurses')
|
||||
|
||||
core_foundation = dependency('appleframeworks', modules : 'CoreFoundation')
|
||||
iokit = dependency('appleframeworks', modules : 'IOKit')
|
||||
core_symbolication = dependency('appleframeworks', modules : 'CoreSymbolication')
|
||||
perfdata = dependency('appleframeworks', modules : 'perfdata')
|
||||
|
||||
|
||||
# Compatibility tests
|
||||
iomainport_test = '''
|
||||
#include <IOKit/IOKit.h>
|
||||
int main(int argc, char* argv[]) {
|
||||
const mach_port_t port = kIOMasterPortDefault;
|
||||
}
|
||||
'''
|
||||
|
||||
if not cc.compiles(iomainport_test, name : 'supports IOMainPort', dependencies : [ iokit ])
|
||||
add_project_arguments(
|
||||
'-DIOMainPort=IOMasterPort',
|
||||
'-DkIOMainPortDefault=kIOMasterPortDefault',
|
||||
language : 'c'
|
||||
)
|
||||
message('Redefining IOMainPort to IOMasterPort.')
|
||||
endif
|
||||
|
||||
kiouserclasseskey_test = '''
|
||||
#include <IOKit/IOKit.h>
|
||||
int main(int argc, char* argv[]) {
|
||||
const char* key = kIOUserClassesKey;
|
||||
}
|
||||
'''
|
||||
|
||||
if not cc.compiles(iomainport_test, name : 'supports IOUserClasses', dependencies : [ iokit ])
|
||||
add_project_arguments(
|
||||
'-DkIOUserClassesKey="IOUserClasses"',
|
||||
language : 'c'
|
||||
)
|
||||
message('Manually defining IOUserClasses constants.')
|
||||
endif
|
||||
|
||||
|
||||
# Binaries
|
||||
executable(
|
||||
'ioalloccount',
|
||||
dependencies : [ core_foundation, iokit ],
|
||||
install : true,
|
||||
sources : [ 'ioalloccount.tproj/ioalloccount.c' ],
|
||||
)
|
||||
install_man('ioalloccount.tproj/ioalloccount.8')
|
||||
|
||||
executable(
|
||||
'ioclasscount',
|
||||
dependencies : [ core_foundation, core_symbolication, iokit, perfdata ],
|
||||
install : true,
|
||||
sources : [ 'ioclasscount.tproj/ioclasscount.c' ],
|
||||
)
|
||||
install_man('ioclasscount.tproj/ioclasscount.8')
|
||||
|
||||
executable(
|
||||
'ioreg',
|
||||
dependencies : [ core_foundation, iokit, ncurses ],
|
||||
install : true,
|
||||
sources : [ 'ioreg.tproj/ioreg.c' ],
|
||||
)
|
||||
install_man('ioreg.tproj/ioreg.8')
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
lib,
|
||||
apple-sdk_11,
|
||||
darwinMinVersionHook,
|
||||
mkAppleDerivation,
|
||||
ncurses,
|
||||
pkg-config,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
|
||||
let
|
||||
iokitUser = apple-sdk_11.sourceRelease "IOKitUser";
|
||||
xnu = apple-sdk_11.sourceRelease "xnu";
|
||||
|
||||
privateHeaders = stdenvNoCC.mkDerivation {
|
||||
name = "IOKitTools-deps-private-headers";
|
||||
|
||||
buildCommand = ''
|
||||
install -D -t "$out/include/IOKit/" \
|
||||
'${iokitUser}/IOKitLibPrivate.h' \
|
||||
'${xnu}/iokit/IOKit/IOKitKeysPrivate.h'
|
||||
|
||||
install -D -t "$out/include/Kernel/libkern" \
|
||||
'${xnu}/libkern/libkern/OSKextLibPrivate.h'
|
||||
|
||||
mkdir -p "$out/include/perfdata"
|
||||
cat <<EOF > "$out/include/perfdata/perfdata.h"
|
||||
#pragma once
|
||||
typedef void* pdunit_t;
|
||||
|
||||
#define PDUNIT_CUSTOM(x) ((void*)("#\"" x "\""))
|
||||
extern const pdunit_t pdunit_B;
|
||||
|
||||
typedef void* pdwriter_t;
|
||||
extern pdwriter_t pdwriter_open(const char*, const char*, size_t, size_t);
|
||||
extern void pdwriter_close(pdwriter_t);
|
||||
extern void pdwriter_new_value(pdwriter_t, const char*, pdunit_t, double);
|
||||
extern void pdwriter_record_variable_str(pdwriter_t, char*, const char*);
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
in
|
||||
mkAppleDerivation {
|
||||
releaseName = "IOKitTools";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"man"
|
||||
];
|
||||
|
||||
xcodeHash = "sha256-qFG4sB8NXNPTSvYTEX2E1ReOX+NcMBHrS2NuNBLO7zw=";
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [
|
||||
apple-sdk_11
|
||||
apple-sdk_11.privateFrameworksHook
|
||||
(darwinMinVersionHook "11.0")
|
||||
ncurses
|
||||
];
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
|
||||
|
||||
meta.description = "IOKit tools";
|
||||
}
|
||||
@@ -11,6 +11,10 @@
|
||||
"hash": "sha256-CvpMLFNCEQ05t3nkzDyA9nsm3cmRgXG/QxbyiLpSpIs=",
|
||||
"version": "74221"
|
||||
},
|
||||
"IOKitTools": {
|
||||
"hash": "sha256-Oknsvzn4nv77WU7f0WPS446iwR2BM2q4iw46r/qctAE=",
|
||||
"version": "125"
|
||||
},
|
||||
"PowerManagement": {
|
||||
"hash": "sha256-bYGtYnBOcE5W03AZzfVTJXPZ6GgryGAMt/LgLPxFkVk=",
|
||||
"version": "572.50.1"
|
||||
|
||||
Reference in New Issue
Block a user