aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralepulver <alepulver@FreeBSD.org>2008-02-17 05:03:49 +0800
committeralepulver <alepulver@FreeBSD.org>2008-02-17 05:03:49 +0800
commit1cf9bb21933cfa23075c9d7ce07e843e34258b31 (patch)
tree1ae373347e2d7fc8fce6edee3dc0d7dbfa317d3b
parentbe2eac0c63ec8d5f5102ea39cb9ea25a6adac385 (diff)
downloadfreebsd-ports-gnome-1cf9bb21933cfa23075c9d7ce07e843e34258b31.tar.gz
freebsd-ports-gnome-1cf9bb21933cfa23075c9d7ce07e843e34258b31.tar.zst
freebsd-ports-gnome-1cf9bb21933cfa23075c9d7ce07e843e34258b31.zip
Java-Readline is a port of GNU Readline for Java. Or, to be more
precise, it is a JNI-wrapper to Readline. It is distributed under the LGPL. You must call Readline.load(ReadlineLibrary lib); before using any other methods. If you omit the call to the load()-method, the pure Java fallback solution is used. Possible values for lib are: ReadlineLibrary.PureJava ReadlineLibrary.GnuReadline ReadlineLibrary.Editline ReadlineLibrary.Getline Note that all programs using GnuReadline will fall under the GPL, since Gnu-Readline is GPL software! WWW: http://sourceforge.net/projects/java-readline/ PR: ports/116817 Submitted by: Martin Kammerhofer <mkamm at gmx.net>
-rw-r--r--devel/Makefile1
-rw-r--r--devel/libreadline-java/Makefile60
-rw-r--r--devel/libreadline-java/distinfo3
-rw-r--r--devel/libreadline-java/files/JReadlineCompleter.py194
-rw-r--r--devel/libreadline-java/files/jython.sh48
-rw-r--r--devel/libreadline-java/files/patch-Makefile59
-rw-r--r--devel/libreadline-java/files/patch-src-Makefile11
-rw-r--r--devel/libreadline-java/files/patch-src-native-Makefile55
-rw-r--r--devel/libreadline-java/files/patch-src-native-getline.c10
-rw-r--r--devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c24
-rw-r--r--devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java52
-rw-r--r--devel/libreadline-java/pkg-descr17
-rw-r--r--devel/libreadline-java/pkg-message5
13 files changed, 539 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index cf3f2b762654..691b3663bee5 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -645,6 +645,7 @@
SUBDIR += libpthread-stubs
SUBDIR += librcc
SUBDIR += librcd
+ SUBDIR += libreadline-java
SUBDIR += libredblack
SUBDIR += libruin
SUBDIR += libs11n
diff --git a/devel/libreadline-java/Makefile b/devel/libreadline-java/Makefile
new file mode 100644
index 000000000000..3e55ec7263e0
--- /dev/null
+++ b/devel/libreadline-java/Makefile
@@ -0,0 +1,60 @@
+# New ports collection makefile for: libreadline-java
+# Date created: 20 September 2007
+# Whom: Martin Kammerhofer <mkamm@gmx.net>
+#
+# $FreeBSD$
+#
+
+PORTNAME= libreadline-java
+PORTVERSION= 0.8.0
+DISTVERSIONSUFFIX= -src
+CATEGORIES= devel java
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= java-readline
+
+MAINTAINER= mkamm@gmx.net
+COMMENT= JNI wrapper around GNU Readline / libedit / libgetline
+
+BUILD_DEPENDS= ${LOCALBASE}/include/editline/readline.h:${PORTSDIR}/devel/libedit
+RUN_DEPENDS= ${LOCALBASE}/include/editline/readline.h:${PORTSDIR}/devel/libedit
+
+ALL_TARGET= # empty
+MAKE_ENV= JAVA_HOME="${JAVA_HOME}" JAVA="${JAVA}" JAVAC="${JAVAC}" \
+ JAVAH="${JAVAH}" JAR_="${JAR}"
+PKGMESSAGE= ${WRKDIR}/pkg-message
+PLIST_FILES= %%JAVAJARDIR%%/libreadline-java.jar lib/libJavaReadline.so \
+ lib/libJavaEditline.so lib/libJavaGetline.so
+.if !defined(NOPORTDOCS)
+PLIST_FILES+= %%DOCSDIR%%/README.1st %%DOCSDIR%%/README \
+ %%DOCSDIR%%/jython.sh %%DOCSDIR%%/JReadlineCompleter.py \
+ @dirrm\ %%DOCSDIR%%
+.endif
+USE_GMAKE= yes
+USE_JAVA= yes
+USE_LDCONFIG= yes
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
+
+do-install:
+ ${INSTALL_DATA} ${WRKSRC}/libreadline-java.jar ${JAVAJARDIR}
+ ${INSTALL_DATA} ${WRKSRC}/libJavaReadline.so ${PREFIX}/lib
+ ${INSTALL_DATA} ${WRKSRC}/libJavaEditline.so ${PREFIX}/lib
+ ${INSTALL_DATA} ${WRKSRC}/libJavaGetline.so ${PREFIX}/lib
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README.1st ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+ ${INSTALL_DATA} ${FILESDIR}/jython.sh ${DOCSDIR}
+ ${INSTALL_DATA} ${FILESDIR}/JReadlineCompleter.py ${DOCSDIR}
+.endif
+
+post-install:
+ @${SED} -e 's|%%JAVAJARDIR%%|${JAVAJARDIR}|g' -- \
+ ${.CURDIR}/pkg-message >${PKGMESSAGE}
+ @${CAT} ${PKGMESSAGE}
+
+.if !defined(BATCH)
+test:
+ cd ${WRKSRC} && ${MAKE_ENV} ${GMAKE} test # Now type something!
+.endif
+
+.include <bsd.port.mk>
diff --git a/devel/libreadline-java/distinfo b/devel/libreadline-java/distinfo
new file mode 100644
index 000000000000..4054e9536731
--- /dev/null
+++ b/devel/libreadline-java/distinfo
@@ -0,0 +1,3 @@
+MD5 (libreadline-java-0.8.0-src.tar.gz) = 501720ddded45eaedf429b7cc356107c
+SHA256 (libreadline-java-0.8.0-src.tar.gz) = cdcfd9910bfe2dca4cd08b2462ec05efee7395e9b9c3efcb51e85fa70548c890
+SIZE (libreadline-java-0.8.0-src.tar.gz) = 77122
diff --git a/devel/libreadline-java/files/JReadlineCompleter.py b/devel/libreadline-java/files/JReadlineCompleter.py
new file mode 100644
index 000000000000..9eccfe314aaf
--- /dev/null
+++ b/devel/libreadline-java/files/JReadlineCompleter.py
@@ -0,0 +1,194 @@
+# (X)Emacs: -*- mode: python; coding: latin-1; -*-
+# TAB-Completion for Jython with org.python.util.ReadlineConsole.
+# JReadlineCompleter.py,v 1.1 2007/09/28 08:18:43 martin Exp
+#
+# This is rlcompleter.py from CPython 2.5.1 adapted for Jython
+# and libreadline-java.
+
+"""TAB-completion for Jython + libreadline-java
+
+The completer completes keywords, built-ins and globals in a
+selectable namespace (which defaults to __main__); when completing
+NAME.NAME..., it evaluates (!) the expression up to the last dot and
+completes its attributes.
+
+It's very cool to do "import sys" type "sys.", hit the
+completion key (twice), and see the list of names defined by the
+sys module!
+
+Notes:
+
+- Exceptions raised by the completer function are *ignored* (and
+generally cause the completion to fail). This is a feature -- since
+readline sets the tty device in raw (or cbreak) mode, printing a
+traceback wouldn't work well without some complicated hoopla to save,
+reset and restore the tty state.
+
+- The evaluation of the NAME.NAME... form may cause arbitrary
+application defined code to be executed if an object with a
+__getattr__ hook is found. Since it is the responsibility of the
+application (or the user) to enable this feature, I consider this an
+acceptable risk. More complicated expressions (e.g. function calls or
+indexing operations) are *not* evaluated.
+
+This module is a hacked version of the CPython 2.5 module rlcompleter.
+It is under the PSF (Python Software Foundation) license.
+"""
+
+# CAUTION: Licensing issues may arise when changing the backend
+# library to "GnuReadline" which is under the GPL.
+DEFAULTLIB = "Editline"
+
+# Try to give useful hints for any import failure here:
+import sys
+if not sys.platform.startswith("java"):
+ raise EnvironmentError("Module %s is to be used with Jython only!" %
+ (__name__ == "__main__" and __file__ or __name__))
+if sys.registry["python.console"] != "org.python.util.ReadlineConsole":
+ raise EnvironmentError("You need to set python.console=org.python.util.ReadlineConsole in your ~/.jython file!")
+try:
+ from org.gnu.readline import Readline, ReadlineLibrary, ReadlineCompleter
+except ImportError:
+ raise ImportError("Make sure you have libreadline-java.jar in classpath!")
+import __builtin__
+import atexit
+import keyword
+import os
+import re
+
+__all__ = ["PyCompleter", "JvCompleter"]
+
+Readline.load(
+ getattr(ReadlineLibrary, sys.registry["python.console.readlinelib"], "")
+ or DEFAULTLIB)
+histfile = os.path.join(os.environ["HOME"], ".jyhist")
+try:
+ Readline.readHistoryFile(histfile)
+except:
+ print >> sys.stderr, histfile, "not available!"
+atexit.register(Readline.writeHistoryFile, histfile)
+
+class PyCompleter:
+ def __init__(self, namespace = None):
+ """Create a new completer for the command line.
+
+ PyCompleter([namespace]) -> completer instance.
+
+ If unspecified, the default namespace where completions are performed
+ is __main__ (technically, __main__.__dict__). Namespaces should be
+ given as dictionaries.
+ """
+
+ if namespace and not isinstance(namespace, dict):
+ raise TypeError,'namespace must be a dictionary'
+
+ # Don't bind to namespace quite yet, but flag whether the user wants a
+ # specific namespace or to use __main__.__dict__. This will allow us
+ # to bind to __main__.__dict__ at completion time, not now.
+ if namespace is None:
+ self.use_main_ns = 1
+ else:
+ self.use_main_ns = 0
+ self.namespace = namespace
+
+ def complete(self, text, state):
+ """Return the next possible completion for 'text'.
+
+ This is called successively with state == 0, 1, 2, ... until it
+ returns None. The completion should begin with 'text'.
+
+ """
+ if self.use_main_ns:
+ import __main__
+ self.namespace = __main__.__dict__
+
+ try:
+ if state == 0:
+ if "." in text:
+ self.matches = self.attr_matches(text)
+ else:
+ self.matches = self.global_matches(text)
+ return self.matches[state]
+ except (AttributeError, IndexError, NameError):
+ return None
+
+ def global_matches(self, text):
+ """Compute matches when text is a simple name.
+
+ Return a list of all keywords, built-in functions and names currently
+ defined in self.namespace that match.
+
+ """
+ matches = []
+ n = len(text)
+ for list in [keyword.kwlist,
+ __builtin__.__dict__,
+ self.namespace]:
+ for word in list:
+ if word[:n] == text and word != "__builtins__":
+ matches.append(word)
+ return matches
+
+ def attr_matches(self, text):
+ """Compute matches when text contains a dot.
+
+ Assuming the text is of the form NAME.NAME....[NAME], and is
+ evaluatable in self.namespace, it will be evaluated and its attributes
+ (as revealed by dir()) are used as possible completions. (For class
+ instances, class members are also considered.)
+
+ WARNING: this can still invoke arbitrary C code, if an object
+ with a __getattr__ hook is evaluated.
+
+ """
+ m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
+ if not m:
+ return
+ expr, attr = m.group(1, 3)
+ object = eval(expr, self.namespace)
+ words = dir(object)
+ if hasattr(object,'__class__'):
+ words.append('__class__')
+ words = words + get_class_members(object.__class__)
+ matches = []
+ n = len(attr)
+ for word in words:
+ if word[:n] == attr and word != "__builtins__":
+ matches.append("%s.%s" % (expr, word))
+ return matches
+
+def get_class_members(klass):
+ ret = dir(klass)
+ if hasattr(klass,'__bases__'):
+ for base in klass.__bases__:
+ ret = ret + get_class_members(base)
+ return ret
+
+
+class JvCompleter(ReadlineCompleter):
+ """Create a new completer for the command line.
+
+ JvCompleter([completion_callable]) -> completer instance.
+
+ JvCompleter instances should be used as the completion mechanism
+ of Readline via the setCompleter() call.
+ """
+ def __init__(self, realcompleter):
+ self.realcompleter = realcompleter
+ def completer(self, text, state):
+ return self.realcompleter(text, state)
+
+
+pycompleter = PyCompleter()
+jvcompleter = JvCompleter(pycompleter.complete)
+Readline.setCompleter(jvcompleter)
+Readline.parseAndBind("tab: complete")
+try:
+ Readline.setCompletionAppendCharacter('\0')
+except:
+ pass # Method only available from my java-readline patch.
+
+if __name__ == '__main__':
+ print "Sorry, no unit tests yet!"
+
+#EOF#
diff --git a/devel/libreadline-java/files/jython.sh b/devel/libreadline-java/files/jython.sh
new file mode 100644
index 000000000000..631dffbfc651
--- /dev/null
+++ b/devel/libreadline-java/files/jython.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Invoke Jython.
+# jython.sh,v 1.5 2007/09/28 09:13:55 martin Exp
+#
+# The path names below are for Jython 2.2 on FreeBSD.
+#
+
+CP="/usr/local/lib/jython22/jython.jar"
+defs=
+wrapper=
+
+case "${JYTHON_CONSOLE:-Editline}" in
+ *[Ee]dit[Ll]ine)
+ CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
+ defs="-Dpython.console=org.python.util.ReadlineConsole"
+ defs="$defs -Dpython.console.readlinelib=Editline"
+ ;;
+ *[Gg]et[Ll]ine)
+ CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
+ defs="-Dpython.console=org.python.util.ReadlineConsole"
+ defs="$defs -Dpython.console.readlinelib=Getline"
+ ;;
+ *[Jj][Ll]ine)
+ CP="$CP:/usr/local/share/java/classes/jline.jar"
+ defs="-Dpython.console="
+ wrapper=jline.ConsoleRunner
+ ;;
+ *[Rr]ead[Ll]ine)
+ CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
+ defs="-Dpython.console=org.python.util.ReadlineConsole"
+ defs="$defs -Dpython.console.readlinelib=GnuReadline"
+ ;;
+ *)
+ echo >&2 "$0: illegal value of JYTHON_CONSOLE: $JYTHON_CONSOLE"
+ exit 64
+ ;;
+esac
+
+
+if [ -n "$CLASSPATH" ]; then
+ CP="$CP:$CLASSPATH"
+fi
+
+exec java -Dpython.home="/usr/local/lib/jython22" \
+ -Dpython.cachedir="${HOME}/.jython-cachedir" \
+ -classpath "$CP" $wrapper org.python.util.jython $defs "$@"
+
+#EOF#
diff --git a/devel/libreadline-java/files/patch-Makefile b/devel/libreadline-java/files/patch-Makefile
new file mode 100644
index 000000000000..58681a1760d9
--- /dev/null
+++ b/devel/libreadline-java/files/patch-Makefile
@@ -0,0 +1,59 @@
+--- Makefile 2003-01-07 11:14:35.000000000 +0100
++++ /tmp/libreadline-java-0.8.0/Makefile 2007-09-22 22:11:13.000000000 +0200
+@@ -54,11 +54,11 @@
+ JAVALIBDIR= $(PREFIX)/share/java
+
+ # libraries to build
+-T_LIBS = JavaReadline
++T_LIBS = JavaReadline JavaEditline JavaGetline
+
+ # Operating system dependent
+ JAVAINCLUDE = $(JAVA_HOME)/include
+-JAVANATINC = $(JAVA_HOME)/include/linux
++JAVANATINC = $(JAVA_HOME)/include/freebsd
+
+ ifeq (MSC,$(WIN32))
+ JAVA_HOME := c:/j2sdk1.4.0
+@@ -69,9 +69,14 @@
+ endif
+
+ ## normal javac
+-JAVAC = javac
++JAVAC ?= javac
+ JC_FLAGS =
+
++## other tools
++JAVA ?= java
++JAVAH ?= javah
++JAR_ ?= jar
++
+ ## with jikes
+ #JAVAC = jikes
+ #JC_FLAGS = -O +E
+@@ -86,7 +91,7 @@
+ world : jar build-native
+
+ jar: build-java
+- cd $(BUILDDIR) ; jar -cvmf ../$(MF_STUB) ../$(JAR) *
++ cd $(BUILDDIR) ; $(JAR_) -cvmf ../$(MF_STUB) ../$(JAR) *
+
+ $(JAR):
+ cd $(BUILDDIR) ; jar -cvmf ../$(MF_STUB) ../$(JAR) *
+@@ -96,7 +101,7 @@
+
+ build-native:
+ cd src; $(MAKE) T_LIBS="$(T_LIBS)" JAVAINCLUDE="$(JAVAINCLUDE)" \
+- JAVANATINC="$(JAVANATINC)" native
++ JAVANATINC="$(JAVANATINC)" JAVAH="$(JAVAH)" native
+
+ apidoc: $(APIDIR)
+ javadoc -sourcepath src -d $(APIDIR) -windowtitle $(WTITLE) \
+@@ -140,7 +145,7 @@
+ rpm --define _topdir$(RPM_BASE) -ba $(RPM_BASE)/SPECS/libreadline-java.spec
+
+ test: $(JAR) build-native
+- LD_LIBRARY_PATH=. java -jar $(JAR) src/test/tinputrc $(ARGS)
++ LD_LIBRARY_PATH=. $(JAVA) -jar $(JAR) src/test/tinputrc $(ARGS)
+
+ clean:
+ $(MAKE) -C src/native clean
diff --git a/devel/libreadline-java/files/patch-src-Makefile b/devel/libreadline-java/files/patch-src-Makefile
new file mode 100644
index 000000000000..4ef1a90363ee
--- /dev/null
+++ b/devel/libreadline-java/files/patch-src-Makefile
@@ -0,0 +1,11 @@
+--- src/Makefile 2003-01-07 11:14:35.000000000 +0100
++++ /tmp/libreadline-java-0.8.0/src/Makefile 2007-09-21 07:45:38.000000000 +0200
+@@ -10,7 +10,7 @@
+
+ native: always
+ cd native ; $(MAKE) T_LIBS="$(T_LIBS)" JAVAINCLUDE="$(JAVAINCLUDE)" \
+- JAVANATINC="$(JAVANATINC)" all
++ JAVANATINC="$(JAVANATINC)" JAVAH="$(JAVAH)" all
+
+ $(BUILD):
+ mkdir $@
diff --git a/devel/libreadline-java/files/patch-src-native-Makefile b/devel/libreadline-java/files/patch-src-native-Makefile
new file mode 100644
index 000000000000..e12715ec5f38
--- /dev/null
+++ b/devel/libreadline-java/files/patch-src-native-Makefile
@@ -0,0 +1,55 @@
+--- src/native/Makefile.orig 2003-01-07 07:14:35.000000000 -0300
++++ src/native/Makefile 2008-02-16 18:53:37.000000000 -0300
+@@ -44,10 +44,12 @@
+ LIB_EXT := dll
+ CFLAGS=-DWIN32=$(WIN32) -D__IBMC__
+ else
+-INCLUDES = -I $(JAVAINCLUDE) -I $(JAVANATINC)
+-LIBPATH = -L/usr/lib/termcap
++INCLUDES = -I $(JAVAINCLUDE) -I $(JAVANATINC) -I $(LOCALBASE)/include
++ifeq (JavaEditline,$(TG))
++LIBPATH = -L$(LOCALBASE)/lib -rpath $(LOCALBASE)/lib
++endif
+ JavaReadline_LIBS = -lreadline -ltermcap -lhistory
+-JavaEditline_LIBS = -ledit -ltermcap
++JavaEditline_LIBS = $(LOCALBASE)/lib/libedit.so -ltermcap
+ ifeq (cygwin,$(WIN32))
+ JavaGetline_LIBS = -lcygwin
+ endif
+@@ -55,8 +57,9 @@
+ OBJ_EXT := o
+ LIB_PRE := lib
+ LIB_EXT := so
+-CFLAGS=-fPIC -DPOSIX
++CFLAGS+=-fPIC -DPOSIX
+ endif
++JAVAH ?= javah
+
+
+ OBJECTS := org_gnu_readline_Readline.$(OBJ_EXT)
+@@ -69,13 +72,13 @@
+ lib: $(ROOTDIR)/$(LIB_PRE)$(TG).$(LIB_EXT)
+
+ JavaReadline:
+- make TG=$@ lib
++ $(MAKE) TG=$@ lib
+
+ JavaEditline:
+- make TG=$@ lib
++ $(MAKE) TG=$@ lib
+
+ JavaGetline:
+- make TG=$@ lib
++ $(MAKE) TG=$@ lib
+
+ $(ROOTDIR)/$(LIB_PRE)$(TG).$(LIB_EXT): $(OBJECTS)
+ ifeq (MSC,$(WIN32))
+@@ -110,7 +113,7 @@
+ -c org_gnu_readline_Readline.c
+
+ org_gnu_readline_Readline.h: $(BUILDDIR)/org/gnu/readline/Readline.class
+- javah -classpath $(BUILDDIR) -jni org.gnu.readline.Readline
++ $(JAVAH) -classpath $(BUILDDIR) -jni org.gnu.readline.Readline
+ touch org_gnu_readline_Readline.h
+
+ clean:
diff --git a/devel/libreadline-java/files/patch-src-native-getline.c b/devel/libreadline-java/files/patch-src-native-getline.c
new file mode 100644
index 000000000000..8494fc2d3fda
--- /dev/null
+++ b/devel/libreadline-java/files/patch-src-native-getline.c
@@ -0,0 +1,10 @@
+--- src/native/getline.c 2003-01-07 11:14:35.000000000 +0100
++++ /tmp/libreadline-java-0.8.0/src/native/getline.c 2007-09-22 22:20:06.000000000 +0200
+@@ -136,7 +136,6 @@
+ #ifndef __convexc__
+ extern int read();
+ extern int kill();
+-extern int ioctl();
+ #endif /* not __convexc__ */
+ #ifdef POSIX /* use POSIX interface */
+ #include <termios.h>
diff --git a/devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c b/devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c
new file mode 100644
index 000000000000..6389e13dbd5c
--- /dev/null
+++ b/devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c
@@ -0,0 +1,24 @@
+--- src/native/org_gnu_readline_Readline.c.orig 2003-01-07 11:14:35.000000000 +0100
++++ src/native/org_gnu_readline_Readline.c 2007-09-27 09:21:14.000000000 +0200
+@@ -560,6 +560,21 @@
+ #endif
+
+ /* -------------------------------------------------------------------------- */
++/* Sets/gets rl_completion_append_character */
++/* -------------------------------------------------------------------------- */
++
++#ifndef JavaGetline
++JNIEXPORT jchar JNICALL
++Java_org_gnu_readline_Readline_setCompletionAppendCharacterImpl
++(JNIEnv * env, jclass class, jchar appendCharacter) {
++ int previous_setting = rl_completion_append_character;
++
++ rl_completion_append_character = (int)appendCharacter;
++ return (jchar)previous_setting;
++}
++#endif
++
++/* -------------------------------------------------------------------------- */
+ /* Convert utf8-string to ucs1-string . */
+ /* -------------------------------------------------------------------------- */
+
diff --git a/devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java b/devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java
new file mode 100644
index 000000000000..601aa2a65a2f
--- /dev/null
+++ b/devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java
@@ -0,0 +1,52 @@
+--- src/org/gnu/readline/Readline.java.orig 2003-01-07 11:14:35.000000000 +0100
++++ src/org/gnu/readline/Readline.java 2007-09-27 08:52:01.000000000 +0200
+@@ -568,6 +568,31 @@
+ /////////////////////////////////////////////////////////////////////////////
+
+ /**
++ Query and set the completion append character. You might need
++ this in a {@link ReadlineCompleter} implementation. The argument
++ appendCharacter should be in the ASCII range.
++
++ <p>Supporting implementations:
++ <ul>
++ <li>GNU-Readline</li>
++ <li>Editline</li>
++ </ul>
++ </p>
++
++ */
++
++ public static char setCompletionAppendCharacter(char appendCharacter) {
++ if (iLib == ReadlineLibrary.GnuReadline || iLib == ReadlineLibrary.Editline)
++ return setCompletionAppendCharacterImpl(appendCharacter);
++ else if (iThrowException)
++ throw new UnsupportedOperationException();
++ else
++ return '\uFFFF';
++ }
++
++ /////////////////////////////////////////////////////////////////////////////
++
++ /**
+ Query the current line buffer. This returns the current content of
+ the internal line buffer. You might need this in a
+ {@link ReadlineCompleter} implementation to access the full text
+@@ -838,4 +863,17 @@
+ private native static void
+ setWordBreakCharactersImpl(String wordBreakCharacters)
+ throws UnsupportedEncodingException;
++
++ /////////////////////////////////////////////////////////////////////////////
++
++ /**
++ Native implementation of setCompletionAppendCharacter()
++
++ @see
++ org.gnu.readline.Readline#setCompletionAppendCharacter(char appendCharacter)
++ */
++
++ private native static char
++ setCompletionAppendCharacterImpl(char appendCharacter);
++
+ }
diff --git a/devel/libreadline-java/pkg-descr b/devel/libreadline-java/pkg-descr
new file mode 100644
index 000000000000..167ec05049b3
--- /dev/null
+++ b/devel/libreadline-java/pkg-descr
@@ -0,0 +1,17 @@
+Java-Readline is a port of GNU Readline for Java. Or, to be more
+precise, it is a JNI-wrapper to Readline. It is distributed under the
+LGPL.
+
+You must call Readline.load(ReadlineLibrary lib); before using any
+other methods. If you omit the call to the load()-method, the pure
+Java fallback solution is used. Possible values for lib are:
+
+ReadlineLibrary.PureJava
+ReadlineLibrary.GnuReadline
+ReadlineLibrary.Editline
+ReadlineLibrary.Getline
+
+Note that all programs using GnuReadline will fall under the GPL,
+since Gnu-Readline is GPL software!
+
+WWW: http://sourceforge.net/projects/java-readline/
diff --git a/devel/libreadline-java/pkg-message b/devel/libreadline-java/pkg-message
new file mode 100644
index 000000000000..4c02f1058fae
--- /dev/null
+++ b/devel/libreadline-java/pkg-message
@@ -0,0 +1,5 @@
+--------------------------------------------------
+To use readline-java add the file
+%%JAVAJARDIR%%/libreadline-java.jar
+to your classpath!
+--------------------------------------------------