File octave.spec of Package octave

#
# spec file for package octave
#
# 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/
#


# Use native graphics or gnuplot
%define with_native_graphics 1
# Build GUI
%if 0%{?suse_version} > 1110
%define with_gui 1
%else
%define with_gui 0
%endif
# JIT support
# Works only on x86 and x86_64
%ifarch %ix86 x86_64
%define with_jit 1
%else
%define with_jit 0
%endif
# old versions don't contain llvm
%if 0%{?suse_version} < 1210
%define with_jit 0
%endif
# JAVA support
%define with_java 1

Name:           octave
Version:        3.8.2
Release:        0
Summary:        A High Level Programming Language
License:        GPL-3.0+
Group:          Productivity/Scientific/Math
%define apiver  v49+
Url:            http://www.octave.org/
Source:         ftp://ftp.gnu.org/gnu/octave/%{name}-%{version}.tar.bz2
Source2:        octave.pc.in
# PATCH-FIX-UPSTREAM octave-3.8.0-llvm-3.4.patch https://savannah.gnu.org/bugs/?41061
Patch1:         octave-3.8.0-llvm-3.4.patch
BuildRequires:  arpack-ng-devel
BuildRequires:  bison
BuildRequires:  blas-devel
BuildRequires:  dejagnu
BuildRequires:  fftw3-threads-devel
BuildRequires:  flex
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  gl2ps-devel
BuildRequires:  glpk-devel
BuildRequires:  gmp-devel
BuildRequires:  gnuplot
BuildRequires:  gperf
BuildRequires:  hdf5-devel
%if 0%{?with_java}
BuildRequires:  java-devel
%endif
BuildRequires:  lapack-devel
%if 0%{?suse_version} > 1110
BuildRequires:  libGraphicsMagick++-devel
%else
BuildRequires:  libMagick++-devel
%endif
BuildRequires:  libcurl-devel
BuildRequires:  liblcms-devel
%if 0%{?with_gui}
BuildRequires:  libqscintilla-devel
BuildRequires:  libqt4-devel
%endif
%if 0%{?with_jit}
BuildRequires:  llvm-devel
%endif
BuildRequires:  pcre-devel
BuildRequires:  pkg-config
BuildRequires:  qhull-devel
BuildRequires:  qrupdate-devel
BuildRequires:  readline-devel
BuildRequires:  suitesparse-devel
BuildRequires:  termcap
BuildRequires:  texinfo
%if 0%{?suse_version} > 1220
BuildRequires:  texlive-dvips
%endif
BuildRequires:  texlive-latex
BuildRequires:  xorg-x11-libSM-devel
BuildRequires:  xorg-x11-libX11-devel
BuildRequires:  xorg-x11-libXext-devel
BuildRequires:  zlib-devel
%if 0%{?with_native_graphics}
# for native graphics
%if 0%{?suse_version} > 1220
BuildRequires:  glu-devel
%endif
BuildRequires:  Mesa-devel
BuildRequires:  fltk-devel
BuildRequires:  fontconfig-devel
BuildRequires:  xorg-x11-devel
%else
Requires:       gnuplot
%endif
Requires:       makeinfo
Recommends:     blas-devel
Recommends:     fftw3-devel
Recommends:     fftw3-threads-devel
Recommends:     gcc
Recommends:     gcc-fortran
Recommends:     hdf5-devel
Recommends:     make
Recommends:     octave-devel = %{version}
Recommends:     octave-doc = %{version}
%if 0%{?with_gui}
Recommends:     octave-gui = %{version}
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Octave is a high level programming language. It is designed for the
solution of numeric problems. There is a command line interface
supplied.

%if 0%{?with_gui}
%package        gui
Summary:        Graphical user interface for Octave
Group:          Productivity/Scientific/Math

%description    gui
Octave is a high level programming language. It is designed for the
solution of numeric problems.

This package contains official graphical user interface.
%endif

%package        devel
Summary:        Development files for Octave
Group:          Productivity/Scientific/Math
Requires:       %{name} = %{version}

%description    devel
Octave is a high level programming language. It is designed for the
solution of numeric problems.

This package contains all necessary include files and libraries needed
to develop applications using Octave.

%package        doc
Summary:        Documentation for Octave
Group:          Documentation/Other
Requires:       %{name} = %{version}
%if 0%{?suse_version} > 1110
BuildArch:      noarch
%endif

%description    doc
Octave is a high level programming language. It is designed for the
solution of numeric problems.

This package contains documentation for Octave.

%prep
%setup -q

%if %{?with_jit} == 1
%if %( echo `rpm -q --queryformat %%{version} llvm-devel`| tr -d '.' ) > 33
%patch1 -p1
%endif
%endif

%build
export CPPFLAGS="-DH5_USE_16_API"
%configure \
  --libexecdir=%{_libdir} \
  %if %{?with_gui} == 0
  --disable-gui \
  %endif
  %if %{?with_jit} == 1
  --enable-jit \
  %endif
  %if %{?with_java} == 0
  --disable-java \
  %endif
  --enable-openmp

make %{?_smp_mflags}

# .pc file
cp %{SOURCE2} octave.pc
sed -i 's:@VERSION@:%{version}:' octave.pc
sed -i 's:@LIB@:%{_lib}:' octave.pc

%install
%make_install
# see bnc#557340
mkdir -p %{buildroot}/%{_sysconfdir}/ld.so.conf.d
echo %{_libdir}/%{name}/%{version} > %{buildroot}/%{_sysconfdir}/ld.so.conf.d/%{name}.conf
rm %{buildroot}/%{_libdir}/%{name}/%{version}/*.la
# local rc file into /etc
mkdir %{buildroot}/%{_sysconfdir}/%{name}
mv %{buildroot}/%{_datadir}/%{name}/site/m/startup/octaverc %{buildroot}/%{_sysconfdir}/%{name}
ln -s %{_sysconfdir}/%{name}/octaverc %{buildroot}/%{_datadir}/%{name}/site/m/startup/octaverc
#
mkdir -p %{buildroot}/%{_libdir}/%{name}/packages
mkdir -p %{buildroot}/%{_datadir}/%{name}/packages
# .pc file
mkdir -p %{buildroot}/%{_libdir}/pkgconfig
cp octave.pc %{buildroot}/%{_libdir}/pkgconfig

%check
make check

%post
/sbin/ldconfig
%install_info --info-dir=%{_infodir} %{_infodir}/octave.info.gz

%postun
/sbin/ldconfig
%install_info_delete --info-dir=%{_infodir} %{_infodir}/octave.info.gz

%if 0%{?with_gui}
%post gui
/sbin/ldconfig

%postun gui
/sbin/ldconfig
%endif

%files
%defattr(-,root,root,-)
%doc AUTHORS BUGS COPYING NEWS
%doc README ChangeLog
%doc %{_infodir}/*.gz
%doc %{_mandir}/man1/*.gz
%{_bindir}/octave
%{_bindir}/octave-%{version}
%{_bindir}/octave-cli
%{_bindir}/octave-cli-%{version}
%{_bindir}/mkoctfile
%{_bindir}/mkoctfile-%{version}
%{_bindir}/octave-config
%{_bindir}/octave-config-%{version}
%config %{_sysconfdir}/ld.so.conf.d/%{name}.conf
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{version}
%dir %{_libdir}/%{name}/packages
%dir %{_datadir}/%{name}/packages
%dir %{_sysconfdir}/%{name}
%{_libdir}/%{name}/%{version}/oct
%{_libdir}/%{name}/%{version}/liboctave.so.*
%{_libdir}/%{name}/%{version}/liboctinterp.so.*
%if 0%{?with_gui}
%dir %{_libdir}/%{name}/%{version}/exec/
%dir %{_libdir}/%{name}/%{version}/exec/*-suse-linux-gnu*/
%exclude %{_datadir}/%{name}/%{version}/locale/
%endif
%{_datadir}/octave/
%{_libdir}/%{name}/site
%config(noreplace) %{_sysconfdir}/%{name}/octaverc
%{_libdir}/pkgconfig/octave.pc

%if 0%{?with_gui}
%files gui
%defattr(-,root,root)
%{_libdir}/%{name}/%{version}/exec/*-suse-linux-gnu*/octave-gui
%{_libdir}/%{name}/%{version}/liboctgui.so.*
%{_datadir}/%{name}/%{version}/locale/
%endif

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/%{name}/%{version}/lib*.so
%{_libdir}/%{name}/api-%{apiver}

%files doc
%defattr(-,root,root)
%doc doc/interpreter/octave.pdf
%doc doc/liboctave/liboctave.pdf
%doc doc/refcard/refcard-a4.pdf
%doc doc/refcard/refcard-legal.pdf

%changelog
openSUSE Build Service is sponsored by