diff --git a/textproc/languagetool/Makefile b/textproc/languagetool/Makefile index dbdecb489d0b..71ace40a0f99 100644 --- a/textproc/languagetool/Makefile +++ b/textproc/languagetool/Makefile @@ -1,54 +1,55 @@ PORTNAME= languagetool DISTVERSION= 6.6 +PORTREVISION= 1 CATEGORIES= textproc java MASTER_SITES= https://languagetool.org/download/ DISTNAME= LanguageTool-${DISTVERSION} MAINTAINER= jrm@FreeBSD.org COMMENT= Style and grammar checker for more than 25 languages WWW= https://languagetool.org \ https://github.com/languagetool-org/languagetool LICENSE= LGPL21+ LICENSE_FILE= ${WRKSRC}/COPYING.txt RUN_DEPENDS= javavm:java/javavmwrapper USES= cpe java:run zip JAVA_VERSION= 17+ USE_RC_SUBR= languagetool DATADIR= ${JAVASHAREDIR}/${PORTNAME} NO_ARCH= yes NO_BUILD= yes SUB_FILES= languagetool-cli languagetool-gui pkg-message USERS= languagetool GROUPS= languagetool PORTDOCS= CHANGES.md CHANGES.txt README.md OPTIONS_DEFINE= DOCS post-extract: @${RM} ${WRKSRC}/testrules.bat ${WRKSRC}/testrules.sh do-install: @${MKDIR} ${STAGEDIR}${DATADIR} (cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR} \ "! -name CHANGES.md ! -name CHANGES.txt ! -name README.md") ${INSTALL_SCRIPT} ${WRKDIR}/languagetool-cli \ ${STAGEDIR}${PREFIX}/bin/languagetool ${INSTALL_SCRIPT} ${WRKDIR}/languagetool-gui \ ${STAGEDIR}${PREFIX}/bin/languagetool-gui @${MKDIR} ${STAGEDIR}${ETCDIR} ${INSTALL_DATA} ${FILESDIR}/server.properties.sample \ ${STAGEDIR}${ETCDIR}/server.properties.sample do-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} (cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}) .include diff --git a/textproc/languagetool/files/languagetool.in b/textproc/languagetool/files/languagetool.in index 8c4741e98283..7fa94a3a1362 100644 --- a/textproc/languagetool/files/languagetool.in +++ b/textproc/languagetool/files/languagetool.in @@ -1,60 +1,61 @@ #!/bin/sh # PROVIDE: languagetool # REQUIRE: LOGIN NETWORKING # KEYWORD: shutdown # # Add these lines to /etc/rc.conf.local or /etc/rc.conf to enable # languagetool: # # languagetool_enable (bool): Set to "NO" by default. # Set it to "YES" to enable languagetool. # languagetool_user (str): User to run the server as. # Default: "languagetool" # languagetool_port (int): HTTP port to listen on. # Default: 8081 # languagetool_config (str): Path to server.properties. # Default: %%ETCDIR%%/server.properties # languagetool_java_version (str): Java VM version constraint passed to # javavm(1). # Default: "%%JAVA_VERSION%%" # languagetool_java_opts (str): JVM options (example: to heap limit). # Default: "-Xmx512m" # languagetool_args (str): Extra HTTPServer arguments, e.g. # "--allow-origin '*'" or "--public". # Default: empty . /etc/rc.subr name=languagetool rcvar=languagetool_enable load_rc_config $name : ${languagetool_enable:="NO"} : ${languagetool_user:="languagetool"} : ${languagetool_port:="8081"} : ${languagetool_config:="%%ETCDIR%%/server.properties"} : ${languagetool_java_version:="%%JAVA_VERSION%%"} : ${languagetool_java_opts:="-Xmx512m"} : ${languagetool_args:=""} piddir=/var/run/${name} pidfile=${piddir}/${name}.pid command=/usr/sbin/daemon -command_args="-S -T ${name} -P ${pidfile} \ +command_args="-S -T ${name} -R 10 -P ${pidfile} \ /usr/bin/env JAVA_VERSION=${languagetool_java_version} \ - %%LOCALBASE%%/bin/java ${languagetool_java_opts} \ + %%LOCALBASE%%/bin/java -XX:+ExitOnOutOfMemoryError \ + ${languagetool_java_opts} \ -cp %%DATADIR%%/languagetool-server.jar \ org.languagetool.server.HTTPServer \ --config ${languagetool_config} \ --port ${languagetool_port} ${languagetool_args}" start_precmd=languagetool_prestart languagetool_prestart() { install -d -o ${languagetool_user} ${piddir} } run_rc_command "$1" diff --git a/textproc/languagetool/files/server.properties.sample b/textproc/languagetool/files/server.properties.sample index 397642aa7254..a69511cf2fd1 100644 --- a/textproc/languagetool/files/server.properties.sample +++ b/textproc/languagetool/files/server.properties.sample @@ -1,15 +1,20 @@ # Configuration for the LanguageTool HTTP server. # See https://dev.languagetool.org/http-server for all options. # Uncomment to enable n-gram data for improved confused-word detection. # Download per-language data sets from # https://languagetool.org/download/ngram-data/ and unpack them into # per-language subdirectories (e.g. ngrams/en, ngrams/it). #languageModel=/var/db/languagetool/ngrams # Uncomment to enable fastText-based automatic language detection. #fasttextModel=/path/to/lid.176.bin #fasttextBinary=/usr/local/bin/fasttext # Limit maximum text length per check request (characters). -#maxTextLength=50000 +maxTextLength=50000 + +# Abort a single check that runs longer than this (milliseconds). +# Guards against pathological requests (e.g. very long sentences) +# exhausting the Java heap. +maxCheckTimeMillis=60000