diff --git a/office/htmldoc/htmldoc.SlackBuild b/office/htmldoc/htmldoc.SlackBuild
index 3ce8e20a97..84d3041139 100644
--- a/office/htmldoc/htmldoc.SlackBuild
+++ b/office/htmldoc/htmldoc.SlackBuild
@@ -22,6 +22,13 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 20230630 bkw: Modified by SlackBuilds.org, BUILD=2:
+# - use BUILDROOT instead of --prefix=$PKG/usr, avoids compiling the
+# $PKG path into the binary.
+# - fix 32x32 icon (it was 31x31).
+# - don't include empty icon dirs in the package.
+# - make .desktop file validate.
+
# Thanks to Gentoo htmldoc's .ebuild maintainer for hints about configure's
# workaround, and for a patch to fix CVE-2009-3050.
#
@@ -43,7 +50,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=htmldoc
VERSION=${VERSION:-1.9.8}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -112,8 +119,8 @@ sed -r -i 's|CUPS_RAND|rand|g' htmldoc/http.c
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
- --prefix=$PKG/usr \
- --libdir=$PKG/usr/lib${LIBDIRSUFFIX} \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
--enable-ssl \
--with-gui \
--disable-localjpeg \
@@ -127,7 +134,8 @@ sed -r -i 's|\$(datadir)/doc/htmldoc|\$(prefix)/doc/htmldoc-$VERSION|g' \
doc/Makefile
# 'make all' also does install (DESTDIR not supported)
-make all
+# 20230630 bkw: DESTDIR is spelled BUILDROOT, here.
+make all BUILDROOT=$PKG
# Copy some files who are not automatically installed (main binary, .desktop, icons, etc..)
mkdir -p $PKG/usr/bin
@@ -136,14 +144,15 @@ mkdir -p $PKG/usr/share/applications
cp -a desktop/$PRGNAM.desktop $PKG/usr/share/applications
mkdir -p $PKG/usr/share/mime/packages
cp -a desktop/htmldoc.xml $PKG/usr/share/mime/packages
-mkdir -p $PKG/usr/share/icons/hicolor/{16x16,24x24,32x32,48x48,64x64,96x96,128x128,256x256}/apps/
-cp -a desktop/htmldoc-32.png $PKG/usr/share/icons/hicolor/32x32/apps/$PRGNAM.png
+mkdir -p $PKG/usr/share/icons/hicolor/{32x32,128x128,256x256}/apps/
+convert desktop/htmldoc-32.png -geometry 32x32 $PKG/usr/share/icons/hicolor/32x32/apps/$PRGNAM.png
cp -a desktop/htmldoc-128.png $PKG/usr/share/icons/hicolor/128x128/apps/$PRGNAM.png
cp -a desktop/htmldoc-256.png $PKG/usr/share/icons/hicolor/256x256/apps/$PRGNAM.png
mkdir -p $PKG/usr/share/htmldoc/
cp -a fonts $PKG/usr/share/htmldoc/
cp -a data $PKG/usr/share/htmldoc/
+sed -i '/^Categories/s,Application;,,' $PKG/usr/share/applications/*.desktop
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true