Upgrade cctools port to 862, and fix the cross version so it evaluates

+39 -139
-122
pkgs/os-specific/darwin/cctools/darwin.patch
··· 1 - From b6001ddb935351b4d150546ddab6d25eae05afaa Mon Sep 17 00:00:00 2001 2 - From: Daniel Peebles <pumpkin@me.com> 3 - Date: Sun, 12 Oct 2014 12:23:51 -0400 4 - Subject: [PATCH] work 5 - 6 - --- 7 - cctools/Makefile.am | 2 +- 8 - cctools/configure.ac | 2 -- 9 - cctools/ld64/src/3rd/helper.c | 2 ++ 10 - cctools/ld64/src/3rd/strlcat.c | 2 ++ 11 - cctools/ld64/src/3rd/strlcpy.c | 3 ++- 12 - cctools/ld64/src/ld/Options.cpp | 2 ++ 13 - tools/find_lto_header.sh | 2 +- 14 - 7 files changed, 10 insertions(+), 5 deletions(-) 15 - 16 - diff --git a/cctools/Makefile.am b/cctools/Makefile.am 17 - index 44084ad..34a670c 100644 18 - --- a/cctools/Makefile.am 19 - +++ b/cctools/Makefile.am 20 - @@ -1,2 +1,2 @@ 21 - -SUBDIRS=libstuff ar as misc libobjc2 otool ld64 $(LD_CLASSIC) 22 - +SUBDIRS=libstuff ar as misc ld64 $(LD_CLASSIC) 23 - ACLOCAL_AMFLAGS = -I m4 24 - diff --git a/cctools/configure.ac b/cctools/configure.ac 25 - index c4f6c47..b641925 100644 26 - --- a/cctools/configure.ac 27 - +++ b/cctools/configure.ac 28 - @@ -278,8 +278,6 @@ AC_CONFIG_FILES([as/ppc/Makefile]) 29 - AC_CONFIG_FILES([as/ppc64/Makefile]) 30 - #AC_CONFIG_FILES([man/Makefile]) 31 - AC_CONFIG_FILES([misc/Makefile]) 32 - -AC_CONFIG_FILES([otool/Makefile]) 33 - -AC_CONFIG_FILES([libobjc2/Makefile]) 34 - AC_CONFIG_FILES([ld/Makefile]) 35 - 36 - 37 - diff --git a/cctools/ld64/src/3rd/helper.c b/cctools/ld64/src/3rd/helper.c 38 - index 19f4be7..bec6869 100644 39 - --- a/cctools/ld64/src/3rd/helper.c 40 - +++ b/cctools/ld64/src/3rd/helper.c 41 - @@ -23,6 +23,7 @@ 42 - const char ldVersionString[] = "236.3\n"; 43 - 44 - 45 - +#if 0 46 - void __assert_rtn(const char *func, const char *file, int line, const char *msg) 47 - { 48 - #ifdef __FreeBSD__ 49 - @@ -33,6 +34,7 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg) 50 - __assert(msg, file, line); 51 - #endif /* __FreeBSD__ */ 52 - } 53 - +#endif 54 - 55 - int _NSGetExecutablePath(char *path, unsigned int *size) 56 - { 57 - diff --git a/cctools/ld64/src/3rd/strlcat.c b/cctools/ld64/src/3rd/strlcat.c 58 - index 500d038..dadf269 100644 59 - --- a/cctools/ld64/src/3rd/strlcat.c 60 - +++ b/cctools/ld64/src/3rd/strlcat.c 61 - @@ -23,6 +23,7 @@ 62 - 63 - #include <string.h> 64 - 65 - +#if 0 66 - size_t 67 - strlcat(char * restrict dst, const char * restrict src, size_t maxlen) { 68 - const size_t srclen = strlen(src); 69 - @@ -36,3 +37,4 @@ strlcat(char * restrict dst, const char * restrict src, size_t maxlen) { 70 - } 71 - return dstlen + srclen; 72 - } 73 - +#endif 74 - \ No newline at end of file 75 - diff --git a/cctools/ld64/src/3rd/strlcpy.c b/cctools/ld64/src/3rd/strlcpy.c 76 - index c69f107..34a399b 100644 77 - --- a/cctools/ld64/src/3rd/strlcpy.c 78 - +++ b/cctools/ld64/src/3rd/strlcpy.c 79 - @@ -23,6 +23,7 @@ 80 - 81 - #include <string.h> 82 - 83 - +#if 0 84 - size_t 85 - strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) { 86 - const size_t srclen = strlen(src); 87 - @@ -34,4 +35,4 @@ strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) { 88 - } 89 - return srclen; 90 - } 91 - - 92 - +#endif 93 - \ No newline at end of file 94 - diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp 95 - index 3a78df8..0ecf9f2 100644 96 - --- a/cctools/ld64/src/ld/Options.cpp 97 - +++ b/cctools/ld64/src/ld/Options.cpp 98 - @@ -49,6 +49,8 @@ namespace lto { 99 - extern const char* version(); 100 - } 101 - 102 - +#define __MAC_OS_X_VERSION_MIN_REQUIRED 1060 103 - + 104 - // magic to place command line in crash reports 105 - const int crashreporterBufferSize = 2000; 106 - static char crashreporterBuffer[crashreporterBufferSize]; 107 - diff --git a/tools/find_lto_header.sh b/tools/find_lto_header.sh 108 - index aee3a4a..4733981 100755 109 - --- a/tools/find_lto_header.sh 110 - +++ b/tools/find_lto_header.sh 111 - @@ -14,7 +14,7 @@ function try() 112 - # Adding the include directory with -I causes the build to fail. 113 - ln -sf "$LLVM_INC_DIR/llvm-c/lto.h" "include/llvm-c/lto.h" 114 - mkdir -p tmp 115 - - echo -n "-Wl,-rpath,$LLVM_LIB_DIR,--enable-new-dtags -L$LLVM_LIB_DIR -lLTO " > tmp/ldflags 116 - + echo -n "-Wl,-rpath,$LLVM_LIB_DIR -L$LLVM_LIB_DIR -lLTO " > tmp/ldflags 117 - echo -n "-DLTO_SUPPORT=1 " > tmp/cflags 118 - echo -n "-DLTO_SUPPORT=1 " > tmp/cxxflags 119 - echo -n "$LLVM_LIB_DIR" > tmp/ldpath 120 - -- 121 - 1.9.3 (Apple Git-50) 122 -
···
+37 -15
pkgs/os-specific/darwin/cctools/port.nix
··· 1 { stdenv, fetchurl, autoconf, automake, libtool 2 - , llvm, libcxx, clang, openssl, libuuid 3 }: 4 5 let 6 baseParams = rec { 7 name = "cctools-port-${version}"; 8 - version = "855"; 9 10 src = let 11 # Should be fetchFromGitHub but it was whining so this will do for now 12 owner = "tpoechtrager"; 13 repo = "cctools-port"; 14 - rev = "7083dddbb0f106d791d313829ea7dc45db90e375"; 15 in fetchurl { 16 url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; 17 - sha256 = "017gxlcwgi7xhayjzj9w3fac175p2rm4vjzf9cycq9683m9pmyzj"; 18 }; 19 20 - buildInputs = [ 21 - autoconf automake libtool llvm clang openssl libuuid libcxx 22 - ]; 23 24 - patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; 25 26 enableParallelBuilding = true; 27 28 postPatch = '' 29 patchShebangs tools 30 sed -i -e 's/which/type -P/' tools/*.sh 31 ··· 39 # include_next "unistd.h" 40 #endif 41 EOF 42 ''; 43 44 preConfigure = '' ··· 46 sh autogen.sh 47 ''; 48 49 meta = { 50 homepage = "http://www.opensource.apple.com/source/cctools/"; 51 description = "Mac OS X Compiler Tools (cross-platform port)"; ··· 53 }; 54 }; 55 in { 56 - # Hacks that for the darwin stdenv (sad that we need write workarounds for what started as a darwin package) 57 native = stdenv.mkDerivation (baseParams // { 58 - patches = baseParams.patches ++ [ ./darwin.patch ]; 59 - 60 postInstall = '' 61 - cd $out/bin 62 - for tool in dwarfdump dsymutil; do 63 - ln -s /usr/bin/$tool 64 - done 65 ''; 66 }); 67
··· 1 { stdenv, fetchurl, autoconf, automake, libtool 2 + , llvm, libcxx, libcxxabi, clang, openssl, libuuid 3 + , libobjc ? null 4 }: 5 6 let 7 baseParams = rec { 8 name = "cctools-port-${version}"; 9 + version = "862"; 10 11 src = let 12 # Should be fetchFromGitHub but it was whining so this will do for now 13 owner = "tpoechtrager"; 14 repo = "cctools-port"; 15 + rev = "59d21d2c793c51d205c8b4ab14b9b28e63c72445"; 16 in fetchurl { 17 url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; 18 + sha256 = "01f31ijpnplbiyp7ldwzy8vbkn3j3m56n5blsvsav5nlp4lp2g71"; 19 }; 20 21 + buildInputs = [ autoconf automake libtool openssl libuuid ] ++ 22 + # Only need llvm and clang if the stdenv isn't already clang-based (TODO: just make a stdenv.cc.isClang) 23 + stdenv.lib.optionals (!stdenv.isDarwin) [ llvm clang ] ++ 24 + stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ]; 25 26 + patches = [ 27 + ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch 28 + ]; 29 30 enableParallelBuilding = true; 31 32 + configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [ "CXXFLAGS=-I${libcxx}/include/c++/v1" ]; 33 + 34 postPatch = '' 35 + sed -i -e 's/addStandardLibraryDirectories = true/addStandardLibraryDirectories = false/' cctools/ld64/src/ld/Options.cpp 36 + 37 + # FIXME: there are far more absolute path references that I don't want to fix right now 38 + substituteInPlace cctools/configure.ac \ 39 + --replace "-isystem /usr/local/include -isystem /usr/pkg/include" "" \ 40 + --replace "-L/usr/local/lib" "" \ 41 + 42 + substituteInPlace cctools/include/Makefile \ 43 + --replace "/bin/" "" 44 + 45 patchShebangs tools 46 sed -i -e 's/which/type -P/' tools/*.sh 47 ··· 55 # include_next "unistd.h" 56 #endif 57 EOF 58 + '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' 59 + sed -i -e 's|clang++|& -I${libcxx}/include/c++/v1|' cctools/autogen.sh 60 ''; 61 62 preConfigure = '' ··· 64 sh autogen.sh 65 ''; 66 67 + preInstall = '' 68 + pushd include 69 + make DSTROOT=$out/include RC_OS=common install 70 + popd 71 + ''; 72 + 73 meta = { 74 homepage = "http://www.opensource.apple.com/source/cctools/"; 75 description = "Mac OS X Compiler Tools (cross-platform port)"; ··· 77 }; 78 }; 79 in { 80 native = stdenv.mkDerivation (baseParams // { 81 + # A hack for now... 82 postInstall = '' 83 + cat >$out/bin/dsymutil << EOF 84 + #!${stdenv.shell} 85 + EOF 86 + chmod +x $out/bin/dsymutil 87 ''; 88 }); 89
+2 -2
pkgs/top-level/all-packages.nix
··· 8402 cmdline = callPackage ../os-specific/darwin/command-line-tools {}; 8403 in rec { 8404 8405 - cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools/port.nix { 8406 cross = assert crossSystem != null; crossSystem; 8407 inherit maloader; 8408 xctoolchain = xcode.toolchain; 8409 - }); 8410 8411 cctools_native = (callPackage ../os-specific/darwin/cctools/port.nix {}).native; 8412
··· 8402 cmdline = callPackage ../os-specific/darwin/command-line-tools {}; 8403 in rec { 8404 8405 + cctools = callPackage (forceNativeDrv (callPackage ../os-specific/darwin/cctools/port.nix {}).cross) { 8406 cross = assert crossSystem != null; crossSystem; 8407 inherit maloader; 8408 xctoolchain = xcode.toolchain; 8409 + }; 8410 8411 cctools_native = (callPackage ../os-specific/darwin/cctools/port.nix {}).native; 8412