update libcxx[abi] to 3.5

This commit is contained in:
Eric Seidel 2015-02-03 14:02:59 -08:00
parent 2ca30151c2
commit 6f7632a7bd
3 changed files with 36 additions and 25 deletions

View File

@ -9,7 +9,6 @@
, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
, zlib ? null, extraPackages ? []
, setupHook ? ./setup-hook.sh
, libcxx ? null, libcxxabi ? null
}:
with stdenv.lib;
@ -35,7 +34,7 @@ stdenv.mkDerivation {
preferLocalBuild = true;
inherit cc shell libcxx libcxxabi;
inherit cc shell;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils.
@ -88,7 +87,7 @@ stdenv.mkDerivation {
''
+ (if nativeTools then ''
ccPath="${nativePrefix}/bin"
ccPath="${if stdenv.isDarwin then cc else nativePrefix}/bin"
ldPath="${nativePrefix}/bin"
'' else ''
echo $cc > $out/nix-support/orig-cc

View File

@ -1,15 +1,25 @@
{ lib, stdenv, fetchurl, cmake, libcxxabi, fixDarwinDylibNames }:
let version = "3.4.2"; in
let version = "3.5.0"; in
stdenv.mkDerivation rec {
name = "libc++-${version}";
src = fetchurl {
url = "http://llvm.org/releases/${version}/libcxx-${version}.src.tar.gz";
sha256 = "0z3jdvgcq995khkpis5c5vaxhbmvbqjlalbhn09k6pgb5zp46rc2";
url = "http://llvm.org/releases/${version}/libcxx-${version}.src.tar.xz";
sha256 = "1h5is2jd802344kddm45jcm7bra51llsiv9r34h0rrb3ba2dlic0";
};
# instead of allowing libc++ to link with /usr/lib/libc++abi.dylib,
# force it to link with our copy
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace lib/CMakeLists.txt \
--replace 'OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib' \
'OSX_RE_EXPORT_LINE "${libcxxabi}/lib/libc++abi.dylib' \
--replace '"''${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"' \
'"${libcxxabi}/lib/libc++abi.dylib"'
'';
patches = [ ./darwin.patch ];
buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;

View File

@ -1,46 +1,48 @@
{ lib, stdenv, fetchurl, libcxx, coreutils, gnused }:
{ stdenv, cmake, coreutils, fetchurl, libcxx, libunwind, llvm }:
let rev = "199626"; in
let version = "3.5.0"; in
stdenv.mkDerivation {
name = "libc++abi-${rev}";
name = "libc++abi-${version}";
src = fetchurl {
url = "http://tarballs.nixos.org/libcxxabi-${rev}.tar.bz2";
sha256 = "09wr6qwgmdzbmgfkdzfhph9giy0zd6fp3s017fcfy4g0prjn5s4c";
url = "http://llvm.org/releases/${version}/libcxxabi-${version}.src.tar.xz";
sha256 = "1ndcpw3gfrzh7m1jac2qadhkrqgvb65cns69j9niydyj5mmbxijk";
};
patches = [ ./no-stdc++.patch ./darwin.patch ];
NIX_CFLAGS_LINK = "-L${libunwind}/lib";
buildInputs = [ coreutils ];
buildInputs = [ coreutils cmake llvm ];
postUnpack = ''
unpackFile ${libcxx.src}
cp -r libcxx-*/include libcxxabi*/
'' + lib.optionalString stdenv.isDarwin ''
export NIX_CFLAGS_COMPILE+=" -I${libunwind}/include -I$PWD/include"
export cmakeFlags="-DLIBCXXABI_LIBCXX_INCLUDES=$(${coreutils}/bin/readlink -f libcxx-*)/include"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin
# Hack: NIX_CFLAGS_COMPILE doesn't work here because clang++ isn't
# wrapped at this point.
export CXX="clang++ -D_LIBCXX_DYNAMIC_FALLBACK=1"
unset SDKROOT
'';
installPhase = if stdenv.isDarwin
then ''
install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.dylib $out/lib
install -m 644 include/cxxabi.h $out/include
for file in lib/*; do
# this should be done in CMake, but having trouble figuring out
# the magic combination of necessary CMake variables
# if you fancy a try, take a look at
# http://www.cmake.org/Wiki/CMake_RPATH_handling
install_name_tool -id $out/$file $file
done
make install
install -d 755 $out/include
install -m 644 ../include/cxxabi.h $out/include
''
else ''
install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.so.1.0 $out/lib
install -m 644 include/cxxabi.h $out/include
install -m 644 ../include/cxxabi.h $out/include
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
'';
buildPhase = "(cd lib; ./buildit)";
meta = {
homepage = http://libcxxabi.llvm.org/;
description = "A new implementation of low level support for a standard C++ library";