summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolkmar W. Pogatzki <gentoo@pogatzki.net>2024-04-28 16:36:57 +0200
committerMiroslav Šulc <fordfrog@gentoo.org>2024-06-14 12:15:21 +0200
commitf6f13004ed155a6972c463e947473753f2813334 (patch)
tree5b2be504f3b6ec8e2ac41d3e95fb4470d0d7e452 /app-text/trang
parentdev-java/saxon: code cleanup, rewrite with java-pkg-simple (diff)
downloadgentoo-f6f13004ed155a6972c463e947473753f2813334.tar.gz
gentoo-f6f13004ed155a6972c463e947473753f2813334.tar.bz2
gentoo-f6f13004ed155a6972c463e947473753f2813334.zip
app-text/trang: add 20220510
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Closes: https://github.com/gentoo/gentoo/pull/36770/commits/7e395ee5716caca28baa6722329d4f2edf872dd0 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'app-text/trang')
-rw-r--r--app-text/trang/Manifest1
-rw-r--r--app-text/trang/files/trang-20220510-CompactSyntaxTokenManager.patch130
-rw-r--r--app-text/trang/trang-20220510.ebuild115
3 files changed, 246 insertions, 0 deletions
diff --git a/app-text/trang/Manifest b/app-text/trang/Manifest
index 9ddc07d64b74..9de27a29ac13 100644
--- a/app-text/trang/Manifest
+++ b/app-text/trang/Manifest
@@ -1 +1,2 @@
DIST trang-20181222.tar.gz 14847113 BLAKE2B 335722853b2d373fd9a6e9d4478b8248ca49d0559d5a8f60566f5550e60d5a004f26338897617acc617f84d1d55546afb9c51da64b7634514fa2ec508fa7a47a SHA512 fa412a5beeff07a620c4aa5723cf5b73bdb6b1cda561e3bf7764a609110f538da5313bcc79aca4d7742f71b3b071d3537681845d17ece46bc871c0964f4e251d
+DIST trang-20220510.tar.gz 14317698 BLAKE2B b7337e9555094989955e33f711db9981521c31a3708dd6a862f36cecae0496d8c86fdf09b2d60b8646d8e35e214f57ba7bcd49773fe002eef26ed6b81b4101c1 SHA512 51c44817b396ec45bb82987e0aee8e8d2e5f3f6a1e2f967bae717a31b1bd49c5fc7015466104b19ac62de6ee0270c018dcf19b467763ad1aaa92800bd4edd7a0
diff --git a/app-text/trang/files/trang-20220510-CompactSyntaxTokenManager.patch b/app-text/trang/files/trang-20220510-CompactSyntaxTokenManager.patch
new file mode 100644
index 000000000000..ef633528e5fc
--- /dev/null
+++ b/app-text/trang/files/trang-20220510-CompactSyntaxTokenManager.patch
@@ -0,0 +1,130 @@
+# mod/rng-parse/mod.xml lines 16-17 - 's/java.io.IOException/EOFException/'
+
+--- a/gensrc/main/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java
++++ b/gensrc/main/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java
+@@ -219,7 +219,7 @@ private int jjMoveStringLiteralDfa0_0(){
+ }
+ private int jjMoveStringLiteralDfa1_0(long active0){
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+@@ -264,7 +264,7 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+@@ -307,7 +307,7 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+@@ -342,7 +342,7 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+@@ -387,7 +387,7 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+@@ -426,7 +426,7 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+@@ -465,7 +465,7 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+@@ -492,7 +492,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(7, active0);
+ return 8;
+ }
+@@ -517,7 +517,7 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0){
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0);
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) {
++ catch(EOFException e) {
+ jjStopStringLiteralDfa_0(8, active0);
+ return 9;
+ }
+@@ -537,7 +537,7 @@ private int jjStartNfaWithStates_0(int pos, int kind, int state)
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) { return pos + 1; }
++ catch(EOFException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+ }
+ static final long[] jjbitVec0 = {
+@@ -1131,7 +1131,7 @@ private int jjMoveNfa_0(int startState, int curPos)
+ if ((i = jjnewStateCnt) == (startsAt = 43 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) { return curPos; }
++ catch(EOFException e) { return curPos; }
+ }
+ }
+ private int jjMoveStringLiteralDfa0_1()
+@@ -1294,7 +1294,7 @@ private int jjMoveNfa_1(int startState, int curPos)
+ if ((i = jjnewStateCnt) == (startsAt = 10 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) { return curPos; }
++ catch(EOFException e) { return curPos; }
+ }
+ }
+ private int jjMoveStringLiteralDfa0_2()
+@@ -1427,7 +1427,7 @@ private int jjMoveNfa_2(int startState, int curPos)
+ if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+- catch(java.io.IOException e) { return curPos; }
++ catch(EOFException e) { return curPos; }
+ }
+ }
+
+@@ -1686,7 +1686,7 @@ public Token getNextToken()
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+- catch (java.io.IOException e1) {
++ catch (EOFException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
diff --git a/app-text/trang/trang-20220510.ebuild b/app-text/trang/trang-20220510.ebuild
new file mode 100644
index 000000000000..9b9eb123a90c
--- /dev/null
+++ b/app-text/trang/trang-20220510.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc test"
+JAVA_TESTING_FRAMEWORKS="testng"
+
+inherit java-pkg-2 java-pkg-simple prefix
+
+DESCRIPTION="Multi-format schema converter based on RELAX NG"
+HOMEPAGE="http://thaiopensource.com/relaxng/trang.html"
+SRC_URI="https://github.com/relaxng/jing-trang/archive/V${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/jing-${P}"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+BDEPEND="
+ app-i18n/unicode-data
+ dev-java/saxon:9
+"
+CP_DEPEND="
+ dev-java/xerces:2
+ dev-java/xml-commons-resolver:0
+"
+RDEPEND="${CP_DEPEND}
+ >=virtual/jre-1.8:*"
+JAVACC_SLOT="7.0.13"
+DEPEND="${CP_DEPEND}
+ dev-java/javacc:${JAVACC_SLOT}
+ dev-java/testng:0
+ >=virtual/jdk-1.8:*"
+
+JAVA_TEST_RESOURCE_DIRS="src/test"
+JAVA_TEST_SRC_DIR="src/test"
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ java-pkg_clean
+
+ eprefixify mod/regex/mod.xml # Do we still need this?
+
+ # separating some sources which are needed only for compilation
+ mkdir helper || die
+ cp -r mod/{catalog,datatype,jaxp,pattern,resolver,rng-parse}/src helper || die
+
+ # most of the mods are not needed for the final trang.jar
+ rm -r mod/{dtdinst,nvdl,picl,rng-jarv,rng-validate,schematron,validate,xerces} || die
+ rm -r mod/{jaxp,pattern,rng-jaxp} || die
+
+ # move all remainig stuff to "src/main" resp. "src/test"
+ mkdir -p resources src meta/META-INF/services || die
+ mv {mod/,}regex-gen || die # but not this one which is needed in two JAVA_SRC_DIRs
+ cp -r mod/*/src/{main,test} src || die
+
+ # populate META-INF/services
+ echo com.thaiopensource.datatype.xsd.DatatypeLibraryFactoryImpl \
+ > meta/META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory || die
+ echo com.thaiopensource.datatype.xsd.regex.xerces2.RegexEngineImpl \
+ > meta/META-INF/services/com.thaiopensource.datatype.xsd.regex.RegexEngine || die
+
+ echo "version=${PV}" \
+ > src/main/com/thaiopensource/relaxng/translate/resources/Version.properties || die
+
+ # java-pkg-simple expects resources in JAVA_RESOURCE_DIRS
+ find src -type f ! -name '*.java' ! -name 'CompactSyntax.jj' ! -name 'package.html' \
+ | xargs cp --parent -t resources || die
+
+ # code generation according to mod/rng-parse/mod.xml
+ local OUT_DIR="gensrc/main/com/thaiopensource/relaxng/parse/compact"
+ mkdir -p "${OUT_DIR}"
+ "javacc-${JAVACC_SLOT}" -GRAMMAR_ENCODING=UTF-8 \
+ -JDK_VERSION=1.8 \
+ -OUTPUT_DIRECTORY="${OUT_DIR}" \
+ helper/src/main/com/thaiopensource/relaxng/parse/compact/CompactSyntax.jj \
+ || die "Code generation with java.jj failed"
+ rm "${OUT_DIR}/JavaCharStream.java" || die
+
+ # mod/rng-parse/mod.xml lines 16-17 - 's/java.io.IOException/EOFException/'
+ eapply "${FILESDIR}/trang-20220510-CompactSyntaxTokenManager.patch" || die
+}
+
+src_compile() {
+ einfo "Compiling some classes needed for code generation"
+ ejavac -d util \
+ $(find regex-gen/src/main mod/util/src/main -name "*.java") || die
+
+ einfo "Code generation"
+ "$(java-config -J)" -cp "util" \
+ com.thaiopensource.datatype.xsd.regex.java.gen.NamingExceptionsGen \
+ "com.thaiopensource.datatype.xsd.regex.java.NamingExceptions" \
+ "src/main" || die
+
+ "$(java-config -J)" -cp "util" \
+ com.thaiopensource.datatype.xsd.regex.java.gen.CategoriesGen \
+ "com.thaiopensource.datatype.xsd.regex.java.Categories" \
+ "src/main" \
+ "/usr/share/unicode-data/UnicodeData.txt" || die
+
+ einfo "Compiling classes which are not needed for the final trang.jar"
+ ejavac -d helper \
+ -cp "util:$(java-pkg_getjars --build-only xml-commons-resolver)" \
+ $(find gensrc/main helper/src/main -name "*.java") || die
+
+ einfo "Compiling trang.jar"
+ JAVA_CLASSPATH_EXTRA="testng"
+ JAVA_GENTOO_CLASSPATH_EXTRA="util:helper"
+ JAVA_JAR_FILENAME="trang.jar"
+ JAVA_MAIN_CLASS="com.thaiopensource.relaxng.translate.Driver"
+ JAVA_RESOURCE_DIRS=( meta resources/src/main )
+ JAVA_SRC_DIR=( {gen,}src/main )
+ java-pkg-simple_src_compile
+}