freebsd-ports/lang/jython/Makefile
Stefan Eßer b7f05445c0 Add WWW entries to port Makefiles
It has been common practice to have one or more URLs at the end of the
ports' pkg-descr files, one per line and prefixed with "WWW:". These
URLs should point at a project website or other relevant resources.

Access to these URLs required processing of the pkg-descr files, and
they have often become stale over time. If more than one such URL was
present in a pkg-descr file, only the first one was tarnsfered into
the port INDEX, but for many ports only the last line did contain the
port specific URL to further information.

There have been several proposals to make a project URL available as
a macro in the ports' Makefiles, over time.

This commit implements such a proposal and moves one of the WWW: entries
of each pkg-descr file into the respective port's Makefile. A heuristic
attempts to identify the most relevant URL in case there is more than
one WWW: entry in some pkg-descr file. URLs that are not moved into the
Makefile are prefixed with "See also:" instead of "WWW:" in the pkg-descr
files in order to preserve them.

There are 1256 ports that had no WWW: entries in pkg-descr files. These
ports will not be touched in this commit.

The portlint port has been adjusted to expect a WWW entry in each port
Makefile, and to flag any remaining "WWW:" lines in pkg-descr files as
deprecated.

Approved by:		portmgr (tcberner)
2022-09-07 23:10:59 +02:00

68 lines
2.5 KiB
Makefile

PORTNAME= jython
PORTVERSION= 2.7.0
DISTVERSIONPREFIX= installer-
CATEGORIES= lang python java
MASTER_SITES= https://repo1.maven.org/maven2/org/python/jython-installer/${PORTVERSION}/ \
http://repo1.maven.org/maven2/org/python/jython-installer/${PORTVERSION}/
EXTRACT_SUFX= .jar
MAINTAINER= python@FreeBSD.org
COMMENT= Implementation of Python Interpreter in Pure Java
WWW= https://www.jython.org/
LICENSE= PSFL APACHE20
LICENSE_COMB= multi
LICENSE_FILE_PSFL= ${WRKDIR}/LICENSE.txt
LICENSE_FILE_APACHE20= ${WRKDIR}/LICENSE_Apache.txt
BUILD_DEPENDS= bash:shells/bash
RUN_DEPENDS= bash:shells/bash
# Extract only license files
EXTRACT_AFTER_ARGS= --no-same-owner --no-same-permissions \
LICENSE.txt LICENSE_Apache.txt
USES= cpe
CPE_VENDOR= python
USE_JAVA= yes
NO_BUILD= yes
NO_ARCH= yes
REINPLACE_ARGS= -i ""
INST_TARGET?= lib/jython
JYTHON_PREFIX= ${PREFIX}/${INST_TARGET}
PLIST_SUB+= JYTHON_DIR=${INST_TARGET}
# Do tons of backflips so that the cachedir is put into the user's home
# directory (it's irritating to not be able to cache stuff if you're
# not root). Furthermore, don't leave a cachedir around from either a
# port install or a package install, but do cache the *.py files in Lib
# during a port install or a package install.
do-install:
# Null the PATH so installer won't find the python2.7 executable
# and won't build a python launcher instead of bash one
cd ${DISTDIR} && PATH="" ${JAVA} \
-jar ${DISTNAME}${EXTRACT_SUFX} \
--silent -d ${STAGEDIR}${JYTHON_PREFIX} -t standard -e ensurepip
# Place python.cachedir in user's home directory by default
${REINPLACE_CMD} \
's|\"$$JAVA_OPTS|\"-Dpython.cachedir=$${HOME}/.jython-cachedir $$JAVA_OPTS|g' \
${STAGEDIR}${JYTHON_PREFIX}/bin/jython
# Teach bin/jython script to solve symlinks the right way
${REINPLACE_CMD} \
's,if expr "$$link" : '\''/'\'' > /dev/null; then,if expr "$$link" : '\''^/'\'' > /dev/null; then,' \
${STAGEDIR}${JYTHON_PREFIX}/bin/jython
# Delete python.cachedir entry from Jython's registry file
${REINPLACE_CMD} 's/^python\.cachedir/#&/g' \
${STAGEDIR}${JYTHON_PREFIX}/registry
# Compile all the *.py files to *$py.class files, override HOME and user.home to place
# .jython-cachedir and .jline-jython.history in WRKDIR
-HOME=${WRKDIR} JAVA_OPTS="-Duser.home=${WRKDIR}" \
${STAGEDIR}${JYTHON_PREFIX}/bin/jython \
-m compileall -d ${JYTHON_PREFIX} ${STAGEDIR}${JYTHON_PREFIX}
# Install symbolic links for convenience.
${LN} -sf ${JYTHON_PREFIX}/bin/jython ${STAGEDIR}${PREFIX}/bin/jython
${LN} -sf ${JYTHON_PREFIX}/registry ${STAGEDIR}${PREFIX}/etc/jython.reg
.include <bsd.port.mk>