darwin.dtrace: remove and replace with stubs

This commit is contained in:
Randy Eckenrode 2024-09-02 19:27:03 -04:00
parent d78b641fee
commit ae78385296
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
4 changed files with 1 additions and 59 deletions

View File

@ -262,7 +262,6 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
AvailabilityVersions = callPackage ./AvailabilityVersions/package.nix { };
copyfile = callPackage ./copyfile/package.nix { };
Csu = callPackage ./Csu/package.nix { };
dtrace = applePackage "dtrace" "osx-10.12.6" "sha256-Icr22ozixHquI0kRB2XZ+LlxD6V46sJHsHy4L/tDXZg=" {};
dyld = applePackage "dyld" "osx-10.12.6" "sha256-JmKnOZtBPf96zEx7vhYHLBSTOPyKN71IdYE3R0IeJww=" {};
eap8021x = applePackage "eap8021x" "osx-10.11.6" "sha256-54P3+YhVhOanoZQoqswDnr/GbR/AdEERse135nyuIQo=" {};
launchd = applePackage "launchd" "osx-10.9.5" "sha256-dmV0UK7hG9wvTr+F4Z47nCFXcVZCV+cQ46WbE0DBtJs=" {};

View File

@ -1,57 +0,0 @@
{ appleDerivation, xcbuildHook, CoreSymbolication, apple_sdk
, xnu, bison, flex, stdenv, fixDarwinDylibNames }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook flex bison fixDarwinDylibNames ];
buildInputs = [ CoreSymbolication apple_sdk.frameworks.CoreSymbolication xnu ];
# -fcommon: workaround build failure on -fno-common toolchains:
# duplicate symbol '_kCSRegionMachHeaderName' in: libproc.o dt_module_apple.o
env.NIX_CFLAGS_COMPILE = "-DCTF_OLD_VERSIONS -DPRIVATE -DYYDEBUG=1 -I${xnu}/Library/Frameworks/System.framework/Headers -Wno-error=implicit-function-declaration -fcommon";
NIX_LDFLAGS = "-L./Products/Release";
xcbuildFlags = [ "-target" "dtrace_frameworks" "-target" "dtrace" ];
doCheck = false;
checkPhase = "xcodebuild -target dtrace_tests";
postPatch = ''
substituteInPlace dtrace.xcodeproj/project.pbxproj \
--replace "/usr/sbin" ""
substituteInPlace libdtrace/dt_open.c \
--replace /usr/bin/clang ${stdenv.cc.cc}/bin/clang \
--replace /usr/bin/ld ${stdenv.cc.bintools.bintools}/bin/ld \
--replace /usr/lib/dtrace/dt_cpp.h $out/include/dt_cpp.h \
--replace /usr/lib/dtrace $out/lib/dtrace
substituteInPlace libproc/libproc.c \
--replace "#include <sandbox/rootless.h>" ""
'';
# hack to handle xcbuild's broken lex handling
preBuild = ''
pushd libdtrace
yacc -d dt_grammar.y
flex -l -d dt_lex.l
popd
substituteInPlace dtrace.xcodeproj/project.pbxproj \
--replace '6EBC9800099BFBBF0001019C /* dt_grammar.y */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.yacc; name = dt_grammar.y; path = libdtrace/dt_grammar.y; sourceTree = "<group>"; };' '6EBC9800099BFBBF0001019C /* y.tab.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = y.tab.c; path = libdtrace/y.tab.c; sourceTree = "<group>"; };' \
--replace '6EBC9808099BFBBF0001019C /* dt_lex.l */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.lex; name = dt_lex.l; path = libdtrace/dt_lex.l; sourceTree = "<group>"; };' '6EBC9808099BFBBF0001019C /* lex.yy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lex.yy.c; path = libdtrace/lex.yy.c; sourceTree = "<group>"; };'
'';
# xcbuild doesn't support install
installPhase = ''
mkdir -p $out
cp -r Products/Release/usr/include $out/include
cp scripts/dt_cpp.h $out/include/dt_cpp.h
mkdir $out/lib
cp Products/Release/*.dylib $out/lib
mkdir $out/bin
cp Products/Release/dtrace $out/bin
mkdir -p $out/lib/dtrace
install_name_tool -change $PWD/Products/Release/libdtrace.dylib $out/lib/libdtrace.dylib $out/bin/dtrace
'';
}

View File

@ -11,7 +11,6 @@ basic_cmds = applePackage' "basic_cmds" "55" "macos-11.0.1" "1913pzk376zfap2fwmr
bootstrap_cmds = callPackage ./bootstrap_cmds/package.nix { };
copyfile = applePackage' "copyfile" "173.40.2" "macos-11.0.1" "1j20909inn2iw8n51b8vk551wznfi3bhfziy8nbv08qj5lk50m04" {};
diskdev_cmds = applePackage' "diskdev_cmds" "667.40.1" "macos-11.0.1" "0wr60vyvgkbc4wyldnsqas0xss2k1fgmbdk3vnhj6v6jqa98l1ny" {};
dtrace = applePackage' "dtrace" "370.40.1" "macos-11.0.1" "1qj74mix1x3drffr1qpafm57aby42bc61kynba5q0ppbcf0lrbp1" {};
dyld = applePackage' "dyld" "832.7.1" "macos-11.0.1" "01q7fsibr6xp94l3w22sh8qfjgwzzf1v82mhgq39ivkxwwc4jdy0" {};
eap8021x = applePackage' "eap8021x" "304.40.1" "macos-11.0.1" "1aihyklri64w380d1mvi830n5cnzs9gd38z8i9ccd37n48gmz88p" {};
file_cmds = applePackage' "file_cmds" "321.40.3" "macos-11.0.1" "0p077lnbcy8266m03a0fssj4214bjxh88y3qkspnzcvi0g84k43q" {};

View File

@ -85,6 +85,7 @@ makeScopeWithSplicing' {
"configd"
"configdHeaders"
"darwin-stubs"
"dtrace"
] (mkStub apple_sdk.version);
in
impure-cmds // appleSourcePackages // stubs // {