File qscintilla-qt4.spec of Package qscintilla-qt4

#
# spec file for package qscintilla-qt4
#
# Copyright (c) 2020 SUSE LLC
#
# 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/
#


%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "python"
%define build_python 1
%define python_description This package contains the Python extension for QScintilla.

%define oldpython python
%define pprefix python-
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%else
%define debug_package_requires libqscintilla2_qt4-%{sonum} = %{version}-%{release}
%endif
%define mname   qscintilla-qt4
%define sonum   15
Name:           %{?pprefix}%{mname}
Version:        2.11.6
Release:        0
Summary:        C++ Editor Class Library
License:        GPL-3.0-only
Group:          Development/Libraries/C and C++
URL:            https://www.riverbankcomputing.com/software/qscintilla
Source:         https://www.riverbankcomputing.com/static/Downloads/QScintilla/%{version}/QScintilla-%{version}.tar.gz
#PATCH-FIX-OPENSUSE: Adapt to the openSUSE Qt4 build
Patch0:         qscintilla-qt4.diff
BuildRequires:  libdrm-devel
BuildRequires:  libqt4-devel
%if 0%{?build_python}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module qt4-devel}
BuildRequires:  %{python_module sip4-devel >= 4.19.8}
BuildRequires:  libqscintilla_qt4-devel = %{version}
BuildRequires:  python-rpm-macros
Requires:       %{name}-sip = %{version}
Requires:       python-sip(api) = %{python_sip_api_ver}
%requires_ge    libqt4-x11
%requires_ge    python-qt4
%python_subpackages
%endif

%description
QScintilla is a Qt port of Neil Hodgson's Scintilla C++ editor class.

This is a Qt port from the original Scintilla class
(http://www.scintilla.org/).
%{?python_description}

%package -n libqscintilla2_qt4-%{sonum}
Summary:        C++ Editor Class Library
Group:          Development/Libraries/C and C++
Provides:       qscintilla_qt4 = %{version}
# since version 2.10
Provides:       qscintilla = %{version}
Obsoletes:      qscintilla < %{version}

%description -n libqscintilla2_qt4-%{sonum}
QScintilla is a Qt port of Neil Hodgson's Scintilla C++ editor class.

This is a Qt port from the original Scintilla class
(http://www.scintilla.org/).

%package -n libqscintilla_qt4-devel
Summary:        C++ Editor Class Library Development Files
Group:          Development/Libraries/C and C++
Requires:       libqscintilla2_qt4-%{sonum} = %{version}
%requires_ge    libqt4-devel
# openSUSE 10.3
Provides:       qscintilla-devel = %{version}
Obsoletes:      qscintilla-devel < %{version}
# since version 2.10
Provides:       libqscintilla-devel = %{version}
Obsoletes:      libqscintilla-devel < %{version}

%description -n libqscintilla_qt4-devel
QScintilla is a Qt port of Neil Hodgson's Scintilla C++ editor class.

This is a Qt port from the original Scintilla class
(http://www.scintilla.org/).

This package contains the development files for %{name}.

%if 0%{?build_python}
%package sip
Summary:        Sip files for %{name}
Group:          Development/Libraries/Python
Supplements:    packageand(python-sip:python-%{mname}) 
Provides:       %{oldpython}-%{mname}-sip = %{version}-%{release}
Obsoletes:      %{oldpython}-%{mname}-sip < %{version}-%{release}
Requires:       python-qt4-devel

%description sip
This package provides the SIP files used to generate the Python bindings for
%{name}
%endif

%prep
%setup -q -n QScintilla-%{version}
%patch0 -p1
sed -i '/#include <QTextCodec>/a #include <QUrl>' Qt4Qt5/qsciscintillabase.cpp

%build
%if ! 0%{?build_python}
pushd Qt4Qt5
qmake QMAKE_CXXFLAGS+=-std=c++11
make %{?_smp_mflags}
popd
pushd designer-Qt4Qt5
qmake QMAKE_CXXFLAGS+=-std=c++11
make %{?_smp_mflags}
popd
%else
%{python_expand cp -r Python Python_%{$python_bin_suffix}
pushd Python_%{$python_bin_suffix}

$python configure.py \
  --pyqt=PyQt4 \
  --sip=%{_bindir}/sip-%{$python_bin_suffix} \
  --pyqt-sipdir=%{_datadir}/sip/PyQt4 \
  --qmake=%{_bindir}/qmake \
  --no-dist-info \
  --no-stubs \
  --no-qsci-api
make %{?_smp_mflags}

popd

}
%endif

%install
%if ! 0%{?build_python}
pushd Qt4Qt5
make INSTALL_ROOT=%{buildroot} install
popd
pushd designer-Qt4Qt5
make INSTALL_ROOT=%{buildroot} install
popd
%else
%{python_expand pushd Python_%{$python_bin_suffix}

%make_install INSTALL_ROOT=%{buildroot}

popd

}
%endif

%if ! 0%{?build_python}

%post -n libqscintilla2_qt4-%{sonum} -p /sbin/ldconfig
%postun -n libqscintilla2_qt4-%{sonum} -p /sbin/ldconfig

%files -n libqscintilla2_qt4-%{sonum}
%license LICENSE
%doc NEWS
%{_datadir}/qt4/qsci
%{_datadir}/qt4/translations/qscintilla_*.qm
%{_libdir}/libqscintilla2_qt4.so.%{sonum}*

%files -n libqscintilla_qt4-devel
%{_includedir}/Qsci/
%{_libdir}/libqscintilla2_qt4.so
%{_libdir}/qt4/plugins/designer/libqscintillaplugin.so
%{_datadir}/qt4/mkspecs/features/qscintilla2.prf

%else

%files %{python_files}
%license LICENSE
%doc NEWS
%{python_sitearch}/PyQt4/Qsci.so

%files -n %{name}-sip
%{_datadir}/sip/PyQt4/Qsci

%endif

%changelog
openSUSE Build Service is sponsored by