[95753] trunk/dports/lang/ruby

kimuraw at macports.org kimuraw at macports.org
Sat Jul 21 02:40:31 PDT 2012


Revision: 95753
          https://trac.macports.org/changeset/95753
Author:   kimuraw at macports.org
Date:     2012-07-21 02:40:29 -0700 (Sat, 21 Jul 2012)
Log Message:
-----------
lang/ruby: allow build with clang (Xcode 4.2 or later).
  passed `make test-all' on these environment.
    - Mac OS X 10.8GM, Xcode 4.4GM
    - Mac OS X 10.7.4, Xcode 4.3.3
    - Mac OS X 10.7.4, Xcode 4.2.1
    - Mac OS X 10.6.8, Xcode 3.2.6 (use gcc)

Modified Paths:
--------------
    trunk/dports/lang/ruby/Portfile

Added Paths:
-----------
    trunk/dports/lang/ruby/files/patch-configure.diff
    trunk/dports/lang/ruby/files/patch-numeric.c.diff

Modified: trunk/dports/lang/ruby/Portfile
===================================================================
--- trunk/dports/lang/ruby/Portfile	2012-07-21 09:01:31 UTC (rev 95752)
+++ trunk/dports/lang/ruby/Portfile	2012-07-21 09:40:29 UTC (rev 95753)
@@ -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 \

Added: trunk/dports/lang/ruby/files/patch-configure.diff
===================================================================
--- trunk/dports/lang/ruby/files/patch-configure.diff	                        (rev 0)
+++ trunk/dports/lang/ruby/files/patch-configure.diff	2012-07-21 09:40:29 UTC (rev 95753)
@@ -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

Added: trunk/dports/lang/ruby/files/patch-numeric.c.diff
===================================================================
--- trunk/dports/lang/ruby/files/patch-numeric.c.diff	                        (rev 0)
+++ trunk/dports/lang/ruby/files/patch-numeric.c.diff	2012-07-21 09:40:29 UTC (rev 95753)
@@ -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;
+ 	    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120721/04687697/attachment-0001.html>


More information about the macports-changes mailing list