Currently, lang/jruby installs to /usr/local/jruby, and you have to add /usr/local/jruby/bin to your PATH in order to use jruby. This hardcodes the full path in the jruby binary in argv[0], and sets up a /usr/local/bin/jruby symlink, allowing you to run jruby without PATH modifications. Without the hardcoding of the full path in argv[0], jruby does not run if you access it through the symlink.
Ruby does not provide access to argv[0], so this should not affect ruby code, though I'm not sure if ruby extensions could access it. It seems unlikely that this would break anything, though. Tested on i386 and amd64. I plan to commit this next week unless I hear objections. Jeremy Index: Makefile =================================================================== RCS file: /cvs/ports/lang/jruby/Makefile,v retrieving revision 1.28 diff -u -p -r1.28 Makefile --- Makefile 14 Nov 2011 12:00:04 -0000 1.28 +++ Makefile 2 Dec 2011 17:47:04 -0000 @@ -7,6 +7,7 @@ COMMENT = pure-Java implementation of th V = 1.6.5 DISTNAME = jruby-src-${V} PKGNAME = jruby-${V} +REVISION = 0 CATEGORIES = lang lang/ruby DISTFILES = ${DISTNAME}.tar.gz \ wmeissner-jffi-1.0.2-0-ge0d10e9.tar.gz:0 @@ -61,6 +62,7 @@ post-extract: pre-configure: ${SUBST_CMD} ${WRKSRC}/lib/ruby/site_ruby/shared/mkmf.rb \ + ${WRKSRC}/jruby-launcher/jrubyexe.cpp \ ${WRKSRC}/jruby-launcher/unixlauncher.cpp # Rebuild the jruby-launcher gem cd ${WRKSRC}/jruby-launcher && find . -type f \! -name '*.orig' -print | \ @@ -90,6 +92,7 @@ post-build: rm -r !(${FFI_ARCH}|*.ffi) do-install: + ln -s ${TRUEPREFIX}/jruby/bin/jruby ${PREFIX}/bin/jruby ${INSTALL_DATA_DIR} ${JRUBY_HOME} ${INSTALL_DATA_DIR} ${JRUBY_HOME}/bin for file in ast gem jgem jirb jirb_swing jruby jrubyc rdoc ri testrb; \ Index: patches/patch-jruby-launcher_jrubyexe_cpp =================================================================== RCS file: patches/patch-jruby-launcher_jrubyexe_cpp diff -N patches/patch-jruby-launcher_jrubyexe_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-jruby-launcher_jrubyexe_cpp 2 Dec 2011 17:35:40 -0000 @@ -0,0 +1,18 @@ +$OpenBSD$ + +Hardcode executable path so that the symlink in the standard PATH +works correctly. + +--- jruby-launcher/jrubyexe.cpp.orig Fri Dec 2 09:34:43 2011 ++++ jruby-launcher/jrubyexe.cpp Fri Dec 2 09:35:02 2011 +@@ -57,8 +57,10 @@ const char *CON_ATTACH_MSG = + + #include "utilsfuncs.h" + ++char JRUBY_PATH[] = "${LOCALBASE}/jruby/bin/jruby"; + + int main(int argc, char *argv[], char* envp[]) { ++ argv[0] = JRUBY_PATH; + checkLoggingArg(argc, argv, true); + + #ifdef WIN32 Index: pkg/MESSAGE =================================================================== RCS file: pkg/MESSAGE diff -N pkg/MESSAGE --- pkg/MESSAGE 9 Aug 2009 11:18:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1 +0,0 @@ -Please add ${JRUBY_HOME}/bin to your PATH to access the JRuby programs. Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/lang/jruby/pkg/PLIST,v retrieving revision 1.12 diff -u -p -r1.12 PLIST --- pkg/PLIST 8 Nov 2011 23:58:08 -0000 1.12 +++ pkg/PLIST 2 Dec 2011 17:21:33 -0000 @@ -1,4 +1,5 @@ @comment $OpenBSD: PLIST,v 1.12 2011/11/08 23:58:08 jeremy Exp $ +bin/jruby jruby/ jruby/bin/ jruby/bin/ast