Revision: 91469 https://trac.macports.org/changeset/91469 Author: jeremyhu@macports.org Date: 2012-04-02 12:47:47 -0700 (Mon, 02 Apr 2012) Log Message: ----------- {clang,llvm}-*: Additional fixes for Tiger and Leopard Now that apple-gcc42 builds on Tiger, we can use it to build clang on Tiger. This should allow us to now suport +universal on Tiger. We also now use apple-gcc42 on Leopard because g++-4.0 produces some C++ that may not link, and the older host gcc-4.2 has some issues with trunk, so just use the newer apple-gcc42 on those older platforms. llvm-3.1 does not currently build ppc clang-3.1 still does not build on Leopard and Tiger, but this brings us closer. Modified Paths: -------------- trunk/dports/lang/clang-2.9/Portfile trunk/dports/lang/clang-3.0/Portfile trunk/dports/lang/clang-3.1/Portfile trunk/dports/lang/llvm-2.9/Portfile trunk/dports/lang/llvm-3.0/Portfile trunk/dports/lang/llvm-3.1/Portfile Added Paths: ----------- trunk/dports/lang/clang-3.1/files/tiger.patch trunk/dports/lang/llvm-3.1/files/tiger.patch Modified: trunk/dports/lang/clang-2.9/Portfile =================================================================== --- trunk/dports/lang/clang-2.9/Portfile 2012-04-02 19:21:10 UTC (rev 91468) +++ trunk/dports/lang/clang-2.9/Portfile 2012-04-02 19:47:47 UTC (rev 91469) @@ -73,13 +73,23 @@ select.group clang select.file ${filespath}/mp-${name} +# g++-4.0 fails to build some of the newer C++ for ppc +# Intel looks ok, but I prefer using gcc-4.2 for consistency +if {${configure.compiler} == "gcc-4.0"} { + configure.compiler gcc-4.2 + if {![file exists ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + } +} + variant universal { build.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" destroot.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" post-extract { # workaround a bug in Apple's shipped gcc driver-driver, patched in @@ -107,19 +117,15 @@ } platform darwin 8 { - configure.args-delete --enable-shared --enable-jit - configure.compiler macports-gcc-4.6 - depends_run-append port:gcc46 port:gmake - depends_skip_archcheck-append gcc46 gmake - # Tiger's DevTools make has issues with the nested ifs in compiler-rt + depends_run-append port:gmake + depends_skip_archcheck-append gmake build.cmd ${prefix}/bin/gmake destroot.cmd ${prefix}/bin/gmake - # It's not that we can't do it universal, it's that the host toolchains - # won't link clang, so universal gives us a bootstrap issue since only - # apple-gcc42, llvm-gcc42, and clang-* can be used to build universal - universal_variant no + post-configure { + reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config + } } post-extract { Modified: trunk/dports/lang/clang-3.0/Portfile =================================================================== --- trunk/dports/lang/clang-3.0/Portfile 2012-04-02 19:21:10 UTC (rev 91468) +++ trunk/dports/lang/clang-3.0/Portfile 2012-04-02 19:47:47 UTC (rev 91469) @@ -73,13 +73,23 @@ select.group clang select.file ${filespath}/mp-${name} +# g++-4.0 fails to build some of the newer C++ for ppc +# Intel looks ok, but I prefer using gcc-4.2 for consistency +if {${configure.compiler} == "gcc-4.0"} { + configure.compiler gcc-4.2 + if {![file exists ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + } +} + variant universal { build.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" destroot.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" post-extract { # workaround a bug in Apple's shipped gcc driver-driver, patched in @@ -107,19 +117,15 @@ } platform darwin 8 { - configure.args-delete --enable-shared --enable-jit - configure.compiler macports-gcc-4.6 - depends_run-append port:gcc46 port:gmake - depends_skip_archcheck-append gcc46 gmake - # Tiger's DevTools make has issues with the nested ifs in compiler-rt + depends_run-append port:gmake + depends_skip_archcheck-append gmake build.cmd ${prefix}/bin/gmake destroot.cmd ${prefix}/bin/gmake - # It's not that we can't do it universal, it's that the host toolchains - # won't link clang, so universal gives us a bootstrap issue since only - # apple-gcc42, llvm-gcc42, and clang-* can be used to build universal - universal_variant no + post-configure { + reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config + } } post-extract { Modified: trunk/dports/lang/clang-3.1/Portfile =================================================================== --- trunk/dports/lang/clang-3.1/Portfile 2012-04-02 19:21:10 UTC (rev 91468) +++ trunk/dports/lang/clang-3.1/Portfile 2012-04-02 19:47:47 UTC (rev 91469) @@ -65,13 +65,29 @@ select.group clang select.file ${filespath}/mp-${name} +patchfiles tiger.patch +patch.pre_args -p1 + +# g++-4.0 fails to build some of the newer C++ for ppc +# Intel looks ok, but I prefer using gcc-4.2 for consistency +if {${configure.compiler} == "gcc-4.0"} { + configure.compiler gcc-4.2 + if {![file exists ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + } +} + +# linking fails for ppc +supported_archs i386 x86_64 + variant universal { build.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" destroot.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" post-extract { # workaround a bug in Apple's shipped gcc driver-driver, patched in @@ -99,19 +115,15 @@ } platform darwin 8 { - configure.args-delete --enable-shared --enable-jit - configure.compiler macports-gcc-4.6 - depends_run-append port:gcc46 port:gmake - depends_skip_archcheck-append gcc46 gmake - # Tiger's DevTools make has issues with the nested ifs in compiler-rt + depends_run-append port:gmake + depends_skip_archcheck-append gmake build.cmd ${prefix}/bin/gmake destroot.cmd ${prefix}/bin/gmake - # It's not that we can't do it universal, it's that the host toolchains - # won't link clang, so universal gives us a bootstrap issue since only - # apple-gcc42, llvm-gcc42, and clang-* can be used to build universal - universal_variant no + post-configure { + reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config + } } post-extract { Added: trunk/dports/lang/clang-3.1/files/tiger.patch =================================================================== --- trunk/dports/lang/clang-3.1/files/tiger.patch (rev 0) +++ trunk/dports/lang/clang-3.1/files/tiger.patch 2012-04-02 19:47:47 UTC (rev 91469) @@ -0,0 +1,32 @@ +diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc +index c9ec9fc..8cc4f41 100644 +--- a/lib/Support/Unix/Signals.inc ++++ b/lib/Support/Unix/Signals.inc +@@ -267,6 +267,15 @@ void llvm::sys::PrintStackTraceOnErrorSignal() { + AddSignalHandler(PrintStackTrace, 0); + + #if defined(__APPLE__) ++ ++/* These aren't defined in the 10.4 SDK, so provide them here */ ++#ifndef EXC_MASK_CRASH ++#define EXC_MASK_CRASH 0x400 ++#endif ++#ifndef MACH_EXCEPTION_CODES ++#define MACH_EXCEPTION_CODES 0x80000000 ++#endif ++ + // Environment variable to disable any kind of crash dialog. + if (getenv("LLVM_DISABLE_CRASH_REPORT")) { + mach_port_t self = mach_task_self(); + +--- a/tools/clang/tools/libclang/CIndex.cpp.orig 2012-04-01 22:38:40.000000000 -0700 ++++ b/tools/clang/tools/libclang/CIndex.cpp 2012-04-01 22:39:17.000000000 -0700 +@@ -5754,7 +5754,7 @@ void SetSafetyThreadStackSize(unsigned V + + void clang::setThreadBackgroundPriority() { + // FIXME: Move to llvm/Support and make it cross-platform. +-#ifdef __APPLE__ ++#if defined(__APPLE__) && defined(PRIO_DARWIN_THREAD) && defined(PRIO_DARWIN_BG) + setpriority(PRIO_DARWIN_THREAD, 0, PRIO_DARWIN_BG); + #endif + } Modified: trunk/dports/lang/llvm-2.9/Portfile =================================================================== --- trunk/dports/lang/llvm-2.9/Portfile 2012-04-02 19:21:10 UTC (rev 91468) +++ trunk/dports/lang/llvm-2.9/Portfile 2012-04-02 19:47:47 UTC (rev 91469) @@ -56,13 +56,23 @@ select.group llvm select.file ${filespath}/mp-${name} +# g++-4.0 fails to build some of the newer C++ for ppc +# Intel looks ok, but I prefer using gcc-4.2 for consistency +if {${configure.compiler} == "gcc-4.0"} { + configure.compiler gcc-4.2 + if {![file exists ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + } +} + variant universal { build.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" destroot.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" post-extract { # workaround a bug in Apple's shipped gcc driver-driver, patched in @@ -101,7 +111,9 @@ } platform darwin 8 { - configure.args-delete --enable-shared --enable-jit + post-configure { + reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config + } } variant ocaml description {Enable generation of OCaml binding} { Modified: trunk/dports/lang/llvm-3.0/Portfile =================================================================== --- trunk/dports/lang/llvm-3.0/Portfile 2012-04-02 19:21:10 UTC (rev 91468) +++ trunk/dports/lang/llvm-3.0/Portfile 2012-04-02 19:47:47 UTC (rev 91469) @@ -56,13 +56,23 @@ select.group llvm select.file ${filespath}/mp-${name} +# g++-4.0 fails to build some of the newer C++ for ppc +# Intel looks ok, but I prefer using gcc-4.2 for consistency +if {${configure.compiler} == "gcc-4.0"} { + configure.compiler gcc-4.2 + if {![file exists ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + } +} + variant universal { build.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" destroot.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" post-extract { # workaround a bug in Apple's shipped gcc driver-driver, patched in @@ -101,7 +111,9 @@ } platform darwin 8 { - configure.args-delete --enable-shared --enable-jit + post-configure { + reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config + } } variant ocaml description {Enable generation of OCaml binding} { Modified: trunk/dports/lang/llvm-3.1/Portfile =================================================================== --- trunk/dports/lang/llvm-3.1/Portfile 2012-04-02 19:21:10 UTC (rev 91468) +++ trunk/dports/lang/llvm-3.1/Portfile 2012-04-02 19:47:47 UTC (rev 91469) @@ -52,13 +52,29 @@ select.group llvm select.file ${filespath}/mp-${name} +patchfiles tiger.patch +patch.pre_args -p1 + +# g++-4.0 fails to build some of the newer C++ for ppc +# Intel looks ok, but I prefer using gcc-4.2 for consistency +if {${configure.compiler} == "gcc-4.0"} { + configure.compiler gcc-4.2 + if {![file exists ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + } +} + +# linking fails for ppc +supported_archs i386 x86_64 + variant universal { build.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" destroot.env-append \ UNIVERSAL=1 \ - UNIVERSAL_ARCH="${universal_archs}" + UNIVERSAL_ARCH="[get_canonical_archs]" post-extract { # workaround a bug in Apple's shipped gcc driver-driver, patched in @@ -97,7 +113,9 @@ } platform darwin 8 { - configure.args-delete --enable-shared --enable-jit + post-configure { + reinplace "/^RPATH/s/=.*/=/" ${worksrcpath}/Makefile.config + } } variant ocaml description {Enable generation of OCaml binding} { Added: trunk/dports/lang/llvm-3.1/files/tiger.patch =================================================================== --- trunk/dports/lang/llvm-3.1/files/tiger.patch (rev 0) +++ trunk/dports/lang/llvm-3.1/files/tiger.patch 2012-04-02 19:47:47 UTC (rev 91469) @@ -0,0 +1,21 @@ +diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc +index c9ec9fc..8cc4f41 100644 +--- a/lib/Support/Unix/Signals.inc ++++ b/lib/Support/Unix/Signals.inc +@@ -267,6 +267,15 @@ void llvm::sys::PrintStackTraceOnErrorSignal() { + AddSignalHandler(PrintStackTrace, 0); + + #if defined(__APPLE__) ++ ++/* These aren't defined in the 10.4 SDK, so provide them here */ ++#ifndef EXC_MASK_CRASH ++#define EXC_MASK_CRASH 0x400 ++#endif ++#ifndef MACH_EXCEPTION_CODES ++#define MACH_EXCEPTION_CODES 0x80000000 ++#endif ++ + // Environment variable to disable any kind of crash dialog. + if (getenv("LLVM_DISABLE_CRASH_REPORT")) { + mach_port_t self = mach_task_self(); +