dtrace: patch impurities

This commit is contained in:
Matthew Bauer 2018-04-09 16:59:19 -05:00
parent d227d1edf4
commit aa21f9c578
1 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,4 @@
{ appleDerivation, xcbuild, CoreSymbolication, xnu, bison, flex, darling }:
{ appleDerivation, xcbuild, CoreSymbolication, xnu, bison, flex, darling, stdenv }:
appleDerivation {
buildInputs = [ xcbuild CoreSymbolication xnu bison flex darling ];
@ -6,6 +6,14 @@ appleDerivation {
NIX_LDFLAGS = "-L./Products/Release";
xcbuildFlags = "-target dtrace";
patchPhase = ''
substituteInPlace dtrace.xcodeproj/project.pbxproj --replace "/usr/sbin" ""
substituteInPlace libdtrace/dt_open.c \
--replace "/usr/bin/clang" "${stdenv.cc}/bin/cpp" \
--replace "/usr/bin/ld" "${stdenv.cc}/bin/ld" \
--replace "/usr/bin/dtrace" $out/lib/dtrace
'';
# hack to handle xcbuild's broken lex handling
preBuild = ''
cd libdtrace
@ -31,5 +39,7 @@ appleDerivation {
mkdir $out/bin
cp Products/Release/dtrace $out/bin
mkdir -p $out/lib/dtrace
'';
}