From 6eaf7d318ec78189ad9c7be1f2fa952ba5918670 Mon Sep 17 00:00:00 2001 From: Jude Taylor Date: Tue, 27 Oct 2015 18:00:00 -0700 Subject: [PATCH] build libunwind for real --- .../libunwind/default.nix | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix index 32c8d6717f0b..7177d8fb9e68 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix @@ -1,24 +1,29 @@ -{ stdenv, appleDerivation, dyld }: +{ stdenv, appleDerivation, dyld, osx_private_sdk }: appleDerivation { phases = [ "unpackPhase" "buildPhase" "installPhase" ]; buildInputs = [ dyld ]; + NIX_CFLAGS_COMPILE = "-I${osx_private_sdk}/PrivateSDK10.9.sparse.sdk/usr/include"; + buildPhase = '' - # cd src - # cc -I$PWD/../include -c libuwind.cxx - # cc -I$PWD/../include -c Registers.s - # cc -I$PWD/../include -c unw_getcontext.s - # cc -I$PWD/../include -c UnwindLevel1.c - # cc -I$PWD/../include -c UnwindLevel1-gcc-ext.c - # cc -I$PWD/../include -c Unwind-sjlj.c + pushd src + c++ -I../include -c libuwind.cxx -o libuwind.o + cc -I../include -c Registers.s -o Registers.o + cc -I../include -c unw_getcontext.s -o unw_getcontext.o + cc -I../include -c UnwindLevel1.c -o UnwindLevel1.o + cc -I../include -c UnwindLevel1-gcc-ext.c -o UnwindLevel1-gcc-ext.o + cc -I../include -c Unwind-sjlj.c -o Unwind-sjlj.o + ld -arch x86_64 -dylib libuwind.o Registers.o unw_getcontext.o UnwindLevel1.o UnwindLevel1-gcc-ext.o Unwind-sjlj.o \ + -lc++ -lc -install_name $out/lib/libunwind.dylib -o libunwind.dylib + popd ''; installPhase = '' - mkdir -p $out - - cp -r include $out + mkdir -p $out/lib + cp -R include $out/include + install -m 0755 src/libunwind.dylib $out/lib ''; meta = with stdenv.lib; {