commit: 22867050d3d8983492fe3e37227ec2a840ec5fe8 Author: Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net> AuthorDate: Mon Dec 30 06:50:29 2024 +0000 Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org> CommitDate: Tue Jan 7 10:10:23 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22867050
app-text/trang: add 20241231 it also creates javac's output directory in order to allow lowering the dependency to >=virtual/jdk-1.8:* Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net> Closes: https://github.com/gentoo/gentoo/pull/39825/commits/83a77861f3d63d6433ce6bc28c134e038ac87701 Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org> app-text/trang/Manifest | 1 + app-text/trang/trang-20241231.ebuild | 124 +++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) diff --git a/app-text/trang/Manifest b/app-text/trang/Manifest index 8a48fdadff4c..4c93e5b233ad 100644 --- a/app-text/trang/Manifest +++ b/app-text/trang/Manifest @@ -1 +1,2 @@ DIST trang-20220510.tar.gz 14317698 BLAKE2B b7337e9555094989955e33f711db9981521c31a3708dd6a862f36cecae0496d8c86fdf09b2d60b8646d8e35e214f57ba7bcd49773fe002eef26ed6b81b4101c1 SHA512 51c44817b396ec45bb82987e0aee8e8d2e5f3f6a1e2f967bae717a31b1bd49c5fc7015466104b19ac62de6ee0270c018dcf19b467763ad1aaa92800bd4edd7a0 +DIST trang-20241231.tar.gz 14317272 BLAKE2B 420bd2148f90bbda03d91c0e748fb785e89286e5b9b565cc31e81306e5c832a6b683b51bd132b7f16e7cbce798eaf1b13d23a4b035ef77a1b13bb25366866523 SHA512 6e0d9c69b5fe663b2e014e0a30b6d92018a349b982698631f346a1fe7657e8a8c5b785df1c1188f4caf61acfccbaf9fc2f6478f2dfb425ef6ef510a865bdaaa3 diff --git a/app-text/trang/trang-20241231.ebuild b/app-text/trang/trang-20241231.ebuild new file mode 100644 index 000000000000..343ab8e4a119 --- /dev/null +++ b/app-text/trang/trang-20241231.ebuild @@ -0,0 +1,124 @@ +# Copyright 1999-2025 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" + +BDEPEND=" + app-i18n/unicode-data + dev-java/saxon:9 +" + +CP_DEPEND=" + dev-java/xerces:2 + dev-java/xml-commons-resolver:0 +" + +JAVACC_SLOT="7.0.13" + +DEPEND=" + ${CP_DEPEND} + dev-java/javacc:${JAVACC_SLOT} + dev-java/testng:0 + >=virtual/jdk-1.8:* +" + +RDEPEND=" + ${CP_DEPEND} + >=virtual/jre-1.8:* +" + +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_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? + + # javac of old openjdk:8 does not create its output directory, see bug #934306 + # separating some sources which are needed only for compilation + mkdir helper util || 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-pkg-simple_src_compile +}
