abinfo "Installing configuration files to correct locations ..."
install -dvm755 "$PKGDIR"/etc/libreoffice
install -vm644 "$PKGDIR"/usr/lib/libreoffice/program/{bootstraprc,sofficerc} \
    "$PKGDIR"/etc/libreoffice/
install -vm644 "$PKGDIR"/usr/lib/libreoffice/share/psprint/psprint.conf \
    "$PKGDIR"/etc/libreoffice/
(
    cd "$PKGDIR"/usr/lib/libreoffice/program/
    ln -vsf /etc/libreoffice/{bootstraprc,sofficerc} .
    cd "$PKGDIR"/usr/lib/libreoffice/share/psprint/
    ln -vsf /etc/libreoffice/psprint.conf .
)

abinfo "Installing Uno Python modules ..."
install -dvm755 "$PKGDIR"/usr/lib/python${ABPY3VER}/site-packages
ln -svf /usr/lib/libreoffice/program/uno.py \
    "$PKGDIR"/usr/lib/python${ABPY3VER}/site-packages/uno.py
ln -svf /usr/lib/libreoffice/program/unohelper.py \
    "$PKGDIR"/usr/lib/python${ABPY3VER}/site-packages/unohelper.py

abinfo "Installing AppData metadata ..."
install -Dvm644 "$SRCDIR"/sysui/desktop/appstream-appdata/*.xml \
    -t "$PKGDIR"/usr/share/appdata

abinfo "Installing LibreOffice SDK (LibreOfficeKit) headers ..."
install -dvm755 "$PKGDIR"/usr/include/LibreOfficeKit
install -vm644 "$SRCDIR"/include/LibreOfficeKit/* \
    "$PKGDIR"/usr/include/LibreOfficeKit

abinfo "Symlinking liblibreofficekitgtk.so from LibreOffice SDK (LibreOfficeKit) ..."
ln -svf libreoffice/program/liblibreofficekitgtk.so \
    "$PKGDIR"/usr/lib/liblibreofficekitgtk.so

abinfo "Tweaking .desktop entries to prevent duplicate listing on application menus ..."
sed -e 's|Graphics;||g' \
    -i "$PKGDIR"/usr/lib/libreoffice/share/xdg/draw.desktop
sed -e 's|Education;||g' \
    -e 's|Math;||g' \
    -e 's|Science;||g' \
    -i "$PKGDIR"/usr/lib/libreoffice/share/xdg/math.desktop

abinfo "Dropping start center .desktop entry ..."
rm -v \
    "$PKGDIR"/usr/lib/libreoffice/share/xdg/startcenter.desktop \
    "$PKGDIR"/usr/share/applications/libreoffice-startcenter.desktop
