diff --git a/lang/jruby/Makefile b/lang/jruby/Makefile
index 61b685c38d5..b099283f418 100644
--- a/lang/jruby/Makefile
+++ b/lang/jruby/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.26 2011/11/08 23:47:20 jeremy Exp $
+# $OpenBSD: Makefile,v 1.27 2011/11/14 11:38:16 jeremy Exp $
 
 SHARED_ONLY =	Yes
 
@@ -36,13 +36,14 @@ BUILD_DEPENDS =	devel/apache-ant \
 		${RUN_DEPENDS}
 RUN_DEPENDS =	java/javaPathHelper
 
-MAKE_ENV =	JAVA_HOME=${JAVA_HOME} ANT_OPTS="-Xms384m -Xmx384m" \
+MAKE_ENV =	JAVA_HOME=${JAVA_HOME} ANT_OPTS="-Xms434m -Xmx434m" \
 			MAKE=${MAKE_PROGRAM}
 			
 JRUBY_HOME =	${PREFIX}/jruby
 
 WRKDIST =	${WRKDIR}/jruby-${V}
-ANT_CMD =	${SETENV} ${MAKE_ENV} ${LOCALBASE}/bin/ant
+ANT_CMD =	${SETENV} ${MAKE_ENV} PATH=${JAVA_HOME}/bin:${PATH} \
+			${LOCALBASE}/bin/ant
 JFFI_HOME =	${WRKDIST}/jffi
 JFFI_ARCH =	${MACHINE_ARCH:S/amd64/x86_64/}-OpenBSD
 FFI_ARCH =	${JFFI_ARCH:L}
@@ -59,9 +60,7 @@ post-extract:
 		&& cd jruby-launcher && tar zxf ../data.tar.gz
 
 pre-configure:
-	# SUBST_CMD causes problems because $\( -> $(
-	perl -pi -e 's,\$$\{LOCALBASE\},'${LOCALBASE}',g' \
-		${WRKSRC}/lib/ruby/site_ruby/shared/mkmf.rb \
+	${SUBST_CMD} ${WRKSRC}/lib/ruby/site_ruby/shared/mkmf.rb \
 		${WRKSRC}/jruby-launcher/unixlauncher.cpp
 	# Rebuild the jruby-launcher gem
 	cd ${WRKSRC}/jruby-launcher && find . -type f \! -name '*.orig'  -print | \
@@ -110,8 +109,19 @@ do-install:
 	mkdir -p ${JRUBY_HOME}/lib/ruby/site_ruby/1.8/java
 	chown -R ${SHAREOWN}:${SHAREGRP} ${JRUBY_HOME}/lib ${JRUBY_HOME}/share
 
+REGRESS_DEPENDS =	devel/git
+ANT_REGRESS_CMD =	${SETENV} ${MAKE_ENV} HOME=${WRKBUILD} \
+				PATH=${JAVA_HOME}/bin:${PATH} \
+				${LOCALBASE}/bin/ant
+# Expected test failures:
+#   4 Failures in JRubyTestSuite
+#   1 Failure in MainTestSuite
+#   1 Failure in MRITestSuite
+# 41 spec failures, 2 errors, but this grabs the latest specs via git, so it
+# can change.
 do-regress:
-	cd ${WRKSRC} && ${ANT_CMD} test
-	cd ${WRKSRC} && ${ANT_CMD} spec
+	rm -f ${WRKSRC}/lib/jruby-complete.jar
+	-cd ${WRKSRC} && ${ANT_REGRESS_CMD} test
+	cd ${WRKSRC} && ${ANT_REGRESS_CMD} spec
 
 .include <bsd.port.mk>
diff --git a/lang/jruby/patches/patch-build_xml b/lang/jruby/patches/patch-build_xml
index 29a0b16937e..1cbc0ee5cf6 100644
--- a/lang/jruby/patches/patch-build_xml
+++ b/lang/jruby/patches/patch-build_xml
@@ -1,10 +1,17 @@
-$OpenBSD: patch-build_xml,v 1.3 2011/11/08 23:58:08 jeremy Exp $
+$OpenBSD: patch-build_xml,v 1.4 2011/11/14 11:38:16 jeremy Exp $
 
-Fix build, backported from git commit 
-a760b4aea4b5aa9b38da4bd3334d8355a83f60fa.
+Fix build by removing ri cache generation, backported from git
+commit a760b4aea4b5aa9b38da4bd3334d8355a83f60fa.
 
---- build.xml.orig	Sun Oct 30 20:59:44 2011
-+++ build.xml	Sun Oct 30 21:01:00 2011
+Don't install the jruby launcher when running the regress specs,
+as it fails due to a make error and it isn't necessary for the
+regress tests.
+
+Also, don't fork for the regress tests, as otherwise the JVM
+exits abnormally.
+
+--- build.xml.orig	Tue Oct 25 16:54:51 2011
++++ build.xml	Sun Nov 13 23:49:50 2011
 @@ -379,7 +379,6 @@
        </jar>
  
@@ -21,3 +28,26 @@ a760b4aea4b5aa9b38da4bd3334d8355a83f60fa.
    </target>
    <target name="jarjar" depends="jar-jruby-dist"/>
  
+@@ -806,13 +804,6 @@
+       <env key="GEM_PATH" value=""/> <!-- to ignore any gems installed in ~/.gem -->
+       <arg line="-S gem uninstall --all jruby-launcher"/>
+     </java>
+-    <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
+-      <classpath refid="build.classpath"/>
+-      <classpath path="${jruby.classes.dir}"/>
+-      <sysproperty key="jruby.home" value="${basedir}"/>
+-      <env key="GEM_PATH" value=""/> <!-- to ignore any gems installed in ~/.gem -->
+-      <arg line="-S gem install ${jruby.launcher.gem}"/>
+-    </java>
+   </target>
+ 
+   <target name="test" depends="
+@@ -967,7 +958,7 @@
+       <echo message="compile=@{compile.mode}, jit.threshold=@{jit.threshold}, jit.maxsize=@{jit.maxsize}, jit.max=@{jit.max}, objectspace=@{objectspace.enabled} threadpool=@{thread.pooling} reflection=@{reflection} version=@{jruby.version}"/>
+       <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit.jar"/>
+ 
+-      <junit jvm="${jruby.test.jvm}" fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="1800000">
++      <junit jvm="${jruby.test.jvm}" haltonfailure="false" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="1800000">
+ 	<classpath refid="test.class.path"/>
+ 
+ 	<sysproperty key="java.awt.headless" value="true"/>