X-Git-Url: http://git.draconx.ca/gitweb/gentoo-draconx.git/blobdiff_plain/f79729c79b56b8121bb4e74a6c729869aa800fac..ab1ac8992d7a2de6c341208777319d96f8f7645b:/app-text/mathml2/mathml2-20031021.ebuild diff --git a/app-text/mathml2/mathml2-20031021.ebuild b/app-text/mathml2/mathml2-20031021.ebuild new file mode 100644 index 0000000..ed79829 --- /dev/null +++ b/app-text/mathml2/mathml2-20031021.ebuild @@ -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/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 +}