fix LLVM packages to work in darwin stdenv

This commit is contained in:
Jude Taylor 2015-10-05 08:46:49 -07:00
parent 4e8da0747c
commit 0a32eab91e
12 changed files with 68 additions and 74 deletions

View File

@ -12,15 +12,6 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include") cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
'' +
stdenv.lib.optionalString stdenv.isDarwin ''
# instead of allowing libc++ to link with /usr/lib/libc++abi.dylib,
# force it to link with our copy
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 ];

View File

@ -27,7 +27,7 @@ stdenv.mkDerivation {
done done
make install make install
install -d 755 $out/include install -d 755 $out/include
install -m 644 ../include/cxxabi.h $out/include install -m 644 ../include/*.h $out/include
'' ''
else '' else ''
install -d -m 755 $out/include $out/lib install -d -m 755 $out/include $out/lib

View File

@ -11,6 +11,7 @@
, ncurses , ncurses
, version , version
, zlib , zlib
, libcxxabi
, compiler-rt_src , compiler-rt_src
}: }:
@ -27,7 +28,8 @@ in stdenv.mkDerivation rec {
mv compiler-rt-* $sourceRoot/projects/compiler-rt mv compiler-rt-* $sourceRoot/projects/compiler-rt
''; '';
buildInputs = [ perl groff cmake libxml2 python libffi ] /* ++ stdenv.lib.optional stdenv.isLinux valgrind */; buildInputs = [ perl groff cmake libxml2 python libffi ]
++ stdenv.lib.optional stdenv.isDarwin libcxxabi;
propagatedBuildInputs = [ ncurses zlib ]; propagatedBuildInputs = [ ncurses zlib ];
@ -47,7 +49,7 @@ in stdenv.mkDerivation rec {
"-DBUILD_SHARED_LIBS=ON" "-DBUILD_SHARED_LIBS=ON"
"-DLLVM_BINUTILS_INCDIR=${binutils}/include" "-DLLVM_BINUTILS_INCDIR=${binutils}/include"
] ++ stdenv.lib.optionals ( isDarwin) [ ] ++ stdenv.lib.optionals ( isDarwin) [
"-DCMAKE_CXX_FLAGS=-stdlib=libc++" "-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false" "-DCAN_TARGET_i386=false"
]; ];

View File

@ -59,9 +59,14 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
postPatch = ''
pwd="$(type -P pwd)"
substituteInPlace dist/PathTools/Cwd.pm \
--replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
'';
preConfigure = preConfigure =
'' ''
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3" configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
${optionalString stdenv.isArm '' ${optionalString stdenv.isArm ''

View File

@ -1,12 +1,14 @@
diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure diff --git a/Configure b/Configure
--- perl-5.14.2-orig/Configure 2011-09-26 11:44:34.000000000 +0200 index 0a405d3..1871298 100755
+++ perl-5.14.2/Configure 2012-02-16 17:24:50.779839039 +0100 --- a/Configure
@@ -1368,7 +1368,7 @@ +++ b/Configure
@@ -1455,7 +1455,7 @@ libswanted_uselargefiles=''
: List of libraries we want. : List of libraries we want.
: If anyone needs extra -lxxx, put those in a hint file. : If anyone needs extra -lxxx, put those in a hint file.
libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun" libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
-libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD" -libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
+libswanted="$libswanted m crypt sec c cposix posix ucb bsd BSD" +libswanted="$libswanted sun m crypt sec c cposix posix ucb bsd BSD"
: We probably want to search /usr/shlib before most other libraries. : We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`

View File

@ -33,6 +33,8 @@ stdenv.mkDerivation rec {
configureFlagsArray+=("--build=$(./configfsf.guess)") configureFlagsArray+=("--build=$(./configfsf.guess)")
''; '';
patches = [ ./l0m4_tmp.patch ];
doCheck = true; doCheck = true;
dontDisableStatic = withStatic; dontDisableStatic = withStatic;

View File

@ -0,0 +1,27 @@
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1396470504 -7200
# Node ID 1fab0adc5ff7d9ecddcbda96f407da58347bb49c
# Parent db645603dcdb41afcf78b19b551ecd5a01c3841c
Workaround for Darwin assembler quirk.
diff -r db645603dcdb -r 1fab0adc5ff7 mpn/x86_64/k8/redc_1.asm
--- a/mpn/x86_64/k8/redc_1.asm Mon Mar 31 23:04:32 2014 +0200
+++ b/mpn/x86_64/k8/redc_1.asm Wed Apr 02 22:28:24 2014 +0200
@@ -114,7 +114,7 @@
JUMPTABSECT
ALIGN(8)
-L(tab): JMPENT( L(0m4), L(tab))
+L(tab): JMPENT( L(0), L(tab))
JMPENT( L(1), L(tab))
JMPENT( L(2), L(tab))
JMPENT( L(3), L(tab))
@@ -397,6 +397,7 @@
ALIGN(16)
+L(0):
L(0m4):
L(lo0): mov (mp,nneg,8), %rax
mov nneg, i

View File

@ -1,42 +0,0 @@
diff -ruNp ncurses-5.8.orig/c++/cursesf.h ncurses-5.8/c++/cursesf.h
--- ncurses-5.8.orig/c++/cursesf.h 2005-08-13 21:08:24.000000000 +0300
+++ ncurses-5.8/c++/cursesf.h 2011-04-03 18:29:29.000000000 +0300
@@ -681,7 +681,7 @@ public:
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Fields=FALSE)
- : NCursesForm (Fields, with_frame, autoDelete_Fields) {
+ : NCursesForm (&Fields, with_frame, autoDelete_Fields) {
if (form)
set_user (const_cast<void *>(p_UserData));
};
@@ -694,7 +694,7 @@ public:
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Fields=FALSE)
- : NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
+ : NCursesForm (&Fields, nlines, ncols, begin_y, begin_x,
with_frame, autoDelete_Fields) {
if (form)
set_user (const_cast<void *>(p_UserData));
diff -ruNp ncurses-5.8.orig/c++/cursesm.h ncurses-5.8/c++/cursesm.h
--- ncurses-5.8.orig/c++/cursesm.h 2005-08-13 21:10:36.000000000 +0300
+++ ncurses-5.8/c++/cursesm.h 2011-04-03 18:31:42.000000000 +0300
@@ -639,7 +639,7 @@ public:
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Items=FALSE)
- : NCursesMenu (Items, with_frame, autoDelete_Items) {
+ : NCursesMenu (&Items, with_frame, autoDelete_Items) {
if (menu)
set_user (const_cast<void *>(p_UserData));
};
@@ -651,7 +651,7 @@ public:
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE)
- : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) {
+ : NCursesMenu (&Items, nlines, ncols, begin_y, begin_x, with_frame) {
if (menu)
set_user (const_cast<void *>(p_UserData));
};

View File

@ -14,8 +14,6 @@ stdenv.mkDerivation rec {
sha256 = "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm"; sha256 = "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm";
}; };
patches = [ ./clang.patch ];
configureFlags = [ configureFlags = [
"--with-shared" "--with-shared"
"--with-cxx-shared" "--with-cxx-shared"

View File

@ -1,12 +1,13 @@
diff -ru -x '*~' openssl-1.0.1c-orig/Configure openssl-1.0.1c/Configure diff --git a/Configure b/Configure
--- openssl-1.0.1c-orig/Configure 2012-03-14 23:20:40.000000000 +0100 index d99eed7..341dbd0 100755
+++ openssl-1.0.1c/Configure 2012-12-18 17:29:30.268090633 +0100 --- a/Configure
@@ -579,7 +579,7 @@ +++ b/Configure
@@ -638,7 +638,7 @@ my %table=(
"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-x86_64-cc","cc:-O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"darwin64-x86_64-cc","cc:-O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
# iPhoneOS/iOS # iPhoneOS/iOS
"iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",

View File

@ -220,11 +220,13 @@ in rec {
persistent3 = orig: with stage3.pkgs; { persistent3 = orig: with stage3.pkgs; {
inherit inherit
gnumake gzip gnused bzip2 gawk ed xz patch bash gnumake gzip gnused bzip2 gawk ed xz patch bash
libcxxabi libcxx ncurses libffi zlib llvm gmp pcre gnugrep libcxxabi libcxx ncurses libffi zlib gmp pcre gnugrep
coreutils findutils diffutils patchutils; coreutils findutils diffutils patchutils;
llvmPackages = orig.llvmPackages // { llvmPackages = let llvmOverride = llvmPackages.llvm.override { inherit libcxxabi; };
inherit (llvmPackages) llvm clang-unwrapped; in orig.llvmPackages // {
llvm = llvmOverride;
clang-unwrapped = llvmPackages.clang-unwrapped.override { llvm = llvmOverride; };
}; };
darwin = orig.darwin // { darwin = orig.darwin // {

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, perl, AlgorithmDiff, RegexpCommon }: { stdenv, fetchurl, fetchpatch, perl, AlgorithmDiff, RegexpCommon }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -11,6 +11,12 @@ stdenv.mkDerivation rec {
sha256 = "1w3mz69h2i7pscvi9q7yp7wimds8g38c5ph78cj5pvjl5wa035rh"; sha256 = "1w3mz69h2i7pscvi9q7yp7wimds8g38c5ph78cj5pvjl5wa035rh";
}; };
patches = [ (fetchpatch {
name = "perl-5.22.patch";
url = "https://bugs.archlinux.org/task/45494?getfile=13174";
sha256 = "1xxwqjy2q2fdza7kfp9ld0yzljkdsrgm8a9pwnmx5q4adigcjjsz";
}) ];
buildInputs = [ perl AlgorithmDiff RegexpCommon ]; buildInputs = [ perl AlgorithmDiff RegexpCommon ];
makeFlags = [ "prefix=" "DESTDIR=$(out)" "INSTALL=install" ]; makeFlags = [ "prefix=" "DESTDIR=$(out)" "INSTALL=install" ];