Remove directories according to the respective sections

This commit is contained in:
Pierre Pronchery 2016-08-15 01:42:05 +02:00
parent ccb68796b9
commit 585de72d24

View File

@ -63,6 +63,7 @@ SORT="sort"
TAR="tar" TAR="tar"
TOUCH="touch" TOUCH="touch"
TR="tr" TR="tr"
UNIQ="uniq"
WC="wc" WC="wc"
XMLLINT="xmllint" XMLLINT="xmllint"
YEAR="$(date +%Y)" YEAR="$(date +%Y)"
@ -811,6 +812,7 @@ EOF
_pkgsrc_makefile() _pkgsrc_makefile()
{ {
xpath="string(/refentry/refmeta/manvolnum)" xpath="string(/refentry/refmeta/manvolnum)"
sections=
$CAT << EOF $CAT << EOF
# \$NetBSD\$ # \$NetBSD\$
@ -879,6 +881,7 @@ EOF
echo "" echo ""
echo ".if \${PKGMANDIR} != \"share/man\"" echo ".if \${PKGMANDIR} != \"share/man\""
echo "post-install:" echo "post-install:"
#HTML pages
for i in doc/*.xml; do for i in doc/*.xml; do
[ -f "$i" ] || continue [ -f "$i" ] || continue
[ "${i%.css.xml}" = "$i" ] || continue [ "${i%.css.xml}" = "$i" ] || continue
@ -888,6 +891,7 @@ EOF
page="${page%.xml}.html" page="${page%.xml}.html"
echo " \${MV} \${DESTDIR}\${PREFIX}/share/man/html$section/$page \${DESTDIR}\${PREFIX}/\${PKGMANDIR}/html$section/$page" echo " \${MV} \${DESTDIR}\${PREFIX}/share/man/html$section/$page \${DESTDIR}\${PREFIX}/\${PKGMANDIR}/html$section/$page"
done | $SORT done | $SORT
#manual pages
for i in doc/*.xml; do for i in doc/*.xml; do
[ -f "$i" ] || continue [ -f "$i" ] || continue
[ "${i%.css.xml}" = "$i" ] || continue [ "${i%.css.xml}" = "$i" ] || continue
@ -897,8 +901,18 @@ EOF
page="${page%.xml}.1" page="${page%.xml}.1"
echo " \${MV} \${DESTDIR}\${PREFIX}/share/man/man$section/$page \${DESTDIR}\${PREFIX}/\${PKGMANDIR}/man$section/$page" echo " \${MV} \${DESTDIR}\${PREFIX}/share/man/man$section/$page \${DESTDIR}\${PREFIX}/\${PKGMANDIR}/man$section/$page"
done | $SORT done | $SORT
echo " \${RMDIR} \${DESTDIR}\${PREFIX}/share/man/html1" #remove directories
echo " \${RMDIR} \${DESTDIR}\${PREFIX}/share/man/man1" for i in doc/*.xml; do
[ -f "$i" ] || continue
[ "${i%.css.xml}" = "$i" ] || continue
section=$($XMLLINT --xpath "$xpath" "$i")
[ -n "$section" ] || section="1"
sections="$sections $section"
done
for section in $sections; do
echo " \${RMDIR} \${DESTDIR}\${PREFIX}/share/man/html$section"
echo " \${RMDIR} \${DESTDIR}\${PREFIX}/share/man/man$section"
done | $SORT | $UNIQ
echo " \${RMDIR} \${DESTDIR}\${PREFIX}/share/man" echo " \${RMDIR} \${DESTDIR}\${PREFIX}/share/man"
echo ".endif" echo ".endif"
fi fi