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

This commit is contained in:
Dan Peebles 2015-02-08 00:39:45 -05:00
parent c4253520fe
commit e32950d11a
3 changed files with 39 additions and 139 deletions

View File

@ -1,122 +0,0 @@
From b6001ddb935351b4d150546ddab6d25eae05afaa Mon Sep 17 00:00:00 2001
From: Daniel Peebles <pumpkin@me.com>
Date: Sun, 12 Oct 2014 12:23:51 -0400
Subject: [PATCH] work
---
cctools/Makefile.am | 2 +-
cctools/configure.ac | 2 --
cctools/ld64/src/3rd/helper.c | 2 ++
cctools/ld64/src/3rd/strlcat.c | 2 ++
cctools/ld64/src/3rd/strlcpy.c | 3 ++-
cctools/ld64/src/ld/Options.cpp | 2 ++
tools/find_lto_header.sh | 2 +-
7 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/cctools/Makefile.am b/cctools/Makefile.am
index 44084ad..34a670c 100644
--- a/cctools/Makefile.am
+++ b/cctools/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS=libstuff ar as misc libobjc2 otool ld64 $(LD_CLASSIC)
+SUBDIRS=libstuff ar as misc ld64 $(LD_CLASSIC)
ACLOCAL_AMFLAGS = -I m4
diff --git a/cctools/configure.ac b/cctools/configure.ac
index c4f6c47..b641925 100644
--- a/cctools/configure.ac
+++ b/cctools/configure.ac
@@ -278,8 +278,6 @@ AC_CONFIG_FILES([as/ppc/Makefile])
AC_CONFIG_FILES([as/ppc64/Makefile])
#AC_CONFIG_FILES([man/Makefile])
AC_CONFIG_FILES([misc/Makefile])
-AC_CONFIG_FILES([otool/Makefile])
-AC_CONFIG_FILES([libobjc2/Makefile])
AC_CONFIG_FILES([ld/Makefile])
diff --git a/cctools/ld64/src/3rd/helper.c b/cctools/ld64/src/3rd/helper.c
index 19f4be7..bec6869 100644
--- a/cctools/ld64/src/3rd/helper.c
+++ b/cctools/ld64/src/3rd/helper.c
@@ -23,6 +23,7 @@
const char ldVersionString[] = "236.3\n";
+#if 0
void __assert_rtn(const char *func, const char *file, int line, const char *msg)
{
#ifdef __FreeBSD__
@@ -33,6 +34,7 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg)
__assert(msg, file, line);
#endif /* __FreeBSD__ */
}
+#endif
int _NSGetExecutablePath(char *path, unsigned int *size)
{
diff --git a/cctools/ld64/src/3rd/strlcat.c b/cctools/ld64/src/3rd/strlcat.c
index 500d038..dadf269 100644
--- a/cctools/ld64/src/3rd/strlcat.c
+++ b/cctools/ld64/src/3rd/strlcat.c
@@ -23,6 +23,7 @@
#include <string.h>
+#if 0
size_t
strlcat(char * restrict dst, const char * restrict src, size_t maxlen) {
const size_t srclen = strlen(src);
@@ -36,3 +37,4 @@ strlcat(char * restrict dst, const char * restrict src, size_t maxlen) {
}
return dstlen + srclen;
}
+#endif
\ No newline at end of file
diff --git a/cctools/ld64/src/3rd/strlcpy.c b/cctools/ld64/src/3rd/strlcpy.c
index c69f107..34a399b 100644
--- a/cctools/ld64/src/3rd/strlcpy.c
+++ b/cctools/ld64/src/3rd/strlcpy.c
@@ -23,6 +23,7 @@
#include <string.h>
+#if 0
size_t
strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) {
const size_t srclen = strlen(src);
@@ -34,4 +35,4 @@ strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) {
}
return srclen;
}
-
+#endif
\ No newline at end of file
diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
index 3a78df8..0ecf9f2 100644
--- a/cctools/ld64/src/ld/Options.cpp
+++ b/cctools/ld64/src/ld/Options.cpp
@@ -49,6 +49,8 @@ namespace lto {
extern const char* version();
}
+#define __MAC_OS_X_VERSION_MIN_REQUIRED 1060
+
// magic to place command line in crash reports
const int crashreporterBufferSize = 2000;
static char crashreporterBuffer[crashreporterBufferSize];
diff --git a/tools/find_lto_header.sh b/tools/find_lto_header.sh
index aee3a4a..4733981 100755
--- a/tools/find_lto_header.sh
+++ b/tools/find_lto_header.sh
@@ -14,7 +14,7 @@ function try()
# Adding the include directory with -I causes the build to fail.
ln -sf "$LLVM_INC_DIR/llvm-c/lto.h" "include/llvm-c/lto.h"
mkdir -p tmp
- echo -n "-Wl,-rpath,$LLVM_LIB_DIR,--enable-new-dtags -L$LLVM_LIB_DIR -lLTO " > tmp/ldflags
+ echo -n "-Wl,-rpath,$LLVM_LIB_DIR -L$LLVM_LIB_DIR -lLTO " > tmp/ldflags
echo -n "-DLTO_SUPPORT=1 " > tmp/cflags
echo -n "-DLTO_SUPPORT=1 " > tmp/cxxflags
echo -n "$LLVM_LIB_DIR" > tmp/ldpath
--
1.9.3 (Apple Git-50)

View File

@ -1,31 +1,47 @@
{ stdenv, fetchurl, autoconf, automake, libtool
, llvm, libcxx, clang, openssl, libuuid
, llvm, libcxx, libcxxabi, clang, openssl, libuuid
, libobjc ? null
}:
let
baseParams = rec {
name = "cctools-port-${version}";
version = "855";
version = "862";
src = let
# Should be fetchFromGitHub but it was whining so this will do for now
owner = "tpoechtrager";
repo = "cctools-port";
rev = "7083dddbb0f106d791d313829ea7dc45db90e375";
rev = "59d21d2c793c51d205c8b4ab14b9b28e63c72445";
in fetchurl {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = "017gxlcwgi7xhayjzj9w3fac175p2rm4vjzf9cycq9683m9pmyzj";
sha256 = "01f31ijpnplbiyp7ldwzy8vbkn3j3m56n5blsvsav5nlp4lp2g71";
};
buildInputs = [
autoconf automake libtool llvm clang openssl libuuid libcxx
];
buildInputs = [ autoconf automake libtool openssl libuuid ] ++
# Only need llvm and clang if the stdenv isn't already clang-based (TODO: just make a stdenv.cc.isClang)
stdenv.lib.optionals (!stdenv.isDarwin) [ llvm clang ] ++
stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ];
patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ];
patches = [
./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch
];
enableParallelBuilding = true;
configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [ "CXXFLAGS=-I${libcxx}/include/c++/v1" ];
postPatch = ''
sed -i -e 's/addStandardLibraryDirectories = true/addStandardLibraryDirectories = false/' cctools/ld64/src/ld/Options.cpp
# FIXME: there are far more absolute path references that I don't want to fix right now
substituteInPlace cctools/configure.ac \
--replace "-isystem /usr/local/include -isystem /usr/pkg/include" "" \
--replace "-L/usr/local/lib" "" \
substituteInPlace cctools/include/Makefile \
--replace "/bin/" ""
patchShebangs tools
sed -i -e 's/which/type -P/' tools/*.sh
@ -39,6 +55,8 @@ let
# include_next "unistd.h"
#endif
EOF
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
sed -i -e 's|clang++|& -I${libcxx}/include/c++/v1|' cctools/autogen.sh
'';
preConfigure = ''
@ -46,6 +64,12 @@ let
sh autogen.sh
'';
preInstall = ''
pushd include
make DSTROOT=$out/include RC_OS=common install
popd
'';
meta = {
homepage = "http://www.opensource.apple.com/source/cctools/";
description = "Mac OS X Compiler Tools (cross-platform port)";
@ -53,15 +77,13 @@ let
};
};
in {
# Hacks that for the darwin stdenv (sad that we need write workarounds for what started as a darwin package)
native = stdenv.mkDerivation (baseParams // {
patches = baseParams.patches ++ [ ./darwin.patch ];
# A hack for now...
postInstall = ''
cd $out/bin
for tool in dwarfdump dsymutil; do
ln -s /usr/bin/$tool
done
cat >$out/bin/dsymutil << EOF
#!${stdenv.shell}
EOF
chmod +x $out/bin/dsymutil
'';
});

View File

@ -8402,11 +8402,11 @@ let
cmdline = callPackage ../os-specific/darwin/command-line-tools {};
in rec {
cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools/port.nix {
cctools = callPackage (forceNativeDrv (callPackage ../os-specific/darwin/cctools/port.nix {}).cross) {
cross = assert crossSystem != null; crossSystem;
inherit maloader;
xctoolchain = xcode.toolchain;
});
};
cctools_native = (callPackage ../os-specific/darwin/cctools/port.nix {}).native;