Name:           qt-mobility
Version:        1.2.2
Release:        5
Summary:        Framwork of qt mobility
License:        LGPLv2 with exceptions
URL:            https://code.qt.io/cgit/qt-mobility/qt-mobility.git
Source0:        qt-mobility-opensource-src-%{version}-169da60c.tar.xz
Patch0:         qt-mobility-opensource-src-1.2.2-gcc6.patch
Patch1:         qt-mobility-opensource-src-1.2.2-pkgconfig.patch
Patch2:         qt-mobility-opensource-src-1.2.2-sensors_ftbfs.patch
Patch3:         qt-mobility-opensource-src-1.2.2-no_rpath.patch
Patch4:         qt-mobility-proj6.patch
Patch5:         qt-mobility-opensource-src-1.2.0-translationsdir.patch
Patch6:         qt-mobility-opensource-src-1.1.0-pulseaudio-lib.patch
Patch7:         qt-mobility-libnm.patch

BuildRequires:  gcc-c++ perl pkgconfig(xv) pkgconfig(QtGui) pkgconfig(QtOpenGL)
BuildRequires:  pkgconfig(QtDeclarative) pkgconfig(QtCore) pkgconfig(libudev) pkgconfig(libnm)
BuildRequires:  pkgconfig(alsa) pkgconfig(blkid) pkgconfig(bluez) pkgconfig(libpulse) chrpath
Requires:       qt4
#BuildRequires:  make pkgconfig(gstreamer-plugins-bad-1.0) pkgconfig(gstreamer-app-1.0) pkgconfig(QtNetwork) >= 4.7

Provides:       qt4-mobility = %{version}-%{release} qt4-mobility%{?_isa} = %{version}-%{release}
Provides:       %{name}-connectivity = %{version}-%{release} %{name}-contacts = %{version}-%{release}
Obsoletes:      %{name}-connectivity < %{version}-%{release} %{name}-contacts < %{version}-%{release}
Provides:       %{name}-feedback = %{version}-%{release} %{name}-gallery = %{version}-%{release}
Obsoletes:      %{name}-feedback < %{version}-%{release} %{name}-gallery < %{version}-%{release}
Provides:       %{name}-location = %{version}-%{release} %{name}-multimediakit = %{version}-%{release}
Obsoletes:      %{name}-location < %{version}-%{release} %{name}-multimediakit < %{version}-%{release}
Provides:       %{name}-organizer = %{version}-%{release} %{name}-pim = %{version}-%{release}
Obsoletes:      %{name}-organizer < %{version}-%{release} %{name}-pim < %{version}-%{release}
Provides:       %{name}-versit = %{version}-%{release} %{name}-publishsubscribe = %{version}-%{release}
Obsoletes:      %{name}-versit < %{version}-%{release} %{name}-publishsubscribe < %{version}-%{release}
Provides:       %{name}-sensors = %{version}-%{release} %{name}-serviceframework = %{version}-%{release}
Obsoletes:      %{name}-sensors < %{version}-%{release} %{name}-serviceframework < %{version}-%{release}
Provides:       %{name}-bearer = %{version}-%{release}
Obsoletes:      %{name}-bearer < %{version}-%{release}

%description
This pacakge provides a set of APIs to Qt. It is also not only a single API but a collection of APIs 
and frameworks. These APIs give the developer a range of desirable functions for a mobile platform,
but now these functions become possible on platforms not traditionally associated with some of the
features. It will be used by developers to build a variety of applications and services that are mobile
capable or familiar to mobile users, irrespective of whether the platform is mobile or not. This means
that there is the possibility of easy transfer of user experience from PC to phone or vice versa.

%package       devel
Summary:       The development files for %{name}
Requires:      qt4-devel %{name} = %{version}-%{release}
Provides:      qt4-mobility-devel = %{version}-%{release} qt4-mobility-devel%{?_isa} = %{version}-%{release}
Provides:      %{name}-bearer-devel = %{version}-%{release} %{name}-connectivity-devel = %{version}-%{release}
Provides:      %{name}-feedback-devel = %{version}-%{release} %{name}-contacts-devel = %{version}-%{release}
Provides:      %{name}-gallery-devel = %{version}-%{release} %{name}-location-devel = %{version}-%{release}
Provides:      %{name}-multimediakit-devel = %{version}-%{release} %{name}-organizer-devel = %{version}-%{release}
Provides:      %{name}-publishsubscribe-devel = %{version}-%{release} %{name}-sensors-devel = %{version}-%{release}
Provides:      %{name}-serviceframework-devel = %{version}-%{release} %{name}-versit-devel = %{version}-%{release}
Provides:      %{name}-systeminfo-devel = %{version}-%{release}

%description   devel
This package contain the development files for %{name}.

%package        doc
Summary:        API documentation for %{name}
Requires:       qt4
BuildArch:      noarch
%description    doc
%{summary}.

%prep
%setup -q -n %{name}-opensource-src-%{version}
%patch0 -p1 -b .gcc6
%patch1 -p1 -b .pkgconfig
%patch2 -p1 -b .sensors_ftbfs
%patch3 -p1 -b .no_rpath
%patch4 -p1 -b .proj6
%patch5 -p1 -b .translationsdir
%patch6 -p1 -b .pulseaudio_lib
%patch7 -p1 -b .libnm

%build
PATH=%{_qt4_bindir}:$PATH; export PATH

./configure -prefix %{_qt4_prefix} -bindir %{_bindir} -headerdir %{_qt4_headerdir} -release\
  -languages "ar cs da de es fr he hu ja ko pl pt ru sk sl sv uk zh_CN zh_TW" \
  -libdir %{_qt4_libdir} -plugindir %{_qt4_plugindir} -qmake-exec %{_qt4_qmake} \

export CXXFLAGS="%{optflags} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"
%{qmake_qt4} -r
%make_build
%make_build qch_docs

%install
make install INSTALL_ROOT=%{buildroot}

install -p -m644 -D doc/qch/qtmobility.qch %{buildroot}%{_qt4_docdir}/qch/qtmobility.qch
mkdir -p %{buildroot}%{_qt4_docdir}/html/qtmobility
cp -a doc/html/* %{buildroot}%{_qt4_docdir}/html/qtmobility/
mv %{buildroot}%{_qt4_translationdir} %{buildroot}%{_qt4_prefix}

%find_lang %{name} --all-name --with-qt --without-mo

%ldconfig_scriptlets

cd $RPM_BUILD_ROOT/usr
file `find -type f` | grep -w ELF | awk -F":" '{print $1}' | for i in `xargs`
do
chrpath -d $i
done
cd -

%files -f %{name}.lang
%license LICENSE.LGPL LGPL_EXCEPTION.txt
%dir %{_qt4_importdir}/QtMobility/
%{_qt4_importdir}/QtMobility/{connectivity/,feedback/,gallery/}
%{_qt4_importdir}/QtMobility/{location/,contacts/,organizer/,systeminfo/}
%{_qt4_importdir}/QtMobility/{publishsubscribe/,sensors/,serviceframework/}
%{_qt4_importdir}/QtMultimediaKit/
%{_qt4_libdir}/libQt{Bearer,Connectivity,Feedback,Gallery,Sensors}.so.1*
%{_qt4_libdir}/libQt{Location,MultimediaKit,Contacts,Organizer}.so.1*
%{_qt4_libdir}/libQt{Versit,VersitOrganizer,PublishSubscribe}.so.1*
%{_qt4_libdir}/libQt{ServiceFramework,SystemInfo}.so.1*
%{_qt4_plugindir}/{feedback/,geoservices/,landmarks/,audio/,sensors/}
%{_qt4_plugindir}/{mediaservice/,playlistformats/,contacts/,versit/}
%{_qt4_plugindir}/sensorgestures/

%files devel
%{_bindir}/*
%{_qt4_prefix}/mkspecs/features/mobility*.prf
%{_qt4_headerdir}/Qt*/
%{_qt4_libdir}/{libQt*.prl,libQt*.so}
%{_qt4_libdir}/pkgconfig/Qt*.pc

%files doc
%{_qt4_docdir}/qch/qtmobility.qch
%{_qt4_docdir}/html/qtmobility/

%changelog
* Mon Jan 24 2022 chenchen <chen_aka_jan@163.com> - 1.2.2-5
- remove proj for fix build error

* Wed Oct 13 2021 peijiankang <peijiankang@kylinos.cn> - 1.2.2-4
- update to upstream version 1.2.2-4

* Thu Sep 09 2021 wangyue <wangyue92@huawei.com> - 1.2.2-2
- fix rpath error

* Thu Dec 12 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.2.2-1
- Package init
