Created
July 21, 2012 08:19
-
-
Save kimuraw/3155088 to your computer and use it in GitHub Desktop.
MacPorts port:ruby (ruby-1.8.7-p370) supports clang. requires Xcode 4.2 or later.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: files/patch-configure.diff | |
=================================================================== | |
--- files/patch-configure.diff (revision 0) | |
+++ files/patch-configure.diff (working copy) | |
@@ -0,0 +1,19 @@ | |
+--- configure.orig 2012-06-29 22:18:24.000000000 +0900 | |
++++ configure 2012-07-21 16:32:51.000000000 +0900 | |
+@@ -2722,6 +2722,7 @@ | |
+ | |
+ case $target_cpu in | |
+ i?86) frame_address=yes;; | |
++ x86_64) frame_address=yes;; | |
+ *) frame_address=no;; | |
+ esac | |
+ # Check whether --enable-frame-address was given. | |
+@@ -9843,7 +9844,7 @@ | |
+ fi | |
+ | |
+ case "$target_cpu" in | |
+-m68*|i?86|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;; | |
++m68*|i?86|x86_64|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;; | |
+ hppa*) rb_cv_stack_grow_dir=+1;; | |
+ esac | |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack growing direction" >&5 | |
Index: files/patch-numeric.c.diff | |
=================================================================== | |
--- files/patch-numeric.c.diff (revision 0) | |
+++ files/patch-numeric.c.diff (working copy) | |
@@ -0,0 +1,32 @@ | |
+--- numeric.c.orig 2011-12-10 21:17:27.000000000 +0900 | |
++++ numeric.c 2012-07-21 15:40:51.000000000 +0900 | |
+@@ -2161,7 +2161,7 @@ | |
+ VALUE x, y; | |
+ { | |
+ if (FIXNUM_P(y)) { | |
+-#ifdef __HP_cc | |
++#if defined(__HP_cc) || defined(__clang__) | |
+ /* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */ | |
+ volatile | |
+ #endif | |
+@@ -2319,9 +2319,9 @@ | |
+ y &= ~1; | |
+ do { | |
+ while (y % 2 == 0) { | |
+- long x2 = x * x; | |
++ volatile long x2 = x * x; | |
+ if (x2/x != x || !POSFIXABLE(x2)) { | |
+- VALUE v; | |
++ volatile VALUE v; | |
+ bignum: | |
+ v = rb_big_pow(rb_int2big(x), LONG2NUM(y)); | |
+ if (z != 1) v = rb_big_mul(rb_int2big(neg ? -z : z), v); | |
+@@ -2331,7 +2331,7 @@ | |
+ y >>= 1; | |
+ } | |
+ { | |
+- long xz = x * z; | |
++ volatile long xz = x * z; | |
+ if (!POSFIXABLE(xz) || xz / x != z) { | |
+ goto bignum; | |
+ } | |
Index: Portfile | |
=================================================================== | |
--- Portfile (revision 95342) | |
+++ Portfile (working copy) | |
@@ -5,7 +5,7 @@ | |
name ruby | |
version 1.8.7-p370 | |
-revision 0 | |
+revision 1 | |
categories lang ruby | |
maintainers kimuraw | |
@@ -45,12 +45,17 @@ | |
# c99: gperf generates code that doesn't work with clang (https://trac.macports.org/ticket/29974) | |
# lib-drb-ssl.rb: 512bits rsa key is too small for openssl-1.0.1. | |
# (http://bugs.ruby-lang.org/issues/6221) | |
+# --- clang support ---- | |
+# numeric.c: fix wrong optimizaton of Numeric/Bignum build with clang. | |
+# configure: correct frame_address and stack_direction for +universal with clang. | |
patchfiles patch-vendordir.diff \ | |
patch-bug3604.diff \ | |
patch-bug19050.diff \ | |
patch-bug15528.diff \ | |
patch-c99.diff \ | |
- patch-lib-drb-ssl.rb.diff | |
+ patch-lib-drb-ssl.rb.diff \ | |
+ patch-numeric.c.diff \ | |
+ patch-configure.diff | |
# ignore getcontext() and setcontext() | |
# on 10.5 or later, these functions have some problems (SEGV on ppc, slower than 1.8.6) | |
@@ -60,18 +65,24 @@ | |
use_parallel_build no | |
# [OK] apple-gcc-4.2 | |
-# clang (Xcode 4.2 or later) with CFLAGS="-std=c89 -O0" | |
+# clang (Xcode 4.2 or later) with -O[0s] | |
# [NG] llvm-gcc-4.2 | |
# clang (Xcode 4.1 or earlier) | |
-# clang (Xcode 4.2 or later) with CFLAGS=-O[12s] | |
+# clang (Xcode 4.2 or later) with -O[12] | |
if {${configure.compiler} == "llvm-gcc-4.2"} { | |
configure.compiler gcc-4.2 | |
} elseif {${configure.compiler} == "clang"} { | |
- depends_build-append port:apple-gcc42 | |
- depends_skip_archcheck-append apple-gcc42 | |
- configure.compiler apple-gcc-4.2 | |
- # base (as of 2.0.3) doesn't set cxx for apple-gcc-4.2 | |
- configure.cxx ${prefix}/bin/g++-apple-4.2 | |
+ if {[vercmp ${xcodeversion} 4.2] >= 0} { | |
+ #configure.compiler gcc-4.2 | |
+ configure.optflags -Os | |
+ configure.cppflags-append -std=c89 | |
+ } else { | |
+ depends_build-append port:apple-gcc42 | |
+ depends_skip_archcheck-append apple-gcc42 | |
+ configure.compiler apple-gcc-4.2 | |
+ # base (as of 2.0.3) doesn't set cxx for apple-gcc-4.2 | |
+ configure.cxx ${prefix}/bin/g++-apple-4.2 | |
+ } | |
} | |
configure.args --enable-shared \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment