Index: lang/ruby/files/patch-configure.in
===================================================================
--- lang/ruby/files/patch-configure.in	(revision 27039)
+++ lang/ruby/files/patch-configure.in	(working copy)
@@ -1,58 +0,0 @@
---- configure.in.orig	2006-08-07 19:37:43.000000000 -0700
-+++ configure.in	2006-09-20 16:57:30.000000000 -0700
-@@ -1533,9 +1533,28 @@
- AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
- AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
- 
-+AC_ARG_WITH(vendordir,
-+	    [  --with-vendordir=DIR      vendor libraries in DIR [PREFIX/lib/ruby/vendor_ruby]],
-+            [vendordir=$withval],
-+            [vendordir='${prefix}/lib/ruby/vendor_ruby'])
-+VENDOR_DIR="`eval \"echo ${vendordir}\"`"
-+case "$target_os" in
-+  cygwin*|mingw*|*djgpp*|os2_emx*)
-+    RUBY_VENDOR_LIB_PATH="`expr "$VENDOR_DIR" : "$prefix\(/.*\)"`" ||
-+    RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
-+  *)
-+    RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
-+esac
-+RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${MAJOR}.${MINOR}"
-+
-+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
-+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
-+
- AC_SUBST(arch)dnl
- AC_SUBST(sitearch)dnl
-+AC_SUBST(vendorarch)dnl
- AC_SUBST(sitedir)dnl
-+AC_SUBST(vendordir)dnl
- 
- configure_args=$ac_configure_args
- AC_SUBST(configure_args)dnl
-@@ -1548,6 +1567,8 @@
- 
-     AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
-                  "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
-+    AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
-+                 "${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
-     AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
- else
-     arch="${target_cpu}-${target_os}"
-@@ -1555,12 +1576,15 @@
- fi
- 
- case "$target_os" in
--  mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
--  *) sitearch="${arch}" ;;
-+  mingw*) sitearch="i386-$rb_cv_msvcrt"
-+  		  vendorarch="i386-$rb_cv_msvcrt" ;;
-+  *) sitearch="${arch}"
-+     vendorarch="${arch}" ;;
- esac
- 
- AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
- AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
-+AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${vendorarch}")
- 
- AC_ARG_WITH(search-path,
- 		[  --with-search-path=DIR specify the additional search path],
Index: lang/ruby/files/patch-universal
===================================================================
--- lang/ruby/files/patch-universal	(revision 0)
+++ lang/ruby/files/patch-universal	(revision 0)
@@ -0,0 +1,66 @@
+--- configure.orig	2007-07-19 16:03:30.000000000 +0200
++++ configure	2007-07-19 16:03:46.000000000 +0200
+@@ -16709,7 +16709,7 @@
+ 	;;
+     darwin*)
+ 	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib'
+-	LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace'
++	LIBRUBY_LDSHARED='cc $(CFLAGS) -dynamiclib -undefined suppress -flat_namespace'
+ 	LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)'
+ 	LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib'
+ 	;;
+@@ -16987,7 +16987,8 @@
+ _ACEOF
+ 
+ else
+-    arch="${target_cpu}-${target_os}"
++    darwin_version=`sysctl -n kern.sysv.shmseg`
++    arch="universal-darwin${darwin_version}.0"
+     cat >>confdefs.h <<_ACEOF
+ #define RUBY_PLATFORM "${arch}"
+ _ACEOF
+
+--- lib/mkmf.rb.orig	2007-07-13 11:10:23.000000000 +0200
++++ lib/mkmf.rb	2007-07-13 11:10:47.000000000 +0200
+@@ -286,7 +286,7 @@
+ 
+ def cpp_command(outfile, opt="")
+   Config::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
+-		 CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote))
++		 CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)).gsub(/-arch \w+/, '')
+ end
+ 
+ def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
+--- defines.h.orig	2007-07-17 09:29:34.000000000 +0200
++++ defines.h	2007-07-17 09:31:42.000000000 +0200
+@@ -102,6 +102,16 @@
+ #endif
+ #endif
+
++#if defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)
++/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
++   result in a different endian.  Instead trust __BIG_ENDIAN__ and
++   __LITTLE_ENDIAN__ which are set correctly by -arch. */
++#undef WORDS_BIGENDIAN
++#ifdef __BIG_ENDIAN__
++#define WORDS_BIGENDIAN
++#endif
++#endif
++
+ #ifdef __NeXT__
+ /* NextStep, OpenStep, Rhapsody */
+ #ifndef S_IRUSR
+@@ -155,13 +165,6 @@
+ #ifndef S_ISREG
+ #define S_ISREG(mode)  (((mode) & (0170000)) == (0100000))
+ #endif
+-/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
+-   result in a different endian.  Instead trust __BIG_ENDIAN__ and
+-   __LITTLE_ENDIAN__ which are set correctly by -arch. */
+-#undef WORDS_BIGENDIAN
+-#ifdef __BIG_ENDIAN__
+-#define WORDS_BIGENDIAN
+-#endif
+ #ifndef __APPLE__
+ /* NextStep, OpenStep (but not Rhapsody) */
+ #ifndef GETPGRP_VOID
Index: lang/ruby/files/patch-configure
===================================================================
--- lang/ruby/files/patch-configure	(revision 0)
+++ lang/ruby/files/patch-configure	(revision 0)
@@ -0,0 +1,139 @@
+--- configure.orig	2007-07-19 15:54:10.000000000 +0200
++++ configure	2007-07-19 15:55:01.000000000 +0200
+@@ -746,7 +746,9 @@
+ MAKEFILES
+ arch
+ sitearch
++vendorarch
+ sitedir
++vendordir
+ configure_args
+ NROFF
+ MANTYPE
+@@ -1370,6 +1372,7 @@
+   --with-dln-a-out        use dln_a_out if possible
+   --with-static-linked-ext link external modules statically
+   --with-sitedir=DIR      site libraries in DIR PREFIX/lib/ruby/site_ruby
++  --with-vendordir=DIR      vendor libraries in DIR PREFIX/lib/ruby/vendor_ruby
+   --with-search-path=DIR specify the additional search path
+   --with-mantype=TYPE specify man page type; TYPE is one of man and doc
+ 
+@@ -12983,13 +12986,11 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+-#include <sys/types.h> /* for off_t */
+-     #include <stdio.h>
++#include <stdio.h>
+ int
+ main ()
+ {
+-int (*fp) (FILE *, off_t, int) = fseeko;
+-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
++return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+   ;
+   return 0;
+ }
+@@ -13029,13 +13030,11 @@
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ #define _LARGEFILE_SOURCE 1
+-#include <sys/types.h> /* for off_t */
+-     #include <stdio.h>
++#include <stdio.h>
+ int
+ main ()
+ {
+-int (*fp) (FILE *, off_t, int) = fseeko;
+-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
++return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+   ;
+   return 0;
+ }
+@@ -16938,6 +16937,33 @@
+ 
+ 
+ 
++# Check whether --with-vendordir was given.
++if test "${with_vendordir+set}" = set; then
++  withval=$with_vendordir; vendordir=$withval
++else
++  vendordir='${prefix}/lib/ruby/vendor_ruby'
++fi
++
++VENDOR_DIR="`eval \"echo ${vendordir}\"`"
++case "$target_os" in
++  cygwin*|mingw*|*djgpp*|os2_emx*)
++    RUBY_VENDOR_LIB_PATH="`expr "$VENDOR_DIR" : "$prefix\(/.*\)"`" ||
++    RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
++  *)
++    RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
++esac
++RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${MAJOR}.${MINOR}"
++
++cat >>confdefs.h <<_ACEOF
++#define RUBY_VENDOR_LIB "${RUBY_VENDOR_LIB_PATH}"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++#define RUBY_VENDOR_LIB2 "${RUBY_VENDOR_LIB_PATH2}"
++_ACEOF
++
++
++
+ configure_args=$ac_configure_args
+ 
+ if test "$fat_binary" != no ; then
+@@ -16953,6 +16979,10 @@
+ _ACEOF
+ 
+     cat >>confdefs.h <<_ACEOF
++#define RUBY_VENDOR_THIN_ARCHLIB "${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}"
++_ACEOF
++
++    cat >>confdefs.h <<_ACEOF
+ #define RUBY_PLATFORM __ARCHITECTURE__ "-${target_os}"
+ _ACEOF
+ 
+@@ -16965,8 +16995,10 @@
+ fi
+ 
+ case "$target_os" in
+-  mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
+-  *) sitearch="${arch}" ;;
++  mingw*) sitearch="i386-$rb_cv_msvcrt"
++  		  vendorarch="i386-$rb_cv_msvcrt" ;;
++  *) sitearch="${arch}"
++     vendorarch="${arch}" ;;
+ esac
+ 
+ cat >>confdefs.h <<_ACEOF
+@@ -16977,6 +17009,10 @@
+ #define RUBY_SITE_ARCHLIB "${RUBY_SITE_LIB_PATH2}/${sitearch}"
+ _ACEOF
+ 
++cat >>confdefs.h <<_ACEOF
++#define RUBY_VENDOR_ARCHLIB "${RUBY_VENDOR_LIB_PATH2}/${vendorarch}"
++_ACEOF
++
+ 
+ 
+ # Check whether --with-search-path was given.
+@@ -17886,14 +17922,16 @@
+ MAKEFILES!$MAKEFILES$ac_delim
+ arch!$arch$ac_delim
+ sitearch!$sitearch$ac_delim
++vendorarch!$vendorarch$ac_delim
+ sitedir!$sitedir$ac_delim
++vendordir!$vendordir$ac_delim
+ configure_args!$configure_args$ac_delim
+ NROFF!$NROFF$ac_delim
+ MANTYPE!$MANTYPE$ac_delim
+ LTLIBOBJS!$LTLIBOBJS$ac_delim
+ _ACEOF
+ 
+-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 42; then
++  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 44; then
+     break
+   elif $ac_last_try; then
+     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Index: lang/ruby/Portfile
===================================================================
--- lang/ruby/Portfile	(revision 27039)
+++ lang/ruby/Portfile	(working copy)
@@ -30,14 +30,12 @@
 				port:ncurses
 				
 patchfiles		patch-Makefile.in \
-				patch-configure.in \
+				patch-configure \
 				patch-instruby.rb \
 				patch-mkconfig.rb \
 				patch-mkmf.rb \
 				patch-ruby.c
 
-use_autoconf	yes
-
 configure.args	--enable-shared \
 				--mandir="${prefix}/share/man" \
 				--enable-pthread \
@@ -82,6 +80,16 @@
 
 default_variants	+thread_hooks
 
+# universal support
+pre-patch {
+	if {[variant_isset universal]} {
+		patchfiles-append	patch-universal
+	}
+}
+# some checks in mkmf.rb choke on the sysroot flag, which causes the openssl extension to not build
+configure.universal_cflags -arch i386 -arch ppc
+configure.universal_cxxflags -arch i386 -arch ppc
+
 livecheck.check	regex
 livecheck.url	http://www.ruby-lang.org/en/downloads/
 livecheck.regex	{>Ruby (.*?)</a> \(md5:}
