File cantor.spec of Package cantor

#
# spec file for package cantor
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


%global libMAJOR 1

Name:           cantor
Version:        4.14.2
Release:        0
Summary:        Worksheet GUI for mathematical software
License:        GPL-2.0+
Group:          Amusements/Teaching/Mathematics
Url:            http://edu.kde.org
Source0:        %{name}-%{version}.tar.xz
Patch0:         %{name}-bko296546.patch
BuildRequires:  R-base-devel
%if 0%{?suse_version} > 1230
BuildRequires:  R-base
%endif
BuildRequires:  analitza-devel
BuildRequires:  fdupes
BuildRequires:  gcc-fortran
BuildRequires:  help2man
BuildRequires:  libkde4-devel
BuildRequires:  libqalculate-devel
BuildRequires:  libspectre-devel
%if 0%{?suse_version} > 1310
BuildRequires:  luajit-devel
%endif
BuildRequires:  perl
BuildRequires:  python-devel
BuildRequires:  xz
Recommends:     maxima
Recommends:     octave
Provides:       kde4-cantor = 4.3.0
Obsoletes:      kde4-cantor < 4.3.0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%kde4_runtime_requires

%description
A frontend to several existing mathematical software such as R, Sage
and Maxima: Cantor. Cantor offers a worksheet as a nice GUI for all
those backends and is not targeted to kids but to scientists.

%package devel
Summary:        Worksheet GUI for mathematical software
Group:          Development/Libraries/KDE
Requires:       libcantorlibs%{libMAJOR} = %{version}

%description devel
A frontend to several existing mathematical software such as R, Sage
and Maxima: Cantor. Cantor offers a worksheet as a nice GUI for all
those backends and is not targeted to kids but to scientists.

%package -n libcantorlibs%{libMAJOR}
Summary:        Shared libraries for Cantor
Group:          System/Libraries

%description -n libcantorlibs%{libMAJOR}
Shared libraries for package cantor.

%prep
%setup -q
%patch0 -p1
mkdir .doc
cd src/backends
for d in *
do ! ln -T "${d}/DESIGN" "../../.doc/${d}"
done

%build
%ifarch ppc ppc64
export RPM_OPT_FLAGS="%{optflags} -mminimal-toc"
%endif
# bnc#753292
  %{lua: z = rpm .expand ("%cmake_kde4 -d build")
    f, t = string .find (z, "-DCMAKE_SKIP_RPATH=ON", 0, true)
    print (string .sub (z, 0, f - 01), "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON", string .sub (z, t + 01)) }
  %make_jobs
  # generate manual pages for cantor
  ! mkdir man1
  for a in cantor
  do m="man1/${a}.1" 
     help2man>"${m}" "src/${a}.shell"
     gzip "${m}"
  done
  for a in cantor_rserver
  do m="man1/${a}.1"
     R>"${m}" CMD help2man "src/backends/R/rserver/${a}.shell"
     gzip "${m}"
  done

%install
  cd build
  %kde4_makeinstall
  for m in '%{buildroot}%{_mandir}/man1'
  do install -d "${m}"
     install "-t${m}" -ma=r man1/*
  done
  cd ..
  %kde_post_install

%post -n libcantorlibs%{libMAJOR} -p /sbin/ldconfig

%postun -n libcantorlibs%{libMAJOR} -p /sbin/ldconfig

%files devel
%defattr(-,root,root)
%doc COPYING
%{_kde4_libdir}/libcantorlibs.so
%{_kde4_includedir}/cantor/

%files
%defattr(-,root,root)
%doc COPYING COPYING.DOC README TODO DESIGN .doc/*
%doc %{_kde4_htmldir}/en/cantor/
%doc %{_mandir}/man1/*
%dir %{_kde4_datadir}/appdata
%{_kde4_applicationsdir}/cantor.desktop
%{_kde4_appsdir}/cantor/
%{_kde4_bindir}/cantor
%{_kde4_bindir}/cantor_rserver
%{_kde4_configdir}/cantor*.knsrc
%{_kde4_configkcfgdir}/*.kcfg
%{_kde4_datadir}/appdata/cantor.appdata.xml
%{_kde4_iconsdir}/hicolor/*/apps/*
%{_kde4_libdir}/libcantor_config.so
%{_kde4_servicesdir}/cantor/
%{_kde4_servicetypesdir}/cantor*

%files -n libcantorlibs%{libMAJOR}
%defattr(-,root,root)
%doc COPYING
%{_kde4_libdir}/libcantorlibs.so.*
%{_kde4_modulesdir}/cantor*so
%{_kde4_modulesdir}/libcantor*so

%changelog
openSUSE Build Service is sponsored by