# -*- mode: rpm-spec -*-

# By default, this spec file will generate RPMs for Clisp, CMUCL
# and GCL. This can be changed by modifying the variables below.
%define enable_clisp 1
%define clisp_flags --enable-clisp
%define enable_cmucl 0
%define cmucl_flags --disable-cmucl
%define enable_gcl 0
%define gcl_flags --disable-gcl

# Inhibit automatic compressing of info files. Compressed info
# files break maxima's internal help.
%define __spec_install_post /bin/true

Summary: Maxima Symbolic Computation Program
Summary(ja): 数式処理プログラム Maxima
Name: maxima
Version: 5.36.1
Release: 1%{?_dist_release}
License: GPL
Group: Applications/Engineering
URL: http://maxima.sourceforge.net
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: texinfo
Requires: maxima_exec = %{version}-%{release}
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info

%description
Maxima is a full symbolic computation program.  It is full featured
doing symbolic manipulation of polynomials, matrices, rational
functions, integration, Todd-coxeter, graphing, bigfloats.  It has a
symbolic debugger source level debugger for maxima code.  Maxima is
based on the original Macsyma developed at MIT in the 1970's.  It is
quite reliable, and has good garbage collection, and no memory leaks.
It comes with hundreds of self tests.

%description -l ja
Maxima は高機能な数式処理プログラムです。Maximaを使えば、多項式、行列、
有理関数、積分、Todd-coxeter、グラフ描画、高精度浮動小数点といった演算
も簡単にこなせます。Maxima のコードに対応したソースレベルの数式デバッ
ガも備えています。Maxima は MIT で1970年台に開発されたオリジナルの 
Macsyma がベースとなっています。Maxima はとても信頼性が高く、すぐれた
ガーベッジコレクションを搭載しており、メモリリークを起こしません。この
信頼性は、数百件に及ぶセルフテストによってもたらされたものです。

%package xmaxima
Summary: Tcl/Tk interface to Maxima
Summary(ja): Maxima 用 Tcl/Tk インターフェース
Group: Applications/Engineering
Requires: %{name} = %{version}-%{release}
Requires: tk > 8.1
Provides: xmaxima

%description xmaxima
Tcl/Tk interface to Maxima.

%if %{enable_clisp}
%package exec-clisp
Summary: Maxima compiled with clisp
Group: Applications/Engineering
Requires: clisp
BuildRequires: clisp
Provides: maxima_exec
%description exec-clisp
Maxima compiled with clisp.
%endif

%if %{enable_cmucl}
%package exec-cmucl
Summary: Maxima compiled with CMUCL
Group: Applications/Engineering
Requires: cmucl
BuildRequires: cmucl
Provides: maxima_exec
%description exec-cmucl
Maxima compiled with CMUCL.
%endif

%if %{enable_gcl}
%package exec-gcl
Summary: Maxima compiled with GCL
Group: Applications/Engineering
Requires: gcl
BuildRequires: gcl
Provides: maxima_exec
%description exec-gcl
Maxima compiled with Gnu Common Lisp.
%endif

%prep
%setup -q
%configure  %{?cmucl_flags:} %{?gcl_flags:} %{?clisp_flags:}

%build
%__make

%install
%__rm -rf %{buildroot}
%makeinstall

rm -f $RPM_BUILD_ROOT%{_infodir}/dir

%post
/sbin/install-info %{_infodir}/maxima.info %{_infodir}/dir

%preun
if [ "$1" = 0 ]; then
	/sbin/install-info --delete %{_infodir}/maxima.info %{_infodir}/dir
fi

%clean
%__rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{_datadir}/maxima/%{version}
%dir %{_libdir}/maxima/%{version}
%{_libexecdir}/maxima/%{version}
%{_infodir}/*
%{_mandir}/man1/*
%{_bindir}/*
%doc AUTHORS COPYING ChangeLog INSTALL* NEWS README*

%files xmaxima
%{_bindir}/xmaxima

%if %{enable_clisp}
%files exec-clisp
%{_libdir}/maxima/%{version}/binary-clisp
%endif

%if %{enable_cmucl}
%files exec-cmucl
%{_libdir}/maxima/%{version}/binary-cmucl
%endif

%if %{enable_gcl}
%files exec-gcl
%{_libdir}/maxima/%{version}/binary-gcl
%endif

%changelog
* Fri Jul 31 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.36.1-1
- update to 5.36.1
- add BuildRequires: texinfo

* Sat Mar 06 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.16.3-2
- rebuilt with new toolchain, libsigsev-2.8 and clisp-2.48

* Sun Oct 05 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.16.3-1vl5
- new upstream release

* Sat Oct 04 2008 Shu KONNO <owa@bg.wakwak.com> 5.11.0-1vl5
- applied new versioning policy, spec in utf-8

* Mon Mar 19 2007 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 5.11.0-0vl1
- New upstream release
- Change Group

* Fri May 20 2005 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 5.9.1-0vl2
- Japanese Summary and description by rpmSpecTranslate project

* Sat Apr 23 2005 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 5.9.1-0vl1
- New upstream release (for diff() bug fix)
- Tidy up spec file

* Sun Feb  1 2004 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 5.9.0-0vl4
- Change Requires and BuildPreReq clisp (= 2.29 -> >= 2.29)

* Sat Aug  2 2003 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 5.9.0-0vl3
- Add exec-clisp BuildPreReq clisp
- Add xmaxima Requires tk > 8.1
- Remove xmaxima-olderTcl patch

* Fri Jun  6 2003 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> 5.9.0-0vl2
- Rebuild for clisp-2.29-0vl1

* Fri May 30 2003 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> 5.9.0-0vl1
- Enable clisp only, disable cmucl and gcl
- Add xmaxima-olderTcl patch (for tclversion older than 8.1)
- Remove %{_infodir}/dir file

* Sat Jan  4 2003 James Amundson <amundson@fnal.gov>
- Added doc files
- Added explicit clisp version
- Added conditional to postun
- Renamed exec_* packages to exec-*
- Use rpm macros instead of hard-coded paths
- Thanks to Rex Dieter for helpful suggestions

* Sun Sep  8 2002 James Amundson <amundson@fnal.gov> 
- Initial build.
