nixpkgs-suyu/pkgs/os-specific/darwin/apple-source-releases/dtrace/default.nix
Matthew Bauer 8505e710e7 Revert "darwin 10.12 commits"
Reverts commits bumping to macOS stuff to 10.12:

commit ec1f78d1cb.
commit d0dc91d24f.
commit a1d297374d.
commit 425112151d.
commit e6f7f2928f.
2019-01-03 15:20:26 -06:00

50 lines
1.5 KiB
Nix

{ appleDerivation, cctools, zlib }:
appleDerivation {
buildInputs = [ cctools zlib ];
buildPhase = ''
export CFLAGS=" -I$PWD/head -I$PWD/sys -I$PWD/libelf -I$PWD/libdwarf"
pushd libelf
for f in *.c; do
if [ "$f" != "lintsup.c" ]; then # Apple doesn't use it, so I don't either
cc -D_INT64_TYPE -D_LONGLONG_TYPE -D_ILP32 $CFLAGS -c $f
fi
done
libtool -static -o libelf.a *.o
popd
pushd libdwarf
./configure CFLAGS="$CFLAGS -Icmplrs"
make
popd
cp libelf/libelf.a tools/ctfconvert
cp libdwarf/libdwarf.a tools/ctfconvert
pushd tools/ctfconvert
for f in ../../darwin_shim.c *.c; do
cc -DNDEBUG -DNS_BLOCK_ASSERTIONS $CFLAGS -c $f
done
export COMMON="alist.o ctf.o darwin_shim.o hash.o iidesc.o input.o list.o \
memory.o output.o stack.o strtab.o symbol.o tdata.o traverse.o util.o"
export CONVERT="ctfconvert.o dwarf.o merge.o st_bugs.o st_parse.o stabs.o"
export MERGE="barrier.o ctfmerge.o dwarf.o fifo.o merge.o st_bugs.o st_parse.o stabs.o utils.o"
export DUMP="dump.o fifo.o utils.o"
clang -o ctfconvert $CONVERT $COMMON -L. -lz -lelf -ldwarf
clang -o ctfmerge $MERGE $COMMON -L. -lz -lelf -ldwarf
clang -o ctfdump $DUMP $COMMON -L. -lz -lelf
popd
'';
installPhase = ''
mkdir -p $out/bin
cp tools/ctfconvert/ctfconvert $out/bin
cp tools/ctfconvert/ctfmerge $out/bin
cp tools/ctfconvert/ctfdump $out/bin
'';
}