1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 MY_P="${PN/-*/}$(get_major_version)"
9 DESCRIPTION="MathML DTD and entity files"
10 HOMEPAGE="http://www.w3.org/1998/Math/MathML"
11 SRC_URI="http://www.w3.org/Math/DTD/${MY_P}.tgz"
18 DEPEND="dev-libs/libxml2"
21 S="${WORKDIR}/${MY_P}"
24 INSTALL_DIRECTORY="/usr/share/sgml/mathml/${P}"
26 insinto ${INSTALL_DIRECTORY}
31 if [[ ! -r ${ROOT}etc/xml/mathml ]] ; then
32 ebegin "Creating MathML catalog"
33 xmlcatalog --noout --create "${ROOT}"etc/xml/mathml
34 eend $? "Failed to create MathML catalog"
35 [[ $? -ne 0 ]] && return
38 einfo "Updating Root XML Catalog"
40 --add "delegatePublic" "-//W3C//DTD MathML" "file:///etc/xml/mathml" \
41 --add "delegatePublic" "-//W3C//ENTITIES" "file:///etc/xml/mathml" \
42 --add "delegateURI" "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" "file:///etc/xml/mathml" \
43 "${ROOT}"etc/xml/catalog
45 einfo "Updating MathML Catalog"
49 sed -n "/PUBLIC \"/ {N; s/\n/ /; s/^[^\"]*\"//; s/SYSTEM//; s/\"[^\"]*$//; s%\"[[:blank:]]\+\"%;${INSTALL_DIRECTORY}/%; p};" \
50 "${ROOT}${INSTALL_DIRECTORY#/}"/mathml2.dtd | while read orig replace
52 xmlcatalog --noout --add public "${orig}" "file://${replace}" "${ROOT}"etc/xml/mathml
57 --add "rewriteSystem" \
58 "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" "file://${INSTALL_DIRECTORY}" \
59 "${ROOT}"etc/xml/mathml
63 "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" "file://${INSTALL_DIRECTORY}" \
64 "${ROOT}"etc/xml/mathml
68 einfo "Cleaning Root XML Catalog"
71 --del "-//W3C//DTD MathML" \
72 --del "-//W3C//ENTITIES" \
73 --del "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd" \
74 "${ROOT}"etc/xml/catalog
76 einfo "Cleaning MathML Catalog"
78 sed -i "/${P}/d" "${ROOT}"etc/xml/mathml