1 # Created by: Hye-Shik Chang <perky@python.or.kr>
6 CATEGORIES= lang python java
7 MASTER_SITES= https://repo1.maven.org/maven2/org/python/jython-installer/${PORTVERSION}/ \
8 http://repo1.maven.org/maven2/org/python/jython-installer/${PORTVERSION}/
9 DISTNAME= jython-installer-${PORTVERSION}
12 MAINTAINER= python@FreeBSD.org
13 COMMENT= Implementation of Python Interpreter in Pure Java
15 LICENSE= PSFL APACHE20
17 LICENSE_FILE_PSFL= ${WRKDIR}/LICENSE.txt
18 LICENSE_FILE_APACHE20= ${WRKDIR}/LICENSE_Apache.txt
20 BUILD_DEPENDS= bash:shells/bash
21 RUN_DEPENDS= bash:shells/bash
23 # Extract only license files
24 EXTRACT_AFTER_ARGS= --no-same-owner --no-same-permissions \
25 LICENSE.txt LICENSE_Apache.txt
32 INST_TARGET?= lib/jython
33 JYTHON_PREFIX= ${PREFIX}/${INST_TARGET}
34 PLIST_SUB+= JYTHON_DIR=${INST_TARGET}
36 # Do tons of backflips so that the cachedir is put into the user's home
37 # directory (it's irritating to not be able to cache stuff if you're
38 # not root). Furthermore, don't leave a cachedir around from either a
39 # port install or a package install, but do cache the *.py files in Lib
40 # during a port install or a package install.
42 # Null the PATH so installer won't find the python2.7 executable
43 # and won't build a python launcher instead of bash one
44 cd ${DISTDIR} && PATH="" ${JAVA} \
45 -jar ${DISTNAME}${EXTRACT_SUFX} \
46 --silent -d ${STAGEDIR}${JYTHON_PREFIX} -t standard -e ensurepip
47 # Place python.cachedir in user's home directory by default
49 's|\"$$JAVA_OPTS|\"-Dpython.cachedir=$${HOME}/.jython-cachedir $$JAVA_OPTS|g' \
50 ${STAGEDIR}${JYTHON_PREFIX}/bin/jython
51 # Teach bin/jython script to solve symlinks the right way
53 's,if expr "$$link" : '\''/'\'' > /dev/null; then,if expr "$$link" : '\''^/'\'' > /dev/null; then,' \
54 ${STAGEDIR}${JYTHON_PREFIX}/bin/jython
55 # Delete python.cachedir entry from Jython's registry file
56 ${REINPLACE_CMD} 's/^python\.cachedir/#&/g' \
57 ${STAGEDIR}${JYTHON_PREFIX}/registry
58 # Compile all the *.py files to *$py.class files, override HOME and user.home to place
59 # .jython-cachedir and .jline-jython.history in WRKDIR
60 -HOME=${WRKDIR} JAVA_OPTS="-Duser.home=${WRKDIR}" \
61 ${STAGEDIR}${JYTHON_PREFIX}/bin/jython \
62 -m compileall -d ${JYTHON_PREFIX} ${STAGEDIR}${JYTHON_PREFIX}
64 # Install symbolic links for convenience.
65 ${LN} -sf ${JYTHON_PREFIX}/bin/jython ${STAGEDIR}${PREFIX}/bin/jython
66 ${LN} -sf ${JYTHON_PREFIX}/registry ${STAGEDIR}${PREFIX}/etc/jython.reg
68 .include <bsd.port.mk>