File qwt6.spec of Package qwt6-qt5

#
# spec file for package qwt6
#
# Copyright (c) 2017 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/
#


%define sover 6
Name:           qwt6
Version:        6.1.3
Release:        0
Summary:        Qt Widgets for Technical Applications
License:        SUSE-QWT-1.0
Group:          Development/Libraries/C and C++
Url:            http://qwt.sourceforge.net/
Source:         https://sourceforge.net/projects/qwt/files/qwt/%{version}/qwt-%{version}.tar.bz2
# PATCH-FIX-OPENSUSE to prevent 'ERROR: RPATH "/usr/local/qwt-6.1.0/lib" on
# /usr/lib(64)/qt4/plugins/designer/libqwt_designer_plugin.so is not allowed'.
Patch0:         qwt-6.1.3-rpath.patch
# PATCH-FIX-OPENSUSE pkgconfig.patch -- Create and install pc files for pkg-config
Patch1:         qwt-6.1.3-pkgconfig.patch
# PATCH-FIX-OPENSUSE mkspecs.patch -- Use established settings for the .pc files
Patch2:         qwt-6.1.3-mkspecs.patch
BuildRequires:  fdupes
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  qt-devel
BuildRequires:  pkgconfig(libpng)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Qwt(Qt4) library contains GUI Components and utility classes which are
primarily useful for programs with a technical background. Beside a 2D
plot widget it provides scales, sliders, dials, compasses, thermometers,
wheels and knobs to control or display values, arrays, or ranges of type
double.

%package -n libqwt%{sover}
Summary:        Shared library for Qt4 Widgets
Group:          System/Libraries
Provides:       %{name} = %{version}
Obsoletes:      %{name} < %{version}

%description -n libqwt%{sover}
This package contains the shared library to run Technical Applications
developed with/for Qwt(Qt4).

%package devel
Summary:        Include headers and Qt Designer plugin for Qwt
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       freetype2-devel
Requires:       gcc-c++
Requires:       qt-devel
Requires:       pkgconfig(libpng)
Conflicts:      qwt-devel
%if 0%{?suse_version}
Recommends:     %{name}-devel-doc
Recommends:     %{name}-examples
%endif

%description devel
This package contains the header files of Qwt and its Qt designer plugin
in order to create Qt applications using the Qwt(qt4) widgets.

%package examples
Summary:        Example programs using Qwt
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}

%description examples
This package contains example programs demonstrating the Qwt widgets.

%package designer
Summary:        Plugin for the Qt Interface designer
Group:          Development/Tools/GUI Builders
Requires:       %{name}-devel = %{version}
Conflicts:      qwt-designer

%description designer
The %{name}-designer package contains the plugin for the Qt4 User Interface
designer tool.

%package devel-doc
Summary:        Development documentation for Qwt(Qt4)
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}

%description devel-doc
This package contains the development documentation of the Qwt widgets
as is it created by doxygen.

%prep
%setup -q -n qwt-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
# remove leftovers
rm -f doc/man/man3/_tmp_qwt*
# rename manpages
for f in doc/man/man3/*; do
  qwt6name=$(echo $(basename ${f} .3)|sed \
   '/^Qwt/{s/Qwt/Qwt6/;be;}; /^qwt/{s/qwt/qwt6/;be;}; s/$/_qwt6/; :e;')
  mv -v ${f} doc/man/man3/${qwt6name}.3
done

%build
mkdir build
pushd build
qmake .. \
	QMAKE_STRIP="" \
	QMAKE_CXXFLAGS="%{optflags}"

make V=1 %{?_smp_mflags}
popd

%install
pushd build
make V=1 DESTDIR=%{buildroot} install INSTALL_ROOT=%{buildroot}
popd

# Qwt base examples
mkdir -p %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_docdir}/libqt4/%{name}
cp -r examples %{buildroot}%{_docdir}/libqt4/%{name}/examples
cp -r build/examples/bin %{buildroot}%{_libdir}/%{name}/examples

mkdir -p %{buildroot}%{_mandir}
mv %{buildroot}%{_docdir}/libqt4/qwt6/man/man3 \
   %{buildroot}%{_mandir}/

%fdupes %{buildroot}/%{_prefix}

%post -n libqwt%{sover} -p /sbin/ldconfig
%postun -n libqwt%{sover} -p /sbin/ldconfig

%files -n libqwt%{sover}
%defattr(-,root,root)
%if 0%{?suse_version} > 1320 || 0%{?leap_version} >= 420200
%license COPYING
%else
%doc COPYING
%endif
%{_libdir}/libqwt.so.*

%files designer
%defattr(-,root,root)
%{_libdir}/qt4/plugins/designer/*.so

%files devel
%defattr(-,root,root)
%doc README
%{_libdir}/libqwt.so
%{_libdir}/pkgconfig/qwt.pc
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h
%{_datadir}/qt4/mkspecs/features/
%{_mandir}/man?/*.?%{ext_info}

%files examples
%defattr(-,root,root)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/examples
%{_libdir}/%{name}/examples/

%files devel-doc
%defattr(-,root,root)
%dir %{_docdir}/libqt4/%{name}
%doc %{_docdir}/libqt4/%{name}/

%changelog
openSUSE Build Service is sponsored by