# Maintainer: Yichao Yu <yyc1992@gmail.com>

pkgname=qtcurve-git
_realver=1.8.18
pkgver=1.9.0.rc1.295.gc9896c47
pkgrel=1
pkgdesc='A configurable set of widget styles for KDE and Gtk.'
arch=(i686 x86_64 armv7h aarch64)
url="https://github.com/QtCurve/qtcurve"
license=('GPL')
# groups=(qtcurve)
depends=(qt5-base qt5-svg libxcb qt5-x11extras qt6-base qt6-svg
         libx11 gcc-libs karchive5 kconfig5 kconfigwidgets5
         frameworkintegration5 ki18n5
         kguiaddons5 kio5 kiconthemes5 kwidgetsaddons5 kwindowsystem5 kxmlgui5)
makedepends=(cmake git python mesa extra-cmake-modules qt6-xcb-private-headers)
provides=(
  "qtcurve-utils=${_realver}"
  "qtcurve-qt5=${_realver}"
  "qtcurve-kde=${_realver}"
  "qtcurve-qt6=${_realver}"
  "qtcurve-utils-git"
  "qtcurve-qt5-git")
conflicts=("qtcurve-qt5" "qtcurve-qt6" "qtcurve-kde" "qtcurve-utils")
options=('debug' 'strip')
source=("git+https://invent.kde.org/system/qtcurve.git")
md5sums=('SKIP')

pkgver() {
  cd qtcurve

  git describe --tags | sed -e 's/-/./g'
}

build() {
  cd qtcurve

  mkdir -p build
  cd build

  CFLAGS+=" -ffile-prefix-map=${srcdir}=${DBGSRCDIR:-/usr/src/debug}"
  CXXFLAGS+=" -ffile-prefix-map=${srcdir}=${DBGSRCDIR:-/usr/src/debug}"

  export CFLAGS
  export CXXFLAGS
  cmake .. \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_QT4=Off \
    -DENABLE_QT5=On \
    -DENABLE_QT6=On \
    -DENABLE_GTK2=Off \
    -DQTC_QT4_ENABLE_KDE=Off \
    -DQTC_QT5_ENABLE_KDE=On \
    -DQTC_QT6_ENABLE_KDE=Off
  make
}

package() {
  cd qtcurve/build

  make DESTDIR="$pkgdir/" install
}
