git: e6902c57141c - main - textproc/apache-xmlbeans: adding XMLBeans, Java classes for XML

From: Thierry Thomas <thierry_at_FreeBSD.org>
Date: Sun, 01 May 2022 20:11:41 UTC
The branch main has been updated by thierry:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e6902c57141c20bcaf5cd6e796157b9d32b559fd

commit e6902c57141c20bcaf5cd6e796157b9d32b559fd
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2022-04-30 14:37:41 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2022-05-01 20:09:07 +0000

    textproc/apache-xmlbeans: adding XMLBeans, Java classes for XML
    
    Note: this is release 3.1.0. The latest release is 5.0.3, but it is not
    yet compatible with XLConnect (math/R-cran-XLConnect).
---
 textproc/Makefile                                 |  1 +
 textproc/apache-xmlbeans/Makefile                 | 61 +++++++++++++++++++++++
 textproc/apache-xmlbeans/distinfo                 |  5 ++
 textproc/apache-xmlbeans/files/patch-bin___setlib | 20 ++++++++
 textproc/apache-xmlbeans/files/pkg-message.in     |  3 ++
 textproc/apache-xmlbeans/pkg-descr                | 18 +++++++
 textproc/apache-xmlbeans/pkg-plist                | 21 ++++++++
 7 files changed, 129 insertions(+)

diff --git a/textproc/Makefile b/textproc/Makefile
index 46f2cee9c2f3..6a4079bc4fcf 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -51,6 +51,7 @@
     SUBDIR += apache-commons-digester
     SUBDIR += apache-poi
     SUBDIR += apache-solr
+    SUBDIR += apache-xmlbeans
     SUBDIR += apertium
     SUBDIR += apertium-eng
     SUBDIR += artha
diff --git a/textproc/apache-xmlbeans/Makefile b/textproc/apache-xmlbeans/Makefile
new file mode 100644
index 000000000000..3ed59bd64152
--- /dev/null
+++ b/textproc/apache-xmlbeans/Makefile
@@ -0,0 +1,61 @@
+# Created by: Thierry Thomas <thierry@pompo.net>
+
+PORTNAME=	xmlbeans
+PORTVERSION=	3.1.0 # Do not upgrade without checking compatibility with math/R-cran-XLConnect
+CATEGORIES=	textproc java
+MASTER_SITES=	https://archive.apache.org/dist/poi/xmlbeans/release/bin/:xb	\
+		https://repo1.maven.org/maven2/org/apache/poi/ooxml-schemas/${SCHEMAS_VER}/:sch
+PKGNAMEPREFIX=	apache-
+DISTFILES=	${PORTNAME}-bin-${PORTVERSION}${EXTRACT_SUFX}:xb	\
+		ooxml-schemas-${SCHEMAS_VER}.jar:sch
+EXTRACT_ONLY=	${PORTNAME}-bin-${PORTVERSION}${EXTRACT_SUFX}
+
+MAINTAINER=	thierry@FreeBSD.org
+COMMENT=	Java classes for XML
+
+LICENSE=	APACHE20
+
+USES=		tar:tgz
+USE_JAVA=	yes
+JAVA_VERSION=	8+
+SCHEMAS_VER=	1.4
+
+WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
+NO_BUILD=	yes
+NO_ARCH=	yes
+SUB_FILES=	pkg-message
+
+OTHERDOCS=	LICENSE.txt NOTICE.txt README.txt
+PORTDOCS=	*
+PORTEXAMPLES=	*
+
+OPTIONS_DEFINE=	DOCS EXAMPLES
+
+pre-configure:
+	${REINPLACE_CMD} -e 's|%%JAVAJARDIR%%|${JAVAJARDIR}|'	\
+		${WRKSRC}/bin/_setlib
+	${SED} -i '' -e 's|xbean.jar|xmlbeans.jar|;s|:$$XMLBEANS_LIB/xmlbeans-qname.jar||;s|:$XMLBEANS_LIB/jsr173_1.0_api.jar||;s|:$XMLBEANS_LIB/resolver.jar||'	\
+		${WRKSRC}/bin/*
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${JAVAJARDIR}	\
+		${STAGEDIR}${PREFIX}/bin	\
+		${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${WRKSRC}/lib/${PORTNAME}-${PORTVERSION}.jar	\
+		${STAGEDIR}${JAVAJARDIR}/${PORTNAME}.jar
+	${INSTALL_DATA} ${DISTDIR}/ooxml-schemas-${SCHEMAS_VER}.jar	\
+		${STAGEDIR}${JAVAJARDIR}/ooxml-schemas.jar
+	${FIND} ${WRKSRC}/bin ! -name "*.cmd" -type f -exec	\
+		${INSTALL_SCRIPT} {} ${STAGEDIR}${PREFIX}/bin \;
+	(cd ${WRKSRC} && ${COPYTREE_SHARE} schemas ${STAGEDIR}${DATADIR})
+
+do-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	(cd ${WRKSRC} && ${INSTALL_DATA} ${OTHERDOCS} ${STAGEDIR}${DOCSDIR})
+	(cd ${WRKSRC}/docs && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
+
+do-install-EXAMPLES-on:
+	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	(cd ${WRKSRC}/samples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
+
+.include <bsd.port.mk>
diff --git a/textproc/apache-xmlbeans/distinfo b/textproc/apache-xmlbeans/distinfo
new file mode 100644
index 000000000000..14a1b2753d70
--- /dev/null
+++ b/textproc/apache-xmlbeans/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1651435086
+SHA256 (xmlbeans-bin-3.1.0.tgz) = abc4883f38b6147090c5995a31ec71b5c8d8207e03665acadc076c1fc21c8b32
+SIZE (xmlbeans-bin-3.1.0.tgz) = 6509656
+SHA256 (ooxml-schemas-1.4.jar) = f8256738040d66ccb677814873674c1212464e00af491e9df490fc45decbd932
+SIZE (ooxml-schemas-1.4.jar) = 16356588
diff --git a/textproc/apache-xmlbeans/files/patch-bin___setlib b/textproc/apache-xmlbeans/files/patch-bin___setlib
new file mode 100644
index 000000000000..b7c8022ec9c4
--- /dev/null
+++ b/textproc/apache-xmlbeans/files/patch-bin___setlib
@@ -0,0 +1,20 @@
+--- bin/_setlib.orig	2019-02-25 00:31:32 UTC
++++ bin/_setlib
+@@ -19,14 +19,10 @@ if [ -z "$XMLBEANS_HOME" ]; then
+     XMLBEANS_HOME=`dirname $0`/..
+ fi
+ 
+-XMLBEANS_LIB=
+-if [ -f "$XMLBEANS_HOME"/build/lib/xbean.jar ]; then
+-    XMLBEANS_LIB=$XMLBEANS_HOME/build/lib
++if [ -f %%JAVAJARDIR%%/xmlbeans.jar ]; then
++    XMLBEANS_LIB=%%JAVAJARDIR%%
+ fi
+-if [ -f "$XMLBEANS_HOME"/lib/xbean.jar ]; then
+-    XMLBEANS_LIB=$XMLBEANS_HOME/lib
+-fi
+ 
+ if [ -z "$XMLBEANS_LIB" ]; then
+-    echo "ERROR: Could not find xbean.jar, try set XMLBEANS_LIB to the directory containing xbean.jar"
++    echo "ERROR: Could not find xmlbeans.jar, try set XMLBEANS_LIB to the directory containing xmlbeans.jar"
+ fi
diff --git a/textproc/apache-xmlbeans/files/pkg-message.in b/textproc/apache-xmlbeans/files/pkg-message.in
new file mode 100644
index 000000000000..94f69fcf774e
--- /dev/null
+++ b/textproc/apache-xmlbeans/files/pkg-message.in
@@ -0,0 +1,3 @@
+To use XMLBeans you might have to define the following variables:
+export XMLBEANS_HOME=%%JAVAJARDIR%%
+export CLASSPATH=%%JAVAJARDIR%%/xmlbeans.jar:$CLASSPATH
diff --git a/textproc/apache-xmlbeans/pkg-descr b/textproc/apache-xmlbeans/pkg-descr
new file mode 100644
index 000000000000..8f1118bd871b
--- /dev/null
+++ b/textproc/apache-xmlbeans/pkg-descr
@@ -0,0 +1,18 @@
+XMLBeans is a technology for accessing XML by binding it to Java types. XMLBeans
+provides several ways to get at the XML, including:
+
+- Through XML schema that has been compiled to generate Java types that
+  represent schema types. In this way, you can access instances of the schema
+  through JavaBeans-style accessors after the fashion of "getFoo" and "setFoo".
+  The XMLBeans API also allows you to reflect into the XML schema itself through
+  an XML Schema Object model.
+
+- A cursor model through which you can traverse the full XML infoset.
+
+- Support for XML DOM.
+
+This port contains also the OOXML Schemas, XmlBeans generated from the Ecma
+supplied xsds.
+See https://poi.apache.org/help/faq.html#faq-N10025 .
+
+WWW: https://xmlbeans.apache.org/
diff --git a/textproc/apache-xmlbeans/pkg-plist b/textproc/apache-xmlbeans/pkg-plist
new file mode 100644
index 000000000000..7ec1b3fb0b1b
--- /dev/null
+++ b/textproc/apache-xmlbeans/pkg-plist
@@ -0,0 +1,21 @@
+bin/_setlib
+bin/dumpxsb
+bin/inst2xsd
+bin/scomp
+bin/sdownload
+bin/sfactor
+bin/svalidate
+bin/validate
+bin/xpretty
+bin/xsd2inst
+bin/xsdtree
+bin/xstc
+%%JAVAJARDIR%%/ooxml-schemas.jar
+%%JAVAJARDIR%%/xmlbeans.jar
+%%DATADIR%%/schemas/easypo.xsd
+%%DATADIR%%/schemas/easypo.xsdconfig
+%%DATADIR%%/schemas/nameworld.xsd
+%%DATADIR%%/schemas/numerals.xsd
+%%DATADIR%%/schemas/s4s/XML.xsd
+%%DATADIR%%/schemas/s4s/XMLSchema.xsd
+%%PORTEXAMPLES%%@dir %%EXAMPLESDIR%%/XQueryXPath/src/org/apache/xmlbeans/samples/xquery/employees/impl