- Fix build with clang

- Stage support
- Do not hardcode /usr/local

PR:		ports/184751
Submitted by:	Martin Kammerhofer (maintainer)
This commit is contained in:
Antoine Brodin 2013-12-16 18:01:50 +00:00
parent 3025f9978b
commit e107c3d264
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=336652
6 changed files with 66 additions and 39 deletions

View file

@ -4,7 +4,7 @@
PORTNAME= libreadline-java
PORTVERSION= 0.8.0
DISTVERSIONSUFFIX= -src
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel java
MASTER_SITES= SF/java-readline/java-readline/${PORTVERSION}
@ -17,38 +17,32 @@ 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
SUB_FILES= pkg-message jython.sh
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
PORTDOCS= README.1st README jython.sh JReadlineCompleter.py
USES= gmake
USE_JAVA= yes
USE_LDCONFIG= yes
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
MAKE_JOBS_UNSAFE= yes
NO_STAGE= yes
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
OPTIONS_DEFINE= DOCS
post-install:
@${SED} -e 's|%%JAVAJARDIR%%|${JAVAJARDIR}|g' -- \
${.CURDIR}/pkg-message >${PKGMESSAGE}
@${CAT} ${PKGMESSAGE}
.include <bsd.port.options.mk>
do-install:
${INSTALL_DATA} ${WRKSRC}/libreadline-java.jar ${STAGEDIR}${JAVAJARDIR}
${INSTALL_DATA} ${WRKSRC}/libJavaReadline.so ${STAGEDIR}${PREFIX}/lib
${INSTALL_DATA} ${WRKSRC}/libJavaEditline.so ${STAGEDIR}${PREFIX}/lib
${INSTALL_DATA} ${WRKSRC}/libJavaGetline.so ${STAGEDIR}${PREFIX}/lib
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README.1st ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKDIR}/jython.sh ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${FILESDIR}/JReadlineCompleter.py ${STAGEDIR}${DOCSDIR}
.endif
.if !defined(BATCH)
test:

View file

@ -4,6 +4,10 @@
#
# This is rlcompleter.py from CPython 2.5.1 adapted for Jython
# and libreadline-java.
#
# NOTE: Jython >= 2.5 already includes rlcompleter,
# see http://www.jython.org/docs/library/rlcompleter.html
# This is useful for older Jython versions only!
"""TAB-completion for Jython + libreadline-java
@ -105,9 +109,13 @@ class PyCompleter:
try:
if state == 0:
if "." in text:
self.matches = self.attr_matches(text)
matches = self.attr_matches(text)
else:
self.matches = self.global_matches(text)
matches = self.global_matches(text)
# remove duplicates and sort
matches = list(set(matches))
matches.sort()
self.matches = matches
return self.matches[state]
except (AttributeError, IndexError, NameError):
return None

View file

@ -2,31 +2,39 @@
# 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.
# The path names below are for Jython 2.5.3 on FreeBSD.
#
# NOTE: Jython >= 2.5 already includes rlcompleter,
# see http://www.jython.org/docs/library/rlcompleter.html
# This is useful for older Jython versions only!
CP="/usr/local/lib/jython22/jython.jar"
if [ -d "%%LOCALBASE%%/lib/jython22" ] ; then
_ver=22
else
_ver=
fi
CP="%%LOCALBASE%%/lib/jython${_ver}/jython.jar"
defs=
wrapper=
case "${JYTHON_CONSOLE:-Editline}" in
*[Ee]dit[Ll]ine)
CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
CP="$CP:%%LOCALBASE%%/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"
CP="$CP:%%LOCALBASE%%/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"
CP="$CP:%%LOCALBASE%%/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"
CP="$CP:%%LOCALBASE%%/share/java/classes/libreadline-java.jar"
defs="-Dpython.console=org.python.util.ReadlineConsole"
defs="$defs -Dpython.console.readlinelib=GnuReadline"
;;
@ -41,7 +49,7 @@ if [ -n "$CLASSPATH" ]; then
CP="$CP:$CLASSPATH"
fi
exec java -Dpython.home="/usr/local/lib/jython22" \
exec java -Dpython.home="%%LOCALBASE%%/lib/jython${_ver}" \
-Dpython.cachedir="${HOME}/.jython-cachedir" \
-classpath "$CP" $wrapper org.python.util.jython $defs "$@"

View file

@ -1,6 +1,13 @@
--- 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 @@
--- src/native/Makefile.orig 2003-01-07 11:14:35.000000000 +0100
+++ src/native/Makefile 2013-12-13 08:29:23.000000000 +0100
@@ -38,25 +38,28 @@
INCLUDES = -I "c:/Programme/DevStudio/VC/include" \
-I $(JAVAINCLUDE) -I $(JAVANATINC)
LIB = "c:/Programme/DevStudio/VC/lib"
-CC = cl
+#CC = gcc
OBJ_EXT := obj
LIB_PRE :=
LIB_EXT := dll
CFLAGS=-DWIN32=$(WIN32) -D__IBMC__
else
@ -16,7 +23,8 @@
ifeq (cygwin,$(WIN32))
JavaGetline_LIBS = -lcygwin
endif
@@ -55,8 +57,9 @@
-CC = gcc
+CC = cc
OBJ_EXT := o
LIB_PRE := lib
LIB_EXT := so

View file

@ -1,5 +1,14 @@
--- 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
+++ src/native/org_gnu_readline_Readline.c 2013-12-12 20:40:36.000000000 +0100
@@ -430,7 +430,7 @@
jtext = (*jniEnv)->NewStringUTF(jniEnv,text);
if (jniMethodId == 0) {
- return;
+ return 0;
}
completion = (*jniEnv)->CallObjectMethod(jniEnv, jniObject,
@@ -560,6 +560,21 @@
#endif