# Maintainer: Xgui4
pkgname=lce-qt-launcher
pkgver="0.0.21a2"
pkgrel=1
pkgdesc="A custom Minecraft LCE Launcher written wiht PySide6 with GNU/Linux support in mind."
arch=('any')
url="https://github.com/xgui4/LCE-Qt-Launcher"
license=('GPL-3.0-or-later')
depends=(
    'python' 
    'pyside6' 
    'python-vdf'
    'python-platformdirs'
    'python-rich'
) 
makedepends=(
    'git'     
    'bash'
    'python-build' 
    'python-installer' 
    'python-hatchling' 
    'python-wheel'
    'qt6-tools'
)
optdepends=(
    'wine: Allow to launch non-Linux-native Minecraft LCE ports'
    'steam: Allow for Steam integration'
    'steamtinkerlaunch: For better Stream integration on Linux'
)
provides=("${pkgname%-stable}" "${pkgname%}")
conflicts=("${pkgname%-git}" "${pkgname%-dev}")
source=("${pkgname}::git+${url}.git#tag=v0.021a0")
sha256sums=('SKIP')

build() {
    cd "$pkgname"
    rm -rf dist/ build/
    /usr/bin/python -m build --wheel --no-isolation
}

package() {
    cd "$pkgname"
    /usr/bin/python -m installer --destdir="$pkgdir" dist/*.whl
    install -d "$pkgdir/opt/lce_qt_launcher"

    install -Dm644 "data/lce_qt_launcher.ini" "$pkgdir/etc/lce_qt_launcher.ini"
    install -Dm644 "packages/io.github.xgui4.lce_qt_launcher.desktop" "$pkgdir/usr/share/applications/io.github.xgui4.lce_qt_launcher.desktop"
    install -Dm644 "packages/lce-content-installer.desktop" "$pkgdir/usr/share/applications/lce-content-installer.desktop"
    install -Dm644 "packages/lce_inst-mime.xml" "$pkgdir/usr/share/mime/packages/io.github.xgui4.lce_qt_launcher.xml"
    install -Dm644 "license.md" -t "$pkgdir/usr/share/licenses/$pkgname/"
    install -Dm644 "readme.md" "code-of-conduct.md" -t "$pkgdir/usr/share/doc/$pkgname/"
    install -Dm644 "assets/io.github.xgui4.lce_qt_launcher.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/io.github.xgui4.lce_qt_launcher.png"
    install -Dm644 "assets/lce_content_installer.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/lce_content_installer.png"
    install -Dm644 "assets/lce_inst.png" "$pkgdir/usr/share/icons/hicolor/128x128/mimetypes/application-x-lce_inst.png"
}
