## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global pypi_name PyQt6_WebEngine

Name:          python-pyqt6-webengine
Version:       6.8.2
Release:       %autorelease
Summary:       Python bindings for Qt6WebEngine
License:       GPL-3.0-only
Url:           https://www.riverbankcomputing.com/software/pyqtwebengine/
Source0:       %pypi_source

# %%{qt6_qtwebengine_arches} is not yet defined
ExclusiveArch: aarch64 x86_64

## downstream patches
Patch0: pyqt6-webengine-fix-build.patch

BuildRequires: gcc-toolset-14-gcc-c++
BuildRequires: make
BuildRequires: pkgconfig(Qt6WebEngineCore)
BuildRequires: pkgconfig(Qt6WebEngineQuick)
BuildRequires: pkgconfig(Qt6WebEngineWidgets)

BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}
BuildRequires: python%{python3_pkgversion}-pyqt6 >= 6.2.0
BuildRequires: python%{python3_pkgversion}-pyqt6-devel
BuildRequires: %{py3_dist sip} >= 6
BuildRequires: %{py3_dist PyQt-builder} >= 1.11

%description
%{summary}.

%package -n python%{python3_pkgversion}-pyqt6-webengine
Summary: Python3 bindings for Qt6 WebEngine
Requires:  python%{python3_pkgversion}-pyqt6%{?_isa}
%{?python_provide:%python_provide python%{python3_pkgversion}-pyqt6-webengine}
%description -n python%{python3_pkgversion}-pyqt6-webengine
%{summary}.

%package -n python%{python3_pkgversion}-pyqt6-webengine-devel
Summary: Development files for %{name}
Requires: python3-pyqt6-webengine%{_isa} = %{version}-%{release}
Requires: python3-pyqt6-devel
%description -n python%{python3_pkgversion}-pyqt6-webengine-devel
%{summary}.


%prep
%autosetup -p1 -n PyQt6_WebEngine-%{version}


%build
%enable_devtoolset14

sip-build \
  --no-make \
  --qmake=%{_qt6_qmake} \
  --api-dir=%{_qt6_datadir}/qsci/api/python \
  --verbose \
  --qmake-setting 'QMAKE_CFLAGS_RELEASE="%{build_cflags}"' \
  --qmake-setting 'QMAKE_CXXFLAGS_RELEASE="%{build_cxxflags}"' \
  --qmake-setting 'QMAKE_LFLAGS_RELEASE="%{build_ldflags}"'

%make_build -C build


%install
%make_install INSTALL_ROOT=%{buildroot} -C build

# ensure .so modules are executable for proper -debuginfo extraction
for i in %{buildroot}%{python3_sitearch}/PyQt6/*.so ; do
test -x $i || chmod a+rx $i
done


%files -n python%{python3_pkgversion}-pyqt6-webengine
%doc README.md
%license LICENSE
%{python3_sitearch}/PyQt6_WebEngine-%{version}.dist-info/
%{python3_sitearch}/PyQt6/QtWebEngineCore.*
%{python3_sitearch}/PyQt6/QtWebEngineQuick.*
%{python3_sitearch}/PyQt6/QtWebEngineWidgets.*

%files -n python%{python3_pkgversion}-pyqt6-webengine-devel
%license LICENSE
%{python3_sitearch}/PyQt6/bindings/QtWebEngine*/
%dir %{_qt6_datadir}/qsci/
%dir %{_qt6_datadir}/qsci/api/
%dir %{_qt6_datadir}/qsci/api/python/
%{_qt6_datadir}/qsci/api/python/PyQt6-WebEngine.api


%changelog
* Thu feb  6 2025 Raven <raven@sysadmins.ws> - 6.8.2-1
- Update to 6.8.2

* Fri Jan  3 2025 Raven <raven@sysadmins.ws> - 6.8.0-1
- Update to 6.8.0

* Wed Oct 16 2024 Raven <raven@sysadmins.ws> - 6.7.0-2
- Rebuild for Qt 6.8.0

* Mon May 27 2024 Raven <raven@sysadmins.ws> - 6.7.0-1
- Update to 6.7.0

* Tue Dec 19 2023 Raven <raven@sysadmins.ws> - 6.6.0-1
- Update to 6.6.0

* Thu May 18 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 6.5.0-1
- Update to 6.5.0

* Fri May 05 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 6.4.0-2
- Rebuild for Qt 6.5.0

* Thu May 04 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 6.4.0-1
- Initial build
