docbook-xsl-ns-stylesheets: Imported package from upstream

Imported app-text/docbook-xsl-ns-stylesheets of version 1.79.1.

This package will be used as a BDEPEND of iputils.

BUG=b:309390661
TEST=CQ

Change-Id: I0493fba7561316f901a4d59e8c67734bb6de38ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/5431394
Tested-by: Jie Jiang <jiejiang@chromium.org>
Commit-Queue: Jie Jiang <jiejiang@chromium.org>
Reviewed-by: Matt Stark <msta@google.com>
diff --git a/app-text/docbook-xsl-ns-stylesheets/Manifest b/app-text/docbook-xsl-ns-stylesheets/Manifest
new file mode 100644
index 0000000..bb3c6b9
--- /dev/null
+++ b/app-text/docbook-xsl-ns-stylesheets/Manifest
@@ -0,0 +1 @@
+DIST docbook-xsl-ns-1.79.1.tar.bz2 21962317 BLAKE2B a68cc31ea8cb98fc07e198fe55f242c6438284d6fa75d4920a9ca7b5038732f966cc6653e058d7fafb26c0ff49f2039025a48a0f8c0392ee892951723703bce3 SHA512 23fd06870bd5afe4efcd08c8ad679821c202a62442b50657c093cbe9cd71b585a3c56a5534a0d41119f58bf98b1f9014a53ff2e48ab59075ec1827e7363980e9
diff --git a/app-text/docbook-xsl-ns-stylesheets/OWNERS b/app-text/docbook-xsl-ns-stylesheets/OWNERS
new file mode 100644
index 0000000..aff12d8
--- /dev/null
+++ b/app-text/docbook-xsl-ns-stylesheets/OWNERS
@@ -0,0 +1 @@
+include /app-text/docbook-xml-dtd/OWNERS
diff --git a/app-text/docbook-xsl-ns-stylesheets/docbook-xsl-ns-stylesheets-1.79.1.ebuild b/app-text/docbook-xsl-ns-stylesheets/docbook-xsl-ns-stylesheets-1.79.1.ebuild
new file mode 100644
index 0000000..8ecdcd2
--- /dev/null
+++ b/app-text/docbook-xsl-ns-stylesheets/docbook-xsl-ns-stylesheets-1.79.1.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DOCBOOKDIR="/usr/share/sgml/${PN/-//}"
+MY_PN="${PN%-stylesheets}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="XSL Stylesheets for Docbook"
+HOMEPAGE="https://github.com/docbook/wiki/wiki"
+SRC_URI="mirror://sourceforge/docbook/${MY_P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="*"
+IUSE="ruby"
+
+RDEPEND=">=app-text/build-docbook-catalog-1.4
+	ruby? ( dev-lang/ruby )"
+DEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+# Makefile is broken since 1.76.0
+RESTRICT=test
+
+# The makefile runs tests, not builds.
+src_compile() { :; }
+
+src_test() {
+	emake check
+}
+
+src_install() {
+	# The changelog is now zipped, and copied as the RELEASE-NOTES, so we
+	# don't need to install it
+	dodoc AUTHORS BUGS NEWS README RELEASE-NOTES.txt TODO
+
+	insinto ${DOCBOOKDIR}
+	doins VERSION VERSION.xsl
+
+	local i
+	for i in $(find . -maxdepth 1 -mindepth 1 -type d -exec basename {} \;); do
+		[[ "${i}" == "epub" ]] && ! use ruby && continue
+
+		cd "${S}"/${i}
+		for doc in ChangeLog README; do
+			if [[ -e "${doc}" ]] ; then
+				mv ${doc} ${doc}.${i} || die
+				dodoc ${doc}.${i}
+				rm ${doc}.${i} || die
+			fi
+		done
+
+		doins -r "${S}"/${i}
+	done
+
+	if use ruby; then
+		local cmd="dbtoepub${MY_PN#docbook-xsl}"
+
+		# we can't use a symlink or it'll look for the library in the
+		# wrong path.
+		dodir /usr/bin
+		cat - > "${ED}"/usr/bin/${cmd} <<EOF
+#!/usr/bin/env ruby
+
+load "${DOCBOOKDIR}/epub/bin/dbtoepub"
+EOF
+		fperms 0755 /usr/bin/${cmd}
+	fi
+}
+
+pkg_postinst() {
+	# See bug #816303 for rationale behind die
+	build-docbook-catalog || die "Failed to regenerate docbook catalog. Is /run mounted?"
+}
+
+pkg_postrm() {
+	# See bug #816303 for rationale behind die
+	build-docbook-catalog || die "Failed to regenerate docbook catalog. Is /run mounted?"
+}
diff --git a/app-text/docbook-xsl-ns-stylesheets/metadata.xml b/app-text/docbook-xsl-ns-stylesheets/metadata.xml
new file mode 100644
index 0000000..19ad174
--- /dev/null
+++ b/app-text/docbook-xsl-ns-stylesheets/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<!--maintainer-needed-->
+	<use>
+		<flag name="ruby">
+			Install the Ruby-based dbtoepub script; requires an interpreter
+			compatible with <pkg>app-eselect/eselect-ruby</pkg>.
+		</flag>
+	</use>
+	<stabilize-allarches/>
+	<upstream>
+		<remote-id type="sourceforge">docbook</remote-id>
+		<remote-id type="github">docbook/wiki</remote-id>
+	</upstream>
+</pkgmetadata>