File libqt5-creator.spec of Package libqt5-creator

#
# spec file for package libqt5-creator
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           libqt5-creator
Version:        4.0.1
Release:        0
Summary:        Lightweight IDE
License:        SUSE-LGPL-2.1-with-digia-exception-1.1
Group:          Development/Tools/IDE
Url:            http://qt.digia.com/Product/Developer-Tools/
%define major_ver 4.0
%define rname qt-creator
%define qt5_version 5.6.1
Source:         http://download.qt.io/official_releases/qtcreator/%{major_ver}/%{version}/%{rname}-opensource-src-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
Source2:        qtcreator.desktop
# PATCH-FIX-UPSTREAM qbs-path.diff -- install qbs plugin to sane location
Patch0:         qbs-path.diff
# PATCH-FIX-UPSTREAM lldb.diff -- exclude lldb-mi* from autodetection
Patch1:         lldb.diff
# this application needs C++11 for build
%if 0%{?sles_version} && 0%{?suse_version} == 1110
BuildRequires:  gcc48
BuildRequires:  gcc48-c++
%else
BuildRequires:  gcc-c++ >= 4.7
%endif
BuildRequires:  gdb
BuildRequires:  libQt5Sql5-sqlite >= %{qt5_version}
BuildRequires:  libQt5WebKitWidgets-devel >= %{qt5_version}
BuildRequires:  libbotan-devel
BuildRequires:  libqt5-qtbase-devel >= %{qt5_version}
BuildRequires:  libqt5-qtdeclarative-private-headers-devel >= %{qt5_version}
BuildRequires:  libqt5-qtscript-devel >= %{qt5_version}
BuildRequires:  libqt5-qttools-private-headers-devel >= %{qt5_version}
BuildRequires:  libqt5-qtx11extras-devel >= %{qt5_version}
BuildRequires:  update-desktop-files
BuildRequires:  xz
Provides:       qt-creator = %{version}
Obsoletes:      qt-creator < %{version}
Recommends:     libqt5-qtbase-common-devel
Recommends:     libqt5-qtdoc
Recommends:     libqt5-qtbase-devel
Recommends:     libqt5-qtdeclarative-devel
Recommends:     libqt5-qtquick1-devel
Recommends:     libqt5-qttranslations
Suggests:       git-core

# Make sure to rebuild against latest Qt5 (using the last package in chain - libQt5Designer5)
# Explicitly require libQt5Script5 (needed by plugins). Qt Creator crashes with old versions on project load.
%requires_eq libQt5Designer5
%requires_eq libQt5Script5
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Qt Creator is a new, lightweight, cross-platform integrated development
environment (IDE) designed to make development with the Qt application
framework even faster and easier.

%package plugin-devel
Summary:        Qt Creator Plugin Development Files
Group:          Development/Tools/IDE
Requires:       libqt5-creator = %{version}
Requires:       libqt5-qtbase-devel >= %{qt5_version}

%description plugin-devel
This package contains all files from the Qt Creator source directory
(aka QTC_SOURCE) necessary to compile plugins. 

%prep
%setup -q -n %{rname}-opensource-src-%{version}
%patch0 -p1
%patch1 -p1

%build
%if 0%{?sles_version} && 0%{?suse_version} == 1110
export CC=gcc-4.8
export CXX=g++-4.8
%endif
sed -i s,libexec/qtcreator,%{_lib}/qtcreator/libexec,g qtcreator.qbs
sed -i 's,libexec/qtcreator,$$IDE_LIBRARY_BASENAME/qtcreator/libexec,g' qtcreator.pri
# https://bugzilla.opensuse.org/962650
sed -i s,libexec/qtcreator,%{_lib}/qtcreator/libexec,g src/plugins/coreplugin/icore.cpp

opts="$opts IDE_LIBRARY_BASENAME=%{_lib}"
# botan 1.10 required by libqt5-creator appeared in openSUSE 12.1
%if 0%{?suse_version} >= 1210
opts="$opts USE_SYSTEM_BOTAN=1"
%endif
%if 0%{?suse_version} < 1140
opts="$opts QMAKE_CC=gcc-4.8 QMAKE_CXX=g++-4.8"
%endif

%qmake5 $opts
make %{?_smp_mflags}
make qch_docs
make html_docs_online

%install
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}%{_libdir}"
# its qmake. of course it is broken
make INSTALL_ROOT=%{buildroot}/%{_prefix} install

mkdir -p %{buildroot}%{_datadir}/doc/packages/qt5
cp share/doc/qtcreator/qtcreator.qch %{buildroot}%{_datadir}/doc/packages/qt5/

mkdir -p %{buildroot}%{_datadir}/doc/packages/qt5/qtcreator
cp -a doc/html/* %{buildroot}%{_datadir}/doc/packages/qt5/qtcreator/

%suse_update_desktop_file -i qtcreator Development Qt IDE

# plugin development files
mkdir %{buildroot}%{_datadir}/qtcreator-devel
cp qtcreator.pri %{buildroot}%{_datadir}/qtcreator-devel
find src \( -name '*.h' -o -name '*.pri' -o -name 'QtConcurrentTools' \) \
   -exec cp --parents {} %{buildroot}%{_datadir}/qtcreator-devel \;

mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cat >%{buildroot}%{_sysconfdir}/profile.d/qtcreator-devel.sh <<EOF
export QTC_SOURCE=%{_datadir}/qtcreator-devel
export QTC_BUILD=%{_exec_prefix}
EOF
cat >%{buildroot}%{_sysconfdir}/profile.d/qtcreator-devel.csh <<EOF
setenv QTC_SOURCE %{_datadir}/qtcreator-devel
setenv QTC_BUILD %{_exec_prefix}
EOF

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc *GPL*
%{_bindir}/*
%{_libdir}/qtcreator/
%{_datadir}/qtcreator/
%{_datadir}/icons/hicolor
%{_datadir}/applications/qtcreator.desktop
%dir %{_datadir}/doc/packages/qt5
%{_datadir}/doc/packages/qt5/qtcreator/
%{_datadir}/doc/packages/qt5/qtcreator.qch

%files plugin-devel
%defattr(-,root,root)
%{_datadir}/qtcreator-devel/
%{_sysconfdir}/profile.d/qtcreator-devel.*

%changelog