summaryrefslogtreecommitdiff
path: root/security/vuxml
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>2004-02-25 17:03:18 +0000
committerJacques Vidrine <nectar@FreeBSD.org>2004-02-25 17:03:18 +0000
commitd67cad80c6e328bdadcebec1dc8b27ce55cf1e50 (patch)
treee5eb2580350c70fc119266f1bf7c691b0347198f /security/vuxml
parentAdd entries for: hsftp, DarwinStreamingServer, libxml2, lbreakout2, (diff)
Allow validation without the need to specify which processor to use.
Now just invoke `make validate', and a shell script will be run and try to use xmllint or nsgmls. Requested by: des
Notes
Notes: svn path=/head/; revision=102106
Diffstat (limited to 'security/vuxml')
-rw-r--r--security/vuxml/Makefile19
-rw-r--r--security/vuxml/files/validate.sh54
2 files changed, 55 insertions, 18 deletions
diff --git a/security/vuxml/Makefile b/security/vuxml/Makefile
index 79a2fd30fab1..b9d60c8629f1 100644
--- a/security/vuxml/Makefile
+++ b/security/vuxml/Makefile
@@ -76,23 +76,6 @@ do-install:
${SGMLCAT_ADD}
validate:
-.if defined(WITH_XMLLINT)
- ${SETENV} SGML_CATALOG_FILES="${CATALOG_PORTS_XML}" \
- xmllint --catalogs --valid --noout "${VUXML_FILE}"
-.elif defined(WITH_NSGMLS)
- ${SETENV} SP_CHARSET_FIXED=YES SP_ENCODING=XML \
- nsgmls -wxml -s "${VUXML_FILE}"
-.elif defined(WITH_RXP)
- ${SETENV} XML_CATALOG_FILES="${CATALOG_PORTS_XML}" \
- rxp -EVNxs "${VUXML_FILE}"
-.else
- @${ECHO} "Define one of the following to validate:"
- @${ECHO} " WITH_XMLLINT Use xmllint from libxml2"
- @${ECHO} " WITH_NSGMLS Use nsgmls from jade"
-# RXP 1.4 works great, but the ports system is stuck at 1.2.5
-# @${ECHO} " WITH_RXP Use rxp"
- @${ECHO}
- @${FALSE}
-.endif
+ @${SH} ${FILESDIR}/validate.sh "${VUXML_FILE}"
.include <bsd.port.mk>
diff --git a/security/vuxml/files/validate.sh b/security/vuxml/files/validate.sh
new file mode 100644
index 000000000000..60a1a6378c89
--- /dev/null
+++ b/security/vuxml/files/validate.sh
@@ -0,0 +1,54 @@
+#! /bin/sh
+vuxml_file="$1"
+if [ -z "${vuxml_file}" ]; then
+ exec >&2
+ echo "Usage: validate.sh /path/to/vuxml/document"
+ exit 1
+fi
+
+xml_catalog="${LOCALBASE:-/usr/local}/share/xml/catalog.ports"
+sgml_catalog="${LOCALBASE:-/usr/local}/share/sgml/catalog.ports"
+
+SGML_CATALOG_FILES="${sgml_catalog}"; export SGML_CATALOG_FILES
+XML_CATALOG_FILES="${xml_catalog}"; export XML_CATALOG_FILES
+SP_CHARSET_FIXED="YES"; export SP_CHARSET_FIXED
+SP_ENCODING="XML"; export SP_ENCODING
+
+
+X=`/usr/bin/which xmllint nsgmls`
+if [ -z "$X" ]; then
+ exec >&2
+ echo "Could not find \`xmllint' nor \`nsgmls'."
+ echo "Install ports/textproc/libxml2 for \`xmllint', or"
+ echo "ports/textproc/jade for \`nsgmls'."
+ exit 1
+fi
+
+validate() {
+ echo ">>> Validating..."
+ echo "$@"
+ if $@; then
+ echo ">>> Successful."
+ return 0
+ else
+ echo ">>> FAILED."
+ return 1
+ fi
+}
+
+for x in ${X}; do
+ case ${x} in
+ *xmllint)
+ validate ${x} --catalogs --valid --noout "${vuxml_file}"
+ exit $?
+ ;;
+ *nsgmls)
+ validate ${x} -wxml -s "${vuxml_file}"
+ exit $?
+ ;;
+ *)
+ echo "Oops, I don't know how to use \`${x}'."
+ exit 1
+ ;;
+ esac
+done