nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
2
3stdenv.mkDerivation {
4 name = "libc++abi-${version}";
5
6 src = fetch "libcxxabi" "12lp799rskr4fc2xr64qn4jfkjnfd8b1aymvsxyn4k9ar7r9pgqv";
7
8 nativeBuildInputs = [ cmake ];
9 buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
10
11 postUnpack = ''
12 unpackFile ${libcxx.src}
13 unpackFile ${llvm.src}
14 export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
15 '' + stdenv.lib.optionalString stdenv.isDarwin ''
16 export TRIPLE=x86_64-apple-darwin
17 '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
18 patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
19 '';
20
21 installPhase = if stdenv.isDarwin
22 then ''
23 for file in lib/*.dylib; do
24 # this should be done in CMake, but having trouble figuring out
25 # the magic combination of necessary CMake variables
26 # if you fancy a try, take a look at
27 # http://www.cmake.org/Wiki/CMake_RPATH_handling
28 install_name_tool -id $out/$file $file
29 done
30 make install
31 install -d 755 $out/include
32 install -m 644 ../include/*.h $out/include
33 ''
34 else ''
35 install -d -m 755 $out/include $out/lib
36 install -m 644 lib/libc++abi.a $out/lib
37 install -m 644 lib/libc++abi.so.1.0 $out/lib
38 install -m 644 ../include/cxxabi.h $out/include
39 ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
40 ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
41 '';
42
43 meta = {
44 homepage = http://libcxxabi.llvm.org/;
45 description = "A new implementation of low level support for a standard C++ library";
46 license = with stdenv.lib.licenses; [ ncsa mit ];
47 maintainers = with stdenv.lib.maintainers; [ vlstill ];
48 platforms = stdenv.lib.platforms.unix;
49 };
50}