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

View File

@ -1,15 +1,25 @@
{ lib, stdenv, fetchurl, cmake, libcxxabi, fixDarwinDylibNames }: { lib, stdenv, fetchurl, cmake, libcxxabi, fixDarwinDylibNames }:
let version = "3.4.2"; in let version = "3.5.0"; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libc++-${version}"; name = "libc++-${version}";
src = fetchurl { src = fetchurl {
url = "http://llvm.org/releases/${version}/libcxx-${version}.src.tar.gz"; url = "http://llvm.org/releases/${version}/libcxx-${version}.src.tar.xz";
sha256 = "0z3jdvgcq995khkpis5c5vaxhbmvbqjlalbhn09k6pgb5zp46rc2"; 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 ]; patches = [ ./darwin.patch ];
buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; 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 { stdenv.mkDerivation {
name = "libc++abi-${rev}"; name = "libc++abi-${version}";
src = fetchurl { src = fetchurl {
url = "http://tarballs.nixos.org/libcxxabi-${rev}.tar.bz2"; url = "http://llvm.org/releases/${version}/libcxxabi-${version}.src.tar.xz";
sha256 = "09wr6qwgmdzbmgfkdzfhph9giy0zd6fp3s017fcfy4g0prjn5s4c"; sha256 = "1ndcpw3gfrzh7m1jac2qadhkrqgvb65cns69j9niydyj5mmbxijk";
}; };
patches = [ ./no-stdc++.patch ./darwin.patch ]; NIX_CFLAGS_LINK = "-L${libunwind}/lib";
buildInputs = [ coreutils ]; buildInputs = [ coreutils cmake llvm ];
postUnpack = '' postUnpack = ''
unpackFile ${libcxx.src} unpackFile ${libcxx.src}
cp -r libcxx-*/include libcxxabi*/ export NIX_CFLAGS_COMPILE+=" -I${libunwind}/include -I$PWD/include"
'' + lib.optionalString stdenv.isDarwin '' export cmakeFlags="-DLIBCXXABI_LIBCXX_INCLUDES=$(${coreutils}/bin/readlink -f libcxx-*)/include"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin 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 installPhase = if stdenv.isDarwin
then '' then ''
install -d -m 755 $out/include $out/lib for file in lib/*; do
install -m 644 lib/libc++abi.dylib $out/lib # this should be done in CMake, but having trouble figuring out
install -m 644 include/cxxabi.h $out/include # 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 '' else ''
install -d -m 755 $out/include $out/lib install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.so.1.0 $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
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
''; '';
buildPhase = "(cd lib; ./buildit)";
meta = { meta = {
homepage = http://libcxxabi.llvm.org/; homepage = http://libcxxabi.llvm.org/;
description = "A new implementation of low level support for a standard C++ library"; description = "A new implementation of low level support for a standard C++ library";