Name:                 qt5-qtxmlpatterns
Version:              5.11.1
Release:              4
Summary:              Provide support for XQuery, XPath, etc

License:              LGPLv2 with exceptions or GPLv3 with exceptions
Url:                  http://www.qt.io
Source0:              https://download.qt.io/archive/qt/5.11/5.11.1/submodules/qtxmlpatterns-everywhere-src-5.11.1.tar.xz

BuildRequires:        qt5-qtbase-devel >= %{version} qt5-qtbase-private-devel

%description
This package is qt5-qtxmlpatterns component. It provides support for XQuery, XPath, etc.

%package              devel
Summary:              Programming examples and libraries for qt5-qtxmlpatterns development
Requires:             %{name} = %{version}-%{release} qt5-qtbase-devel

Provides:             qt5-qtxmlpatterns-examples
Obsoletes:            qt5-qtxmlpatterns-examples

%description          devel
This package contains the programming examples and libraries for qt5-qtxmlpatterns development.

%prep
%autosetup -n qtxmlpatterns-everywhere-src-%{version} -p1

%build
%{qmake_qt5}
%make_build

%install
%make_install INSTALL_ROOT=%{buildroot}

mkdir %{buildroot}%{_bindir}
cd %{buildroot}%{_qt5_bindir}

for i in *
do
  if [ ${i} = "xmlpatterns" ]
  then
    ln ${i} %{buildroot}%{_bindir}/${i}-qt5
    ln -s ${i} ${i}-qt5
  elif [ ${i} = "xmlpatternsvalidator" ]
  then
    ln ${i} %{buildroot}%{_bindir}/${i}-qt5
    ln -s ${i} ${i}-qt5
  else
    ln ${i} %{buildroot}%{_bindir}/${i}
fi
done
cd -

cd %{buildroot}%{_qt5_libdir}
for prl_file in libQt5*.prl
do
  sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" ${prl_file}
  if [ -f "$(basename ${prl_file} .prl).so" ]
  then
    rm -fv "$(basename ${prl_file} .prl).la"
    sed -i -e "/^QMAKE_PRL_LIBS/d" ${prl_file}
  fi
done
cd -

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSE.LGPL*
%{_qt5_libdir}/libQt5*.*

%files devel
%{_qt5_bindir}/xmlpatterns*
%{_bindir}/xmlpatterns*
%{_qt5_headerdir}/Qt*/
%{_qt5_libdir}/cmake/Qt5*/
%{_qt5_libdir}/pkgconfig/Qt5*.pc
%{_qt5_archdatadir}/mkspecs/modules/*.pri
%{_qt5_examplesdir}/

%changelog
* Mon Oct 28 2019 dongjian <dongjian13@huawei.com> - 5.11.1-4
- Package init

