]> git.draconx.ca Git - gentoo-draconx.git/commitdiff
app-text/mathml2: Rewrite of mathml-xml-dtd.
authorNick Bowler <nbowler@draconx.ca>
Wed, 23 Jun 2021 00:20:18 +0000 (20:20 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 23 Jun 2021 00:20:18 +0000 (20:20 -0400)
Reimplement everything as part of an update to EAPI=7.  The new package
name seems more consistent, e.g., this naming complements app-text/xhtml11
in the gentoo repo.

Punt all the XHTML-related bits on installation.  I imagine this is
all obsolete anyway (the XHTML+MathML+SVG DTDs seem to have their own
packages separate from the MathML one), was never registered with the
system catalogs and the docbook mathml stuff doesn't appear to need
it anyway.

app-text/docbook-mathml-dtd/Manifest
app-text/docbook-mathml-dtd/docbook-mathml-dtd-1.1_rc1-r2.ebuild [moved from app-text/docbook-mathml-dtd/docbook-mathml-dtd-1.1_rc1-r1.ebuild with 91% similarity]
app-text/mathml-xml-dtd/Manifest [deleted file]
app-text/mathml-xml-dtd/mathml-xml-dtd-2.0.ebuild [deleted file]
app-text/mathml2/Manifest [new file with mode: 0644]
app-text/mathml2/mathml2-20031021.ebuild [new file with mode: 0644]

index 2e28ae567f37e0636fac9d2103ca845dcc33b20e..e31fad073f859e7cf5e8d9897083aa04ffaf6459 100644 (file)
@@ -1,2 +1,2 @@
 DIST dbmathml-1.1_rc1.dtd 3525 BLAKE2B 7075ea787e279381253fdd4ce686346f90ead5be10a5803e2e166053f3cdea86ea4473ceb6ad880cf8e896fa5d06cc800268b9ecbb7cd7f87d99104ff7de4c6c SHA512 031ad81e0fd873d2ed0fb78a074cc2de93ea7c937d85aac6cb2dc3023e3ba494a9a20f485b5355ce9060aea9adae192c9259b59139ac71273ca3fb858a240704
-EBUILD docbook-mathml-dtd-1.1_rc1-r1.ebuild 1970 BLAKE2B 9a5d912a063a77b07bf504e650f933bdb950d29cde291b063da03bead4ac8b6e05b325bb3692fd41c179f6b95c9833fc72a800ef3e216126aeb8b2b5619e531b SHA512 478fd1cd145857c8e361267ad406e7faca69c83297933466b5b458e75a8e8b3629e3723c101a62f028d982ea5d3eab0e6943d0a9a860bc813898bf6eac7a091d
+EBUILD docbook-mathml-dtd-1.1_rc1-r2.ebuild 1968 BLAKE2B d1baec26a63575049ef51a0befdd7b639d43c5f284b5cc9ba0e22c3b61d6ba33aff7621b1cde3afece7acac0d902b289a30f518a3c7e41888c51c460b488a888 SHA512 f43d48dd0b8c5d6d3142236dca8ab6098d354da959813e26dd73c7d60ea492c6f02559d4553019d162798ec3c4ffc0a60f3eef552a967d76d12d743b54b59774
similarity index 91%
rename from app-text/docbook-mathml-dtd/docbook-mathml-dtd-1.1_rc1-r1.ebuild
rename to app-text/docbook-mathml-dtd/docbook-mathml-dtd-1.1_rc1-r2.ebuild
index 37188a64825a3462d5c5f3a2bf692100eb4e9072..d251b3da66ef6197dbea7605c26858a8cf4c68aa 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2020 Nick Bowler
+# Copyright © 2020-2021 Nick Bowler
 # License GPLv3+: GNU General Public License version 3 or any later version.
 # This is free software: you are free to change and redistribute it.
 # There is NO WARRANTY, to the extent permitted by law.
@@ -23,7 +23,7 @@ S=$WORKDIR
 
 RDEPEND="dev-libs/libxml2
        app-text/docbook-xml-dtd:4.3
-       app-text/mathml-xml-dtd"
+       app-text/mathml2"
 
 src_unpack () {
        cp "$DISTDIR/$A" "$S" || die
@@ -42,12 +42,12 @@ src_install () {
 
        insinto /etc/sgml
        newins - mathml-docbook-$PV.cat <<-EOF
-               CATALOG "${EPREFIX#/}$insdir/catalog"
+               CATALOG "${EPREFIX%/}$insdir/catalog"
        EOF
 }
 
 update_catalog () {
-       local insdir="file://${EPREFIX#/}/usr/share/sgml/docbook/${P#docbook-}"
+       local insdir="file://${EPREFIX%/}/usr/share/sgml/docbook/${P#docbook-}"
        local xmlcatalog="${BROOT%/}/usr/bin/xmlcatalog"
 
        local dtdpublic="-//OASIS//DTD DocBook MathML Module V$DTDVER//EN"
diff --git a/app-text/mathml-xml-dtd/Manifest b/app-text/mathml-xml-dtd/Manifest
deleted file mode 100644 (file)
index e840a84..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-DIST mathml2.tgz 121304 SHA256 8b3e796574d63131fd3c90692c830ccf21a272433e3cc1b8c014979c84bd2ff4 SHA512 5bca2fb6b71c7c561b0ee0865663a3609947bfc17c5ea35934145d06903a681ce04efefe567704c2386e5f127a1df098bd4bb67e4b825ca01e86679680108675 WHIRLPOOL 1d5bf395a77a376c6593b0f83769975c569cd997db9bdf3ba13147afee9ef6bdee84b4d0c91680f299df1f61552aedf24c5497b2df61057d5b4982a5efc5a0ae
-EBUILD mathml-xml-dtd-2.0.ebuild 2098 SHA256 b704bfdd4f0b5365af75eda948c3e8375c306facfa522d40eddb7df9f2717740 SHA512 9ef48ce9660eabe788196bde50deb4c50344a69ad2cec97a01fcb5e26ab56810f52d888f8b76ba88c0c4f55d19a88eab405f9405d9e559cf6c223b56a97ac393 WHIRLPOOL 9025a2eac0c12d61f86beeb5fff5cfefbd863c3e25caa1c1bd445a1d5423165411cb14b846254ca8e09953fe76bea004d4ac78f99e7cd8ce7c7ad870c9fce2b3
diff --git a/app-text/mathml-xml-dtd/mathml-xml-dtd-2.0.ebuild b/app-text/mathml-xml-dtd/mathml-xml-dtd-2.0.ebuild
deleted file mode 100644 (file)
index 7cebaac..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-inherit versionator
-
-MY_P="${PN/-*/}$(get_major_version)"
-
-DESCRIPTION="MathML DTD and entity files"
-HOMEPAGE="http://www.w3.org/1998/Math/MathML"
-SRC_URI="http://www.w3.org/Math/DTD/${MY_P}.tgz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64"
-IUSE=""
-
-DEPEND="dev-libs/libxml2"
-RDEPEND="${DEPEND}"
-
-S="${WORKDIR}/${MY_P}"
-
-src_install() {
-       INSTALL_DIRECTORY="/usr/share/sgml/mathml/${P}"
-
-       insinto ${INSTALL_DIRECTORY}
-       doins -r * || die
-}
-
-pkg_postinst() {
-       if [[ ! -r ${ROOT}etc/xml/mathml ]] ; then
-               ebegin "Creating MathML catalog"
-               xmlcatalog --noout --create "${ROOT}"etc/xml/mathml
-               eend $? "Failed to create MathML catalog"
-               [[ $? -ne 0 ]] && return
-       fi
-
-       einfo "Updating Root XML Catalog"
-       xmlcatalog --noout \
-               --add "delegatePublic" "-//W3C//DTD MathML" "file:///etc/xml/mathml" \
-               --add "delegatePublic" "-//W3C//ENTITIES" "file:///etc/xml/mathml" \
-               --add "delegateURI" "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" "file:///etc/xml/mathml" \
-               "${ROOT}"etc/xml/catalog
-
-       einfo "Updating MathML Catalog"
-
-       (
-               IFS=";"
-               sed -n "/PUBLIC \"/ {N; s/\n/ /; s/^[^\"]*\"//; s/SYSTEM//; s/\"[^\"]*$//; s%\"[[:blank:]]\+\"%;${INSTALL_DIRECTORY}/%; p};" \
-                                               "${ROOT}${INSTALL_DIRECTORY#/}"/mathml2.dtd | while read orig replace
-               do
-                       xmlcatalog --noout --add public "${orig}" "file://${replace}" "${ROOT}"etc/xml/mathml
-               done
-       )
-
-       xmlcatalog --noout \
-               --add "rewriteSystem" \
-               "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" "file://${INSTALL_DIRECTORY}" \
-               "${ROOT}"etc/xml/mathml
-
-       xmlcatalog --noout \
-               --add "rewriteURI" \
-               "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" "file://${INSTALL_DIRECTORY}" \
-               "${ROOT}"etc/xml/mathml
-}
-
-pkg_postrm() {
-       einfo "Cleaning Root XML Catalog"
-
-       xmlcatalog --noout \
-               --del "-//W3C//DTD MathML" \
-               --del "-//W3C//ENTITIES" \
-               --del "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" \
-               "${ROOT}"etc/xml/catalog
-
-       einfo "Cleaning MathML Catalog"
-
-       sed -i "/${P}/d" "${ROOT}"etc/xml/mathml
-}
diff --git a/app-text/mathml2/Manifest b/app-text/mathml2/Manifest
new file mode 100644 (file)
index 0000000..2f4bb44
--- /dev/null
@@ -0,0 +1,2 @@
+DIST mathml2-20031021.tar.gz 121304 BLAKE2B 490c870adfc0bc02dcdc27863f4af486d6521e2bcb2574b829b4a2ac66c62461133cc831132eee13e5255ee84c655d003543674b2385bad7624dd57a5ed30520 SHA512 5bca2fb6b71c7c561b0ee0865663a3609947bfc17c5ea35934145d06903a681ce04efefe567704c2386e5f127a1df098bd4bb67e4b825ca01e86679680108675
+EBUILD mathml2-20031021.ebuild 2718 BLAKE2B 9434014a6b3d62965bfb6c44e2bd3c2e8e5a98f0de5103e2823760f84a2dbc9c0af7e003489207972d7e0b0feb6c0fdbf5bbe36b602772da29fc849f04819d01 SHA512 25e946f381125f4425d1a00779b90a6671af9c72e5db9322db475f3e48ce84229cfd0b8e5e61dd4c3eb8f777a30421c114ed268a4fa7502c90d479db987a31a3
diff --git a/app-text/mathml2/mathml2-20031021.ebuild b/app-text/mathml2/mathml2-20031021.ebuild
new file mode 100644 (file)
index 0000000..ed79829
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright © 2021 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or any later version.
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law.
+
+EAPI=7
+
+inherit sgml-catalog-r1
+
+DESCRIPTION="DTD and entity files for the Mathematical Markup Language 2.0"
+HOMEPAGE="http://www.w3.org/TR/MathML2/"
+SRC_URI="http://www.w3.org/Math/DTD/$PN.tgz -> $P.tar.gz"
+
+LICENSE="W3C"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+BDEPEND="dev-libs/libxml2
+       virtual/awk"
+RDEPEND="!app-text/mathml-xml-dtd"
+DEPEND="$RDEPEND
+       app-text/sgml-common"
+
+S=$WORKDIR/$PN
+
+src_prepare () {
+       rm -f xhtml*.dtd
+       default
+}
+
+src_compile () {
+       cat >"$WORKDIR/gen-catalog.awk" <<-'EOF'
+               BEGIN { print "OVERRIDE YES" }
+               /^[[:space:]]*PUBLIC.*-\/\/W3C\/\// {
+                 pubid=$0
+                 sub(/^[[:space:]]*/, "", pubid);
+
+                 if (getline > 0) {
+                   file=substr($1, 2, length($1)-2)
+
+                   if (length(file) && getline < file > 0) {
+                     print pubid, "\"" file "\""
+                         print "SYSTEM", "\"http://www.w3.org/TR/MathML2/dtd/" file "\"", "\"" file "\""
+                         print "SYSTEM", "\"http://www.w3.org/Math/DTD/mathml2/" file "\"", "\"" file "\""
+                     close(file)
+                   }
+                 }
+               }
+       EOF
+
+       ( set -x; awk -f "$WORKDIR/gen-catalog.awk" mathml2.dtd >catalog ) || die
+}
+
+src_install () {
+       declare -g pubmap=()
+
+       local insdir=/usr/share/sgml/$PN
+       local a b
+
+       insinto $insdir
+       doins -r catalog math* iso*
+
+       insinto /etc/sgml
+       printf 'CATALOG "%s"\n' "${EPREFIX%/}$insdir/catalog" | newins - $PN.cat
+
+       # Extract public identifiers from SGML catalog
+       exec 3<catalog
+       while read a b <&3; do
+               case $a in
+               PUBLIC)
+                       save_IFS=$IFS
+                       IFS=\"; set x $b; shift
+                       IFS=$save_IFS
+
+                       pubmap+=("$2" "${EPREFIX%/}$4")
+               esac
+       done
+       exec 3<&-
+}
+
+update_catalog () {
+       local insdir="file://${EPREFIX%/}/usr/share/sgml/$PN"
+       local xmlcatalog="${BROOT%/}/usr/bin/xmlcatalog"
+       local systemuri=("http://www.w3.org/TR/MathML2/dtd" "http://www.w3.org/Math/DTD/mathml2")
+       local x mode=$1 args=()
+
+       command -v "$xmlcatalog" >/dev/null || die
+
+       set x "${pubmap[@]}"; shift
+       while test $# -gt 0; do
+               case $mode in
+               --add) args+=( --add public "$1" "$insdir/$2" ) ;;
+               --del) args+=( --del "$1" ) ;;
+               esac
+               shift 2
+       done
+
+       for x in "${systemuri[@]}"; do
+               case $mode in
+               --add) args+=( --add rewriteSystem "$x" "$insdir"
+                              --add rewriteURI "$x" "$insdir" ) ;;
+               --del) args+=( --del "$x" ) ;;
+               esac
+       done
+
+       xmlcatalog --noout "${args[@]}" "${EROOT%/}/etc/xml/catalog"
+}
+
+pkg_postinst () {
+       sgml-catalog-r1_pkg_postinst
+
+       einfo "Adding $P to global XML catalog"
+       update_catalog --add
+}
+
+pkg_postrm () {
+       sgml-catalog-r1_pkg_postrm
+
+       einfo "Removing $P from global XML catalog"
+       update_catalog --del
+}