Skip to content

Commit

Permalink
addpkg(main/languagetool-libs),addpkg(x11/languagetool-gui): language…
Browse files Browse the repository at this point in the history
…tool 6.5

Closes #21086
  • Loading branch information
mbekkomo committed Nov 13, 2024
1 parent 9558b2a commit 8f78243
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/languagetool-libs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TERMUX_PKG_HOMEPAGE=https://languagetool.org
TERMUX_PKG_DESCRIPTION="Libraries needed for languagetool"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=6.5
TERMUX_PKG_SRCURL=https://languagetool.org/download/LanguageTool-${TERMUX_PKG_VERSION}.zip
TERMUX_PKG_SHA256=27f3ae5a29efbc8267a5a266908dfec205d16d312af8516e0b5bcec871edea0b
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true

termux_step_make_install() {
mkdir -p "${TERMUX_PREFIX}/share/java/languagetool/libs"
mv ./languagetool-{commandline,server}.jar "${TERMUX_PREFIX}/share/java/languagetool"
mv ./libs/*.jar "${TERMUX_PREFIX}/share/java/languagetool/libs"

for pair in \
"languagetool org.languagetool.commandline.Main" \
"languagetool-http-server org.languagetool.server.HTTPServer" \
"languagetool-https-server org.languagetool.server.HTTPSServer"; do
read -r package bin <<<"$pair"
sed "s|@MAIN@|$package|g" "${TERMUX_PKG_BUILDER_DIR}/languagetool.sh" > "${TERMUX_PREFIX}/bin/$bin"
chmod 700 "${TERMUX_PREFIX}/bin/$bin"
done
}
3 changes: 3 additions & 0 deletions packages/languagetool-libs/languagetool-server.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="bin/languagetool-http-server bin/languagetool-https-server share/java/languagetool/languagetool-server.jar"
TERMUX_SUBPKG_DEPENDS="openjdk-17"
TERMUX_SUBPKG_DESCRIPTION="Server for languagetool"
10 changes: 10 additions & 0 deletions packages/languagetool-libs/languagetool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/data/data/com.termux/files/usr/bin/env bash

main="@MAIN@"

mods="${TERMUX_PREFIX}/share/languagetool"
for jar in "${TERMUX_PREFIX}/share/java/langugetool"/*.jar; do
mods=$mods:$jar
done

exec "${JAVA_HOME}/bin/java" -cp "$mods" "$main" "$@"
3 changes: 3 additions & 0 deletions packages/languagetool-libs/languagetool.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="bin/languagetool share/java/languagetool/languagetool-commandline.jar"
TERMUX_SUBPKGS_DEPENDS="openjdk-17"
TERMUX_SUBPKG_DESCRIPTION="Style and Grammar Checker for 25+ Languages"
25 changes: 25 additions & 0 deletions x11-packages/languagetool-gui/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
TERMUX_PKG_HOMEPAGE=https://languagetool.org
TERMUX_PKG_DESCRIPTION="GUI version of languagetool"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="$(
source "${TERMUX_SCRIPTDIR}/packages/languagetool-libs/build.sh"
echo "${TERMUX_PKG_VERSION}"
)"
TERMUX_PKG_SRCURL="$(
source "${TERMUX_SCRIPTDIR}/packages/languagetool-libs/build.sh"
echo "${TERMUX_PKG_SRCURL}"
)"
TERMUX_PKG_SHA256="$(
source "${TERMUX_SCRIPTDIR}/packages/languagetool-libs/build.sh"
echo "${TERMUX_PKG_SHA256}"
)"
TERMUX_PKG_DEPENDS="openjdk-17, openjdk-17-x, languagetool-libs"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true

termux_step_make_install() {
mv ./languagetool.jar "${TERMUX_PREFIX}/share/java/languagetool"
sed "s|@MAIN@|org.languagetool.gui.Main|g" "${TERMUX_SCRIPTDIR}/packages/languagetool-libs/languagetool.sh" > "${TERMUX_PREFIX}/bin/languagetool-gui"
chmod 700 "${TERMUX_PREFIX}/bin/languagetool-gui"
}

0 comments on commit 8f78243

Please sign in to comment.