File libqt5-creator.spec of Package libqt5-creator

#
# spec file for package libqt5-creator
#
# Copyright (c) 2018 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 https://bugs.opensuse.org/
#


%define have_qdoc 0%{?suse_version} >= 1500

%if 0%{?suse_version} < 1500
# Leap 42.x only has botan1
%bcond_with system_botan
%else
%bcond_without system_botan
%endif

Name:           libqt5-creator
Version:        4.8.2
Release:        0
Summary:        Integrated Development Environment targeting Qt apps
License:        GPL-3.0-with-Qt-Company-Qt-exception-1.1
Group:          Development/Tools/IDE
Url:            https://www.qt.io/ide/
%define major_ver 4.8
%define qt5_version 5.9.0
%define tar_version 4.8.2
Source:         http://download.qt.io/official_releases/qtcreator/%{major_ver}/%{tar_version}/qt-creator-opensource-src-%{tar_version}.tar.xz
Source1:        %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE
Patch1:         fix-build-isystem.patch
# PATCH-FIX-OPENSUSE
Patch2:         fix-application-output.patch
BuildRequires:  gdb
BuildRequires:  libQt5Sql5-sqlite >= %{qt5_version}
%if %{with system_botan}
BuildRequires:  libbotan-devel
%endif
BuildRequires:  libqt5-qtbase-devel >= %{qt5_version}
BuildRequires:  libqt5-qtdeclarative-private-headers-devel >= %{qt5_version}
BuildRequires:  libqt5-qtquickcontrols >= %{qt5_version}
BuildRequires:  libqt5-qtscript-devel >= %{qt5_version}
BuildRequires:  libqt5-qttools-private-headers-devel >= %{qt5_version}
%ifnarch ppc ppc64 ppc64le s390 s390x
BuildRequires:  libqt5-qtwebengine-devel >= %{qt5_version}
%endif
BuildRequires:  libqt5-qtx11extras-devel >= %{qt5_version}
%if 0%{?suse_version} < 1330
# It does not build with the default compiler (GCC 4.8) on Leap 42.x
%if 0%{?sle_version} <= 120200
BuildRequires:  gcc6-c++
%else
BuildRequires:  gcc7-c++
%endif
%endif
# Enable the clangcodemodel plugin on openSUSE TW and Leap 15.1+, which have LLVM >= 6.0.
%ifarch %arm aarch64 %ix86 x86_64
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150100
BuildRequires:  llvm-clang-devel >= 6.0
# clangcodemodel hardcodes clang include paths: QTCREATORBUG-21972
%requires_eq    clang%(rpm -q --qf '%''{version}' clang-devel | cut -d. -f1)
%endif
%endif
BuildRequires:  update-desktop-files
BuildRequires:  xz
Provides:       qt-creator = %{version}
Obsoletes:      qt-creator < %{version}
Recommends:     libqt5-qtbase-common-devel
Recommends:     libqt5-qtdoc-qch
Recommends:     libqt5-qtbase-devel
Recommends:     libqt5-qtdeclarative-devel
Recommends:     libqt5-qtquick1-devel
Recommends:     libqt5-qttranslations
Requires:       libqt5-qtquickcontrols
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 libQt5DesignerComponents5
%requires_eq libQt5Script5

%description
Qt Creator is an integrated development environment (IDE) designed to
facilitate development with the Qt application framework.

%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
%autosetup -p1 -n qt-creator-opensource-src-%{tar_version}

%build
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

# Enable the clangcodemodel plugin on openSUSE TW, which has LLVM >= 6.0.
%ifarch %arm %ix86 x86_64
%if 0%{?suse_version} > 1500
opts="LLVM_INSTALL_DIR=%{_prefix}"
%endif
%endif
opts="$opts IDE_LIBRARY_BASENAME=%{_lib}"
%if %{with system_botan}
opts="$opts CONFIG+=use_system_botan"
%endif

makeopts=""
%if 0%{?suse_version} < 1330
# It does not build with the default compiler (GCC 4.8) on Leap 42.x
%if 0%{?sle_version} <= 120200
makeopts="$makeopts CC=gcc-6 CXX=g++-6"
%else
makeopts="$makeopts CC=gcc-7 CXX=g++-7"
%endif
%endif

%qmake5 $opts
make %{?_smp_mflags} $makeopts
%if %{have_qdoc}
	make qch_docs
	make html_docs
%endif

%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

# Source Code Pro is packaged independently
rm -r %{buildroot}%{_datadir}/qtcreator/fonts
# Only relevant for macOS, needs python2
rm -r %{buildroot}%{_libdir}/qtcreator/libexec/dmgbuild

%if %{have_qdoc}
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/qtcreator/* %{buildroot}%{_datadir}/doc/packages/qt5/qtcreator/
%endif

%suse_update_desktop_file -i org.qt-project.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 '*.hpp' -o -name '*.pri' -o -iname 'license*.txt' -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
%license *GPL*
%{_bindir}/*
%{_libdir}/qtcreator/
%{_datadir}/qtcreator/
%{_datadir}/icons/hicolor
%{_datadir}/applications/org.qt-project.qtcreator.desktop
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/org.qt-project.qtcreator.appdata.xml
%if %{have_qdoc}
%dir %{_datadir}/doc/packages/qt5
%{_datadir}/doc/packages/qt5/qtcreator/
%{_datadir}/doc/packages/qt5/qtcreator.qch
%endif

%files plugin-devel
%license *GPL*
%{_datadir}/qtcreator-devel/
%{_sysconfdir}/profile.d/qtcreator-devel.*

%changelog
openSUSE Build Service is sponsored by