%define major 6
%define majmin 6.5
%global qt_module qtdoc

%define _qtdir %{_libdir}/qt%{major}
Summary:	Qt %{major} Documentation Tools
Name:		qt6-qtdoc
Version:	6.5.1
Release:	1
License:	LGPLv3 and GPL-3.0-or-later
Url:            http://www.qt.io

Source0:        https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submodules/%{qt_module}-everywhere-src-%{version}.tar.xz

BuildRequires:	cmake
BuildRequires:	ninja-build
BuildRequires:	cmake(Qt%{major}Core)
BuildRequires:	cmake(Qt%{major}Gui)
BuildRequires:	cmake(Qt%{major}Network)
BuildRequires:	cmake(Qt%{major}Xml)
BuildRequires:	cmake(Qt%{major}Widgets)
BuildRequires:	cmake(Qt%{major}Sql)
BuildRequires:	cmake(Qt%{major}Test)
BuildRequires:	cmake(Qt%{major}PrintSupport)
BuildRequires:	cmake(Qt%{major}OpenGL)
BuildRequires:	cmake(Qt%{major}OpenGLWidgets)
BuildRequires:	cmake(Qt%{major}DBus)
BuildRequires:	cmake(Qt%{major}QmlIntegration)
BuildRequires:	cmake(Qt%{major}QmlModels)
BuildRequires:	cmake(Qt%{major}QmlXmlListModel)
BuildRequires:	cmake(Qt%{major}Qml)
BuildRequires:	cmake(Qt%{major}Quick)
BuildRequires:	cmake(Qt%{major}QuickControls2)
BuildRequires:	cmake(Qt%{major}QuickTemplates2)
BuildRequires:	qt%{major}-qtdeclarative
BuildRequires:	pkgconfig(gl)
BuildRequires:	pkgconfig(xkbcommon)
BuildRequires:	pkgconfig(vulkan)
BuildRequires:	pkgconfig(openssl)
BuildRequires:	cmake(LLVM)
BuildRequires:	cmake(Clang)
BuildRequires:	cmake(Qt6Test)
BuildRequires:	cmake(Qt6QuickControls2)
BuildRequires:	cmake(Qt6QmlXmlListModel)
BuildRequires:	chrpath


%description
Qt %{major} documentation tools.

%prep
%autosetup -p1 -n %{qt_module}-everywhere-src-%{version}
# FIXME why are OpenGL lib paths autodetected incorrectly, preferring
# /usr/lib over /usr/lib64 even on 64-bit boxes?
mkdir -p build
pushd build
%cmake .. -G Ninja \
	-DCMAKE_INSTALL_PREFIX=%{_qt6_prefix} \
	-DBUILD_EXAMPLES:BOOL=ON \
	-DBUILD_SHARED_LIBS:BOOL=ON \
	-DFEATURE_cxx2a:BOOL=ON \
	-DFEATURE_dynamicgl:BOOL=ON \
	-DFEATURE_ftp:BOOL=ON \
	-DFEATURE_opengl_dynamic:BOOL=ON \
	-DFEATURE_use_lld_linker:BOOL=ON \
	-DFEATURE_xcb_native_painting:BOOL=ON \
	-DFEATURE_openssl:BOOL=ON \
	-DFEATURE_openssl_linked:BOOL=ON \
	-DFEATURE_system_sqlite:BOOL=ON \
	-DINPUT_sqlite=system \
	-DQT_WILL_INSTALL:BOOL=ON \
	-D_OPENGL_LIB_PATH=%{_libdir} \
	-DOPENGL_egl_LIBRARY=%{_libdir}/libEGL.so \
	-DOPENGL_glu_LIBRARY=%{_libdir}/libGLU.so \
	-DOPENGL_glx_LIBRARY=%{_libdir}/libGLX.so \
	-DOPENGL_opengl_LIBRARY=%{_libdir}/libOpenGL.so
popd

%build
%ninja_build -C build

%install
%ninja_install -C build
chrpath -d %{buildroot}/%{_qt6_examplesdir}/demos/colorpaletteclient/colorpaletteclient

%files
%{_libdir}/qt6/examples/*
%{_qtdir}/mkspecs/qtdoc_dummy_file.txt


%changelog
* Thu Aug 10 2023 EastDong <xudong23@iscas.ac.cn> - 6.5.1-1
- Update Package 6.5.1

* Mon May 15 2023 peijiankang <peijiankang@kylinos.cn> - 6.5.0-1
- Init Package for openEuler
