File kpl-Fedora_40.spec of Package kpl

#
# spec file for package kpl
#
# norootforbuild

%bcond_with debuginfo

Name:             kpl
Version:          5.0
Release:          86.1
Summary:          A Program for Graphical Presentation of Data Sets and Functions

%if 0%{?suse_version} || 0%{?sles_version}
Group:            Productivity/Scientific/Math
License:          GPL-2.0+
%else
Group:            Applications/Productivity
License:          GPLv2+
%endif
URL:              http://kpl.werner-stille.de/
Source0:          http://kpl.werner-stille.de/archive/%{name}-%{version}.tar.bz2
Patch0:           python3_shebang.patch
Patch1:           escape_doublequotes.patch
BuildRoot:        %{_tmppath}/%{name}-%{version}-build

%if 0%{?suse_version} || 0%{?sles_version}
BuildRequires:    kconfigwidgets-devel kdoctools-devel ki18n-devel kio-devel
BuildRequires:    knotifications-devel knotifyconfig-devel kxmlgui-devel
BuildRequires:    libQt5PrintSupport-devel libqt5-qtsvg-devel threadweaver-devel
BuildRequires:    update-desktop-files
%else
BuildRequires:    kf5-kconfigwidgets-devel kf5-kdoctools-devel kf5-ki18n-devel
BuildRequires:    kf5-kio-devel kf5-knotifications-devel kf5-knotifyconfig-devel
BuildRequires:    kf5-threadweaver-devel kf5-kxmlgui-devel qt5-qtsvg-devel
BuildRequires:    extra-cmake-modules kf5-rpm-macros desktop-file-utils fedora-logos
BuildRequires:    util-linux
%endif
Requires(post):   shared-mime-info
Requires(postun): shared-mime-info

%description
Kpl is a program for two- and three-dimensional graphical presentation
of data sets and functions. Multidimensional nonlinear parameter fits of
functions to data sets can be performed using the Levenberg-Marquardt
algorithm. Also general linear least square parameter fits are possible.
A D-BUS interface can be used to control Kpl by other applications and
scripts.

All settings necessary for a complete description of the presentation
can be saved in plot files. These files as well as data files may be
chosen via command line parameters, using the File menu, or by drag and
drop.

Automatic scaling and normalization allow the easy graphical presentation
of data. Also parameter fits can be performed automatically.
The settings of a presentation may be changed using the Edit menu. Here
also additional data sets and functions can be included which
can be displayed in the same as well as in different data windows.

Authors:
--------
    Werner Stille <kpl@werner-stille.de>

%package devel
Summary:        Developer Package for Kpl
%if 0%{?suse_version} || 0%{?sles_version}
Group:          Development/Libraries/KDE
%else
Group:          Development/Libraries
%endif
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use the shared library of Kpl.

Kpl is a KDE program for two- and three-dimensional graphical presentation
of data sets and functions. Multidimensional nonlinear parameter fits of
functions to data sets can be performed using the Levenberg-Marquardt
algorithm. Also general linear least square parameter fits are possible.

Authors:
--------
    Werner Stille <kpl@werner-stille.de>

%package devel-doc
Summary:        Developer Documentation Package for Kpl
%if 0%{?suse_version} || 0%{?sles_version}
Group:          Documentation/HTML
BuildRequires:  doxygen graphviz graphviz-gd graphviz-gnome
%else
Group:          Documentation
BuildRequires:  doxygen graphviz
%endif
BuildArch:      noarch

%description devel-doc
The %{name}-devel-doc package contains the API documentation of the shared
library of Kpl.

Kpl is a KDE program for two- and three-dimensional graphical presentation
of data sets and functions. Multidimensional nonlinear parameter fits of
functions to data sets can be performed using the Levenberg-Marquardt
algorithm. Also general linear least square parameter fits are possible.

Authors:
--------
    Werner Stille <kpl@werner-stille.de>

%if %{with debuginfo}
%debug_package
%endif

%prep
%setup -q -n %{name}
%patch 0 -p1
%patch 1 -p1


%build
%if 0%{?suse_version} || 0%{?sles_version}
mkdir -p build
pushd build
%cmake_kf5 ..
%cmake_build
popd
%else
%cmake_kf5
%cmake_build
%endif


%install
rm -rf %{buildroot}
%cmake_install
%if 0%{?suse_version} || 0%{?sles_version}
%find_lang %{name} --without-kde --all-name
%kf5_post_install
%else
%find_lang %{name} --all-name
%endif


%check
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
desktop-file-validate %{buildroot}%{_kf5_datadir}/applications/kpl.desktop
%endif

%post
/sbin/ldconfig
%if 0%{?suse_version} || 0%{?sles_version}
update-mime-database %{_kf5_sharedir}/mime >/dev/null || :
%else
update-desktop-database -q &> /dev/null
touch --no-create %{_kf5_datadir}/mime/packages &>/dev/null
update-mime-database %{?fedora:-n} %{_kf5_datadir}/mime &> /dev/null
touch --no-create %{_kf5_datadir}/icons/hicolor &> /dev/null
gtk-update-icon-cache %{_kf5_datadir}/icons/hicolor &> /dev/null || :
%endif

%postun
/sbin/ldconfig
%if 0%{?suse_version} || 0%{?sles_version}
update-mime-database %{_kf5_sharedir}/mime >/dev/null || :
%else
update-desktop-database -q &> /dev/null
if [ $1 -eq 0 ] ; then
  update-mime-database %{_kf5_datadir}/mime >/dev/null
  touch --no-create %{_kf5_datadir}/icons/hicolor &> /dev/null
  gtk-update-icon-cache %{_kf5_datadir}/icons/hicolor &> /dev/null || :
fi
%endif


%files -f %{name}.lang
%defattr(-,root,root)
%doc ChangeLog COPYING AUTHORS README
%{_kf5_bindir}/%{name}
%{_kf5_libdir}/libkpl.so.*

%if 0%{?suse_version} || 0%{?sles_version}
%{_kf5_plugindir}/%{name}
%{_kf5_applicationsdir}/%{name}.desktop
%{_kf5_iconsdir}/*/*/actions/*
%{_kf5_iconsdir}/*/*/apps/%{name}.*
%{_kf5_iconsdir}/*/*/mimetypes/application-x-%{name}-plot.*
%{_kf5_kxmlguidir}/
%{_kf5_notifydir}/
%{_kf5_configkcfgdir}/
%{_kf5_dbusinterfacesdir}/org.kde.Kpl.xml
%{_kf5_sharedir}/dbus-1/services/org.kde.kpl.service
%{_kf5_sharedir}/mime/packages/x-kpl-plot.xml
%{_kf5_htmldir}/*/%{name}
%else
%{_kf5_qtplugindir}/%{name}
%{_kf5_datadir}/applications/%{name}.desktop
%{_kf5_datadir}/icons/*/*/actions/*
%{_kf5_datadir}/icons/*/*/apps/%{name}.*
%{_kf5_datadir}/icons/*/*/mimetypes/application-x-%{name}-plot.*
%{_kf5_datadir}/kxmlgui5/%{name}/
%{_kf5_datadir}/knotifications5/
%{_kf5_datadir}/config.kcfg/
%{_kf5_datadir}/dbus-1/interfaces/org.kde.Kpl.xml
%{_kf5_datadir}/dbus-1/services/org.kde.kpl.service
%{_kf5_datadir}/mime/packages/x-kpl-plot.xml
%{_kf5_docdir}/HTML/*/%{name}
%endif

%files devel
%defattr(-,root,root)
%doc COPYING
%{_includedir}/kpl
%{_kf5_libdir}/libkpl.so

%files devel-doc
%defattr(-,root,root)
%doc COPYING
%if 0%{?suse_version} || 0%{?sles_version}
%{_kf5_htmldir}/en/kpl-apidocs
%else
%{_kf5_docdir}/HTML/en/kpl-apidocs
%endif


%changelog
* Tue Jun 04 2024 - Werner Stille <kpl@werner-stille.de>
- patched to allow export to image files with spaces in filenames
* Tue Jun 21 2022 - Werner Stille <kpl@werner-stille.de>
- patched to use python3 in demo1.py
* Sun Jan 08 2017 - Werner Stille <kpl@werner-stille.de>
- 5.0-1
* Sun Jun 21 2015 - Werner Stille <kpl@werner-stille.de>
- 4.1-1
* Tue Jun 14 2011 - Werner Stille <kpl@werner-stille.de>
- new version 4.0
openSUSE Build Service is sponsored by