Blob Blame History Raw
%global __provides_exclude_from	.*/site-packages/.*\\.so

%bcond_without bundled_pari
%bcond_with bundled_pexpect

# for faster full rpm test builds
%ifarch %{ix86} x86_64
%bcond_without docs
%else
%bcond_with docs
%endif

# not functional due to missing jar dependencies
%bcond_with sage3d

# use an workaround to match upstream sagemath patched sphinx
%bcond_without sphinx_hack

# use workaround to match upstream sagemath patched cython
%bcond_without cython_hack

%ifarch x86_64
%bcond_without fes
%else
%bcond_with fes
%endif

# switch to run make -testall
%bcond_with check
%global SAGE_TIMEOUT		60
%global SAGE_TIMEOUT_LONG	180

%global conway_polynomials_pkg	conway_polynomials-0.4
%global cysignals_pkg		cysignals-1.1.1
%global	elliptic_curves_pkg	elliptic_curves-0.8
%global	flintqs_pkg		flintqs-1.0
%global graphs_pkg		graphs-20151224
%if %{with bundled_pari}
%global pari_pkg		pari-2.8-2771-gb70b447
%endif
%if %{with bundled_pexpect}
%global pexpect_pkg		pexpect-4.1.0
%endif
%global polytopes_db_pkg	polytopes_db-20120220
%global rubiks_pkg		rubiks-20070912
%global	sagenb_pkg		sagenb-0.13
%global sagetex_pkg		sagetex-3.0

%global SAGE_ROOT		%{_libdir}/sagemath
%global SAGE_LOCAL		%{SAGE_ROOT}/local
%global SAGE_SRC		%{SAGE_ROOT}/src
%global SAGE_DOC		%{_docdir}/%{name}
%global SAGE_SHARE		%{_datadir}/sagemath
%global SAGE_ETC		%{SAGE_SHARE}/etc
%global SAGE_PYTHONPATH		%{SAGE_ROOT}/site-packages
%global SAGE_SPKG_INST		%{SAGE_LOCAL}/var/lib/sage/installed

Name:		sagemath
Group:		Applications/Engineering
Summary:	A free open-source mathematics software system
Version:	7.3
Release:	7%{?dist}
# The file ${SAGE_ROOT}/COPYING.txt is the upstream license breakdown file
# Additionally, every $files section has a comment with the license name
# before files with that license
License:	ASL 2.0 and BSD and GPL+ and GPLv2+ and LGPLv2+ and MIT and Public Domain
URL:		http://www.sagemath.org
Source0:	http://boxen.math.washington.edu/home/%{name}/sage-mirror/src/sage-%{version}.tar.gz
Source1:	gprc.expect
Source2:	makecmds.sty
# Follow maxima's ExclusiveArch
ExclusiveArch: aarch64 %{arm} %{ix86} x86_64 ppc sparcv9

# Upstream uses mpir not gmp, but the rpm package is tailored to use gmp
Patch1:		%{name}-gmp.patch

# Set of patches to work with system wide packages
Patch2:		%{name}-scripts.patch

# remove call to not implemented sagemath "is_package_installed" interfaces
# need to package coin-or solver in fedora
# remove check for non free solvers
Patch3:		%{name}-extensions.patch

# helper to:
#	o respect a DESTDIR environment variable
#	o avoid double '//' in pathnames, what can confused debugedit & co
#	o minor change to help in incremental builds by avoiding rebuilding
#	  files
#	o do not assume there is an installed sagemath
Patch4:		%{name}-rpmbuild.patch

# build documentation in buildroot environment
Patch5:		%{name}-sagedoc.patch

# sage notebook rpm and system environment adjustments
Patch6:		%{name}-sagenb.patch

# do not attempt to create state files in system directories
Patch7:		%{name}-readonly.patch

# work with all maxima-runtime lisp backend packages
Patch8:		%{name}-maxima.patch

# execute 4ti2 programs in $PATH not in $SAGE_ROOT/local/bin
Patch9:		%{name}-4ti2.patch

# http://trac.sagemath.org/sage_trac/ticket/12992
# http://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=1317
Patch10:	%{name}-pari.patch

# use jmol itself to export preview images
# FIXME besides not using X and told so, fails if DISPLAY is not set
Patch11:	%{name}-jmol.patch

# only cremona mini database built and installed
# FIXME add a package with the full cremona database
# FIXME actually it should be already available in pari-elldata
Patch12:	%{name}-cremona.patch

# lrslib is a requires
Patch13:	%{name}-lrslib.patch

# correct path to the nauty geng program
# http://cs.anu.edu.au/~bdm/nauty/
# http://pallini.di.uniroma1.it/
Patch14:	%{name}-nauty.patch

# gap hap package not (yet) available
# http://www-gap.mcs.st-and.ac.uk/Packages/hap.html
Patch15:	%{name}-gap-hap.patch

# correct path to Lfunction include
Patch16:	%{name}-lcalc.patch

# avoid assertion in coin backend
Patch17:	%{name}-cbc.patch

# Use system gap directories
Patch18:	%{name}-libgap.patch

# Build fes
Patch19:	%{name}-fes-build.patch
# Disable fes
Patch20:	%{name}-fes.patch

# Side effect of using distro packages
# https://bugzilla.redhat.com/show_bug.cgi?id=974769
Patch21:	%{name}-sympy.patch

# Fix a name clash with NTL
Patch22:	%{name}-ntl.patch

# Correct unable to start QEPCAD within sage
# https://bugzilla.redhat.com/show_bug.cgi?id=1243590
Patch23:	%{name}-qepcad.patch

# Correct path to arb headers
Patch24:	%{name}-arb.patch

# Adapt to header file changes in givaro 4 and linbox 1.4
Patch25:	%{name}-givaro.patch

# No support for f" notation
Patch26:	%{name}-nofstring.patch

# Add missing include paths
Patch27:	%{name}-includes.patch

# https://trac.sagemath.org/ticket/20926
# #error This file requires compiler and library support for the ISO C++ \
#	2011 standard. This support must be enabled with the -std=c++11 \
#	or -std=gnu++11 compiler options.
Patch28:	%{name}-gcc6.patch

# Use ipython3 (mostly a rediff from sagemath-6.8 sage/repl)
Patch29:	%{name}-ipython3.patch

# Use atlas blas
Patch30:	%{name}-atlas.patch

# Correct side effect of sagemath-ipython3 patch
Patch31:	%{name}-is_in_terminal.patch

# Update for python-flask-0.11.1
Patch32:	%{name}-flask.patch

# Corrections to build in latest f25 and rawhide
Patch33:	%{name}-ftbfs.patch

BuildRequires:	4ti2
BuildRequires:	arb-devel
BuildRequires:	atlas-devel
BuildRequires:	brial-devel
BuildRequires:	cddlib-tools
BuildRequires:	cliquer-devel
BuildRequires:	coin-or-Cbc-devel
BuildRequires:	cryptominisat-devel
BuildRequires:	Cython >= 0.24.1
BuildRequires:	desktop-file-utils
BuildRequires:	dos2unix
BuildRequires:	dvipng
BuildRequires:	ecl
BuildRequires:	eclib-devel
BuildRequires:	factory-devel
%if %{with fes}
BuildRequires:	fes-devel
%endif
BuildRequires:	flint-devel
BuildRequires:	gmp-ecm-devel
BuildRequires:	gap
BuildRequires:	GAPDoc
BuildRequires:	gap-libs
BuildRequires:	gap-pkg-atlasrep
BuildRequires:	gap-pkg-ctbllib
BuildRequires:	gap-pkg-design
BuildRequires:	gap-pkg-guava
BuildRequires:	gap-pkg-hap
BuildRequires:	gap-pkg-sonata
BuildRequires:	gap-pkg-tomlib
BuildRequires:	gc-devel
BuildRequires:	gcc-c++
BuildRequires:	gd-devel
BuildRequires:	gfan
BuildRequires:	glpk-devel
BuildRequires:	gnutls-devel
BuildRequires:	gsl-devel
BuildRequires:	iml-devel
# To have a proper link
BuildRequires:	jsmol
BuildRequires:	L-function-devel
BuildRequires:	lapack-devel
BuildRequires:	libfac-devel
BuildRequires:	libfplll-devel
BuildRequires:	libgap-devel
BuildRequires:	libmpc-devel
BuildRequires:	linbox-devel
BuildRequires:	lrcalc-devel
BuildRequires:	m4ri-devel
BuildRequires:	m4rie-devel
BuildRequires:	maxima-runtime-ecl
BuildRequires:	mpfi-devel
BuildRequires:	nauty
BuildRequires:	ntl-devel
BuildRequires:	numpy
BuildRequires:	palp
%if %{without bundled_pari}
BuildRequires:	pari-devel
BuildRequires:	pari-gp
%endif
BuildRequires:	planarity-devel
BuildRequires:	ppl-devel
BuildRequires:	pynac-devel
BuildRequires:	python2-devel
BuildRequires:	python-flask-autoindex
BuildRequires:	python-flask-babel
BuildRequires:	python-flask-openid
BuildRequires:	python-flask-silk
BuildRequires:	python-ipython
BuildRequires:	python-matplotlib
BuildRequires:	python-networkx
%if %{without bundled_pexpect}
BuildRequires:	python-pexpect
%endif
BuildRequires:	python-pkgconfig
BuildRequires:	python-sphinx
BuildRequires:	python-twisted
BuildRequires:	python-twisted-web
BuildRequires:	R
BuildRequires:	ratpoints-devel
BuildRequires:	readline-devel
BuildRequires:	rpy
BuildRequires:	rw-devel
BuildRequires:	scons
BuildRequires:	Singular-devel
BuildRequires:	stix-math-fonts
BuildRequires:	symmetrica-devel
BuildRequires:	sympow
BuildRequires:	sympy
BuildRequires:	texlive
# For _jsdir macro
BuildRequires:	web-assets-devel
BuildRequires:	zn_poly-devel

Requires:	4ti2
Requires:	apache-commons-cli
Requires:	cddlib-tools
Requires:	Cython
Requires:	ecl
Requires:	firefox
Requires:	gap
Requires:	GAPDoc
Requires:	gap-libs
Requires:	gap-pkg-atlasrep
Requires:	gap-pkg-ctbllib
Requires:	gap-pkg-design
Requires:	gap-pkg-guava
Requires:	gap-pkg-hap
Requires:	gap-pkg-sonata
Requires:	gap-pkg-tomlib
Requires:	genus2reduction
Requires:	gfan
Requires:	gmp-ecm
Requires:	jmol
Requires:	jsmol
Requires:	jsmath-fonts
Requires:	lrslib-utils
Requires:	maxima-gui
Requires:	mathjax
Requires:	maxima-runtime-ecl
Requires:	nauty
Requires:	palp
Requires:	pari-gp
Requires:	python-brial
Requires:	python-crypto
Requires:	python-cvxopt
Requires:	python-docutils
Requires:	python-flask-autoindex
Requires:	python-flask-babel
Requires:	python-flask-openid
Requires:	python-flask-silk
Requires:	python-ipython
Requires:	python-matplotlib
Requires:	python-networkx
%if %{without bundled_pexpect}
Requires:	python-pexpect
%endif
Requires:	python-sphinx
Requires:	python-speaklater
Requires:	python-twisted
Requires:	python-twisted-mail
Requires:	python-twisted-web
Requires:	python-ZODB3
Requires:	qepcad-B
Requires:	R
Requires:	rpy
Requires:	%{name}-core
Requires:	%{name}-data
%if %{with docs}
Requires:	%{name}-doc-en
%endif
Requires:	%{name}-notebook
Requires:	%{name}-rubiks
Requires:	%{name}-sagetex
Requires:	Singular
Requires:	stix-math-fonts
Requires:	sympow
Requires:	sympy
Requires:	tachyon
Requires:	texlive
Requires:	vecmath

%description
Sage is a free open-source mathematics software system licensed
under the GPL. It combines the power of many existing open-source
packages into a common Python-based interface.

#------------------------------------------------------------------------
%package	core
Summary:	Open Source Mathematics Software
Group:		Applications/Engineering
Requires:	%{name}%{?_isa} = %{version}-%{release}
Obsoletes:	%{name}-devel < 6.8-1

%description	core
This package contains the core sagemath python modules.

#------------------------------------------------------------------------
%package	data
Summary:	Databases and scripts for %{name}
Group:		Applications/Engineering
Requires:	%{name} = %{version}-%{release}
Requires:	%{name}-data-conway_polynomials = %{version}-%{release}
Requires:	%{name}-data-elliptic_curves = %{version}-%{release}
Requires:	%{name}-data-etc = %{version}-%{release}
Requires:	%{name}-data-graphs = %{version}-%{release}
Requires:	%{name}-data-polytopes_db = %{version}-%{release}
BuildArch:	noarch

%description	data
Collection of databases and interface customization scripts for sagemath.

#------------------------------------------------------------------------
%package	data-conway_polynomials
Summary:	Conway Polynomials Database
Group:		Applications/Engineering
Requires:	%{name}-data = %{version}-%{release}
BuildArch:	noarch

%description	data-conway_polynomials
Small database of Conway polynomials for sagemath.

#------------------------------------------------------------------------
%package	data-elliptic_curves
Summary:	Databases of elliptic curves
Group:		Applications/Engineering
Requires:	%{name}-data = %{version}-%{release}
BuildArch:	noarch

%description	data-elliptic_curves
Includes two databases:

 * A small subset of the data in John Cremona's database of elliptic curves up
   to conductor 10000. See http://www.warwick.ac.uk/~masgaj/ftp/data/ or
   http://sage.math.washington.edu/cremona/INDEX.html

 * William Stein's database of interesting curves

#------------------------------------------------------------------------
%package	data-etc
Summary:	Extcode for Sagemath
Group:		Applications/Engineering
Requires:	%{name}-data = %{version}-%{release}
Obsoletes:      %{name}-data-extcode < %{version}
BuildArch:	noarch

%description	data-etc
Collection of scripts and interfaces to sagemath.

#------------------------------------------------------------------------
%package	data-graphs
Summary:	Sagemath database of graphs
Group:		Applications/Engineering
Requires:	%{name}-data = %{version}-%{release}
BuildArch:	noarch

%description	data-graphs
A database of graphs. Created by Emily Kirkman based on the work of Jason
Grout. Since April 2012 it also contains the ISGCI graph database.

#------------------------------------------------------------------------
%package	data-polytopes_db
Summary:	Lists of 2- and 3-dimensional reflexive polytopes
Group:		Applications/Engineering
Requires:	%{name}-data = %{version}-%{release}
BuildArch:	noarch

%description	data-polytopes_db
The list of polygons is quite easy to get and it has been known for a while.
The list of 3-polytopes was originally obtained by Maximilian Kreuzer and
Harald Skarke using their software PALP, which is included into the standard
distribution of Sage. To work with lattice and reflexive polytopes from Sage
you can use sage.geometry.lattice_polytope module, which relies on PALP for
some of its functionality. To get access to the databases of this package, use
ReflexivePolytope and ReflexivePolytopes commands.

%if %{with docs}
#------------------------------------------------------------------------
%package	doc
Summary:	Documentation infrastructure files for %{name}
Group:		Documentation

%description	doc
This package contains the documentation infrastructure for %{name}.

#------------------------------------------------------------------------
%package	doc-ca
Summary:	Catalan documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-ca
This package contains the Catalan %{name} documentation.

#------------------------------------------------------------------------
%package	doc-de
Summary:	German documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-de
This package contains the German %{name} documentation.

#------------------------------------------------------------------------
%package	doc-en
Summary:	English documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-en
This package contains the English %{name} documentation.

#------------------------------------------------------------------------
%package	doc-fr
Summary:	French documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-fr
This package contains the French %{name} documentation.

#------------------------------------------------------------------------
%package	doc-hu
Summary:	Hungarian documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-hu
This package contains the Hungarian %{name} documentation.

#------------------------------------------------------------------------
%package	doc-it
Summary:	Italian documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-it
This package contains the Italian %{name} documentation.

#------------------------------------------------------------------------
%package	doc-pt
Summary:	Portuguese documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-pt
This package contains the Portuguese %{name} documentation.

#------------------------------------------------------------------------
%package	doc-ru
Summary:	Russian documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-ru
This package contains the Russian %{name} documentation.

#------------------------------------------------------------------------
%package	doc-tr
Summary:	Turkish documentation files for %{name}
Group:		Documentation
Requires:	%{name}-doc = %{version}-%{release}

%description	doc-tr
This package contains the Turkish %{name} documentation.
# with docs
%endif

#------------------------------------------------------------------------
%package	notebook
Summary:	The Sage Notebook
Group:		Applications/Engineering
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description	notebook
The Sage Notebook is a web-based graphical user interface for
mathematical software.

#------------------------------------------------------------------------
%package	rubiks
Summary:	Several programs for working with Rubik's cubes
Group:		Applications/Engineering
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description	rubiks
Several programs for working with Rubik's cubes, by three  different people.
In summary the three contributors are:

Michael Reid (GPL) http://www.math.ucf.edu/~reid/Rubik/optimal_solver.html
    optimal - uses many pre-computed tables to find an optimal 
              solution to the 3x3x3 Rubik's cube

Dik T. Winter (MIT License)
    cube    - uses Kociemba's algorithm to iteratively find a short
              solution to the 3x3x3 Rubik's cube 
    size222 - solves a 2x2x2 Rubik's cube 

Eric Dietz (GPL) http://www.wrongway.org/?rubiksource
    cu2   - A fast, non-optimal 2x2x2 solver
    cubex - A fast, non-optimal 3x3x3 solver
    mcube - A fast, non-optimal 4x4x4 solver

#------------------------------------------------------------------------
%package	sagetex
Summary:	Sagemath into LaTeX documents
Group:		Applications/Engineering
Requires:	%{name}%{?_isa} = %{version}-%{release}

%description	sagetex
This is the SageTeX package. It allows you to embed code, results of
computations, and plots from the Sage mathematics software suite
(http://sagemath.org) into LaTeX documents.

########################################################################
%prep
%setup -q -n sage-%{version}

pushd build/pkgs/cysignals
    tar jxf ../../../upstream/%{cysignals_pkg}.tar.bz2
    mv %{cysignals_pkg} src
popd

pushd build/pkgs/conway_polynomials
    tar jxf ../../../upstream/%{conway_polynomials_pkg}.tar.bz2
    mv %{conway_polynomials_pkg} src
popd

pushd build/pkgs/elliptic_curves
    tar jxf ../../../upstream/%{elliptic_curves_pkg}.tar.bz2
    mv %{elliptic_curves_pkg} src
popd

pushd build/pkgs/flintqs
    tar zxf ../../../upstream/%{flintqs_pkg}.tar.bz2
    mv %{flintqs_pkg} src
popd

pushd build/pkgs/graphs
    tar jxf ../../../upstream/%{graphs_pkg}.tar.bz2
    mv %{graphs_pkg} src
popd

%if %{with bundled_pari}
pushd build/pkgs/pari
    tar zxf ../../../upstream/%{pari_pkg}.tar.gz
    mv %{pari_pkg} src
    pushd src
	for diff in ../patches/*.patch; do
	    patch -p1 < $diff
	done
	# Temporary workaround: redefining GCC_VERSION kills the build
	sed -i 's/GCC_VERSION/PARI_&/' config/paricfg.h.SH
    popd
popd
%endif

%if %{with bundled_pexpect}
pushd build/pkgs/pexpect
    tar zxf ../../../upstream/%{pexpect_pkg}.tar.gz
    mv %{pexpect_pkg} src
    pushd src
	for diff in `ls ../patches/*.patch`; do
	    patch -p1 < $diff
	done
    popd
popd
%endif

pushd build/pkgs/polytopes_db
    tar jxf ../../../upstream/%{polytopes_db_pkg}.tar.bz2
    mv %{polytopes_db_pkg} src
popd

pushd build/pkgs/rubiks
    tar jxf ../../../upstream/%{rubiks_pkg}.tar.bz2
    mv %{rubiks_pkg} src
    pushd src
	cp ../patches/dietz-mcube-Makefile dietz/mcube/Makefile
	cp ../patches/dietz-solver-Makefile dietz/solver/Makefile
	cp ../patches/dietz-cu2-Makefile dietz/cu2/Makefile
	cp ../patches/reid-Makefile reid/Makefile
    popd
popd

pushd build/pkgs/sagenb
    tar jxf ../../../upstream/%{sagenb_pkg}.tar.bz2
    mv %{sagenb_pkg} src
popd

pushd build/pkgs/sagetex
    tar zxf ../../../upstream/%{sagetex_pkg}.tar.gz
    mv %{sagetex_pkg} src
popd

%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9

%if %{without bundled_pari}
%patch10
%endif

%patch11
%patch12
%patch13
%patch14
%patch15
%patch16
%patch17
%patch18

%if %{with fes}
%patch19
%else
%patch20
%endif

%patch21
%patch22
%patch23
%patch24
%patch25
%patch26
%patch27
%patch28
%patch29
%patch30
%patch31
%patch32
%patch33

sed -e 's|@@SAGE_ROOT@@|%{SAGE_ROOT}|' \
    -e 's|@@SAGE_DOC@@|%{SAGE_DOC}|' \
    -i src/sage/env.py

sed -e 's|@@CYSIGNALS@@|%{_builddir}%{python_sitearch}/cysignals|' \
    -i src/setup.py

sed -e "s|, 'flask-oldsessions>=0.10'||" \
    -e "s|'http://github.com/mitsuhiko/flask-oldsessions/tarball/master#egg=flask-oldsessions-0.10'||" \
    -i build/pkgs/sagenb/src/setup.py

#------------------------------------------------------------------------
# some .c files are not (re)generated
find src/sage \( -name \*.pyx -o -name \*.pxd \) | xargs touch

# remove bundled jar files before build
rm build/pkgs/sagenb/src/sagenb/data/sage3d/lib/sage3d.jar

# remove binary egg
rm -r build/pkgs/sagenb/src/sagenb.egg-info

# fix Singular paths
sed -e "s,SINGULARPATH=\",&%{_libdir}/Singular/LIB:," \
    -e "s,\(SINGULAR_EXECUTABLE=\"\).*\",\1%{_libdir}/Singular/Singular\"," \
    -i src/bin/sage-env

########################################################################
%build
export CC=%{__cc}
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export SAGE_ROOT=%{buildroot}%{SAGE_ROOT}
export SAGE_LOCAL=%{buildroot}%{SAGE_LOCAL}
# Avoid buildroot in gcc command line (use _builddir instead)
export SAGE_SRC="$PWD/src"
export SAGE_INC=%{_includedir}
export SAGE_FORTRAN=%{_bindir}/gfortran
export SAGE_FORTRAN_LIB=`gfortran --print-file-name=libgfortran.so`
export DESTDIR=%{buildroot}
# Use file in /tmp because there are issues with long pathnames
export DOT_SAGE=/tmp/sage$$
mkdir -p $DOT_SAGE/tmp

# match system packages as sagemath packages
mkdir -p $SAGE_ROOT $SAGE_LOCAL
ln -sf %{_libdir} $SAGE_LOCAL/lib
ln -sf %{_includedir} $SAGE_LOCAL/include
ln -sf %{_datadir} $SAGE_LOCAL/share

export PATH=%{buildroot}%{_bindir}:$PATH
export PYTHONPATH=%{buildroot}%{python_sitearch}:$PYTHONPATH

#------------------------------------------------------------------------
# Save and update environment to generate bundled interfaces
save_PATH=$PATH
save_LOCAL=$SAGE_LOCAL
export PATH=%{_builddir}/bin:$PATH
export SAGE_LOCAL=%{_builddir}

%if %{with bundled_pari}
# Build bundled pari-2.8
pushd build/pkgs/pari/src
    ./Configure --prefix=%{_builddir} \
	--without-readline --with-gmp \
	--kernel=gmp --graphic=none
    sed -i 's|%{_builddir}|%{_prefix}|g' Olinux-*/paricfg.h
    make %{?_smp_mflags} gp
    make install DESTDIR=""
    cp -p src/language/anal.h  %{_builddir}/include/pari/anal.h
popd
%endif

# Generate pari interface
pushd src
    %__python2 -c "from sage_setup.autogen.interpreters import rebuild; rebuild('sage/ext/interpreters')"
    %__python2 -c "from sage_setup.autogen.pari import rebuild; rebuild()"
popd

%if %{with bundled_pari}
# Make temporary headers and static library visible
sed -i 's|\(^    include_directories = \[SAGE_INC,\)|\1 "%{_builddir}/include",|' \
    src/sage/env.py
sed -i 's|\(^extra_link_args = \[\) \]|\1"-L%{_builddir}/lib"\]|' \
    src/setup.py
%endif

pushd build/pkgs/cysignals/src
    %__python2 setup.py build
    %__python2 setup.py install --root %{_builddir}
popd
export PYTHONPATH=%{_builddir}%{python_sitearch}:$PYTHONPATH

%if %{with cython_hack}
    cp -far %{python_sitearch}/Cython %{_builddir}%{python_sitearch}
    PATCH=$PWD/build/pkgs/cython/patches/pxi_sys_path.patch
    pushd %{_builddir}%{python_sitearch}
	patch -p1 < $PATCH
    popd
%endif

# Restore environment used to generate bundled interfaces
export PATH=$save_PATH
export SAGE_LOCAL=$save_LOCAL

pushd src
    %__python2 -u ./setup.py build
popd

#------------------------------------------------------------------------
pushd build/pkgs/sagenb/src
    %__python2 ./setup.py build
popd

#------------------------------------------------------------------------
pushd build/pkgs/flintqs/src
    %configure
    make %{?_smp_mflags} CPP="g++ %{optflags} -fPIC"
popd

pushd build/pkgs/rubiks/src
    make %{?_smp_mflags} CC="gcc -fPIC" CXX="g++ -fPIC" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}"
popd

# Remove buildroot reference from cython comments
perl -pi -e 's|%{buildroot}||g;' `find src/build/cythonized -type f`

# Try hard to remove buildroot from binaries
rm -f `grep -lr "%{buildroot}" src/build/lib.linux-*/`
rm -f `grep -lr "%{buildroot}" src/build/temp.linux-*/`
pushd src
    %__python2 ./setup.py build
popd

# last build command
rm -fr $DOT_SAGE

########################################################################
%install
export CC=%{__cc}
export SAGE_ROOT=%{buildroot}%{SAGE_ROOT}
export SAGE_LOCAL=%{buildroot}%{SAGE_LOCAL}
# Avoid buildroot in gcc command line (use _builddir instead)
export SAGE_SRC="$PWD/src"
export SAGE_INC=%{_includedir}
#export SAGE_SRC=#%#{buildroot}#%#{SAGE_SRC}
export SAGE_SHARE=%{buildroot}%{SAGE_SHARE}
export SAGE_ETC=%{buildroot}%{SAGE_ETC}
export SAGE_EXTCODE=%{buildroot}%{SAGE_ETC}
export SAGE_DOC=%{buildroot}%{SAGE_DOC}
export SAGE_PYTHONPATH=%{buildroot}%{SAGE_PYTHONPATH}
%if %{with bundled_pari}
export LD_LIBRARY_PATH=%{_builddir}/lib:$LD_LIBRARY_PATH
%endif
export DESTDIR=%{buildroot}
export DOT_SAGE=/tmp/sage$$
mkdir -p $DOT_SAGE/tmp

export PATH=%{buildroot}%{_bindir}:$PATH
export PYTHONPATH=%{buildroot}%{python_sitearch}:$PYTHONPATH
export PYTHONPATH=%{_builddir}%{python_sitearch}:$PYTHONPATH

#------------------------------------------------------------------------
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
mkdir -p $SAGE_PYTHONPATH
rm -fr $SAGE_LOCAL/{include,lib,share,notebook}
mkdir -p $SAGE_SHARE $SAGE_DOC $SAGE_LOCAL/bin %{buildroot}%{SAGE_SRC}
ln -sf $PWD/src/sage %{buildroot}%{SAGE_SRC}/sage
ln -sf %{_libdir} $SAGE_LOCAL/lib
ln -sf %{_includedir} $SAGE_LOCAL/include
ln -sf %{_datadir} $SAGE_LOCAL/share

#------------------------------------------------------------------------
pushd build/pkgs/cysignals/src
    pushd docs
	%__make html
    popd
    %__python2 setup.py install --root %{buildroot}
    mv %{buildroot}%{_bindir}/cysignals* $SAGE_LOCAL/bin
popd

#------------------------------------------------------------------------
pushd src/ext
    mkdir -p $SAGE_ETC
    for dir in 			\
	gap			\
	graphs			\
	images			\
	magma			\
	mwrank			\
	notebook-ipython; do
	COUNT=`find $dir -type f | wc -l `
	if [ $COUNT -gt 0 ]; then
	    cp -far $dir $SAGE_ETC
	fi
	cp -far pari $SAGE_ETC
    done
    cp -fa %{SOURCE1} $SAGE_ETC
popd

#------------------------------------------------------------------------
pushd src
    # FIXME finishes but fails when exiting
    #     from sage.misc.randstate import current_randstate
    # ImportError: No module named randstate
    %__python2 -u setup.py install --root=%{buildroot} || :
%if %{with docs}
    # install documentation sources
    rm -fr $SAGE_DOC/{common,en,fr}
    cp -far doc/{common,ca,de,en,fr,hu,it,pt,ru,tr} $SAGE_DOC
%endif
popd

%if %{with bundled_pari}
# Revert change to make temporary headers and static library visible
# Making it search for the installed sagemath path
sed -i 's|\(^    include_directories = \[SAGE_INC,\).*|\1|' \
    %{buildroot}%{SAGE_SRC}/sage/env.py
%endif

#------------------------------------------------------------------------
pushd build/pkgs/sagenb/src
    rm -f %{buildroot}%{python_sitearch}/sagenb/data/sage3d/sage3d
    %__python2 setup.py install --root=%{buildroot} --install-purelib=%{python_sitearch}
    # jsmol
    ln -sf %{_jsdir}/jsmol $SAGE_SHARE/jsmol
    # sage3d
    rm -f %{buildroot}%{_bindir}/sage3d
%if %{with sage3d}
    ln -sf %{SAGE_LOCAL}/bin/sage3d %{buildroot}%{python_sitearch}/sagenb/data/sage3d/sage3d
%endif
    ln -sf %{python_sitearch}/sagenb %{buildroot}%{SAGE_SRC}/sagenb
    # use system mathjax
    ln -sf %{_jsdir}/mathjax %{buildroot}%{python_sitearch}/sagenb/data/mathjax
popd

#------------------------------------------------------------------------
%if %{with bundled_pexpect}
pushd build/pkgs/pexpect/src
    cp -fa pexpect $SAGE_PYTHONPATH
popd
%endif

#------------------------------------------------------------------------
cp -fa COPYING.txt $SAGE_ROOT
pushd src/bin
    mkdir -p $SAGE_LOCAL/bin
    cp -fa sage-* $SAGE_LOCAL/bin
    pushd $SAGE_LOCAL/bin
	ln -sf %{_bindir}/python sage.bin
	ln -sf %{_bindir}/python python
%if %{without bundled_pari}
	ln -sf %{_bindir}/gp sage_pari
%endif
	ln -sf %{_bindir}/gap gap_stamp
	ln -sf %{_bindir}/gmp-ecm ecm
    popd
popd
install -p -m755 src/bin/sage $SAGE_LOCAL/bin

#------------------------------------------------------------------------
pushd build/pkgs/flintqs/src
    cp -fa src/QuadraticSieve $SAGE_LOCAL/bin
popd

pushd build/pkgs/rubiks/src
    cp -fa \
	reid/optimal \
	dietz/solver/cubex \
	dietz/mcube/mcube \
	dietz/cu2/cu2 \
	dik/dikcube \
	dik/size222 \
	$SAGE_LOCAL/bin
popd

#------------------------------------------------------------------------
pushd $SAGE_LOCAL/bin/
    for file in \
	sage-arch-env \
	sage-bdist \
	sage-build \
	sage-clone \
	sage-clone-source \
	sage-combinat \
	sage-crap \
	sage-dev \
	sage-download-file \
	sage-download-upstream \
	sage-env \
	sage-fix-pkg-checksums \
	sage-list-experimental \
	sage-list-optional \
	sage-list-packages \
	sage-list-standard \
	sage-location \
	sage-omega \
	sage-open \
	sage-pkg \
	sage-pull \
	sage-push \
	sage-pypkg-location \
	sage-README-osx.txt \
	sage-rebaseall.bat \
	sage-rebaseall.sh \
	sage-rebase.bat \
	sage-rebase.sh \
	sage-rebase \
	sage-rsyncdist \
	sage-sdist \
	sage-spkg \
	sage-starts \
	sage-sync-build.py \
	sage-test-import \
	sage-update-src \
	sage-update-version \
	sage-upgrade \
	spkg-install; do
	rm -f $file
    done
popd

#------------------------------------------------------------------------
pushd build/pkgs/conway_polynomials
    %__python2 ./spkg-install
popd

#------------------------------------------------------------------------
pushd build/pkgs/elliptic_curves
    # --short-circuit -bi debug build helper
    if [ ! -e src/ellcurves ]; then
	rm -fr src
	tar jxf ../../../upstream/%{elliptic_curves_pkg}.tar.bz2
	mv %{elliptic_curves_pkg} src
    fi
    %__python2 ./spkg-install
popd

#------------------------------------------------------------------------
pushd build/pkgs/graphs
    mkdir -p $SAGE_SHARE/graphs
    cp -fa src/* $SAGE_SHARE/graphs
popd

#------------------------------------------------------------------------
pushd build/pkgs/polytopes_db
    mkdir -p $SAGE_SHARE/reflexive_polytopes
    cp -fa src/* $SAGE_SHARE/reflexive_polytopes
popd

#------------------------------------------------------------------------
pushd build/pkgs/sagetex/src
    %__python2 setup.py install --root=%{buildroot} --install-purelib=%{python_sitearch}
    install -p -m 0644 -D %{SOURCE2} \
	%{buildroot}%{_datadir}/texmf/tex/latex/sagetex/makecmds.sty
    mv %{buildroot}%{_datadir}/texmf/tex/latex/sagetex/CONTRIBUTORS \
	 %{buildroot}%{_docdir}/sagetex
    for file in PKG-INFO README; do
	install -p -m 0644 $file %{buildroot}%{_docdir}/sagetex/$file
    done
popd

#------------------------------------------------------------------------
cat > %{buildroot}%{_bindir}/sage << EOF
#!/bin/bash -i

export CUR=\`pwd\`
##export DOT_SAGE="\$HOME/.sage"
mkdir -p \$DOT_SAGE/{maxima,sympow,tmp}
export SAGE_TESTDIR=\$DOT_SAGE/tmp
export SAGE_ROOT="$SAGE_ROOT"
export SAGE_LOCAL="$SAGE_LOCAL"
export SAGE_SHARE="$SAGE_SHARE"
export SAGE_EXTCODE="$SAGE_ETC"
export SAGE_ETC="$SAGE_ETC"
export SAGE_SRC="%{buildroot}%{SAGE_SRC}"
##export SAGE_DOC="$SAGE_DOC"
##export SAGE_DOC_SRC="\$SAGE_DOC"
module load 4ti2-%{_arch}
module load lrcalc-%{_arch}
module load surf-geometry-%{_arch}
export PATH=$SAGE_LOCAL/bin:\$PATH
export SINGULARPATH=%{_libdir}/Singular/LIB
export SINGULAR_BIN_DIR=%{_libdir}/Singular
##export PYTHONPATH="$SAGE_PYTHONPATH:\$SAGE_LOCAL/bin"
export SAGE_CBLAS=blas
export SAGE_FORTRAN=%{_bindir}/gfortran
export SAGE_FORTRAN_LIB=\`gfortran --print-file-name=libgfortran.so\`
export SYMPOW_DIR="\$DOT_SAGE/sympow"
export LC_MESSAGES=C
export LC_NUMERIC=C
export LD_LIBRARY_PATH=\$SAGE_ROOT/lib:\$LD_LIBRARY_PATH
# Required for sage -gdb
export SAGE_DEBUG=no
$SAGE_LOCAL/bin/sage "\$@"
EOF
#------------------------------------------------------------------------
chmod +x %{buildroot}%{_bindir}/sage

#------------------------------------------------------------------------
%if %{with sage3d}
cat > %{buildroot}%{SAGE_LOCAL}/bin/sage3d << EOF
#!/bin/sh

java -classpath %{SAGE_SRC}/sage/sagenb/data/sage3d/lib/sage3d.jar:%{_javadir}/j3dcore.jar:%{_javadir}/vecmath.jar:%{_javadir}/j3dutils.jar org.sagemath.sage3d.ObjectViewerApp "\$1"
EOF
chmod +x %{buildroot}%{SAGE_LOCAL}/bin/sage3d
%endif

#------------------------------------------------------------------------
# adjust cython interface:
# o install csage headers
# o install .pxi and .pxd files
pushd src
    for f in `find sage \( -name \*.pxi -o -name \*.pxd -o -name \*.pyx \)`; do
	install -p -D -m 0644 $f %{buildroot}%{python_sitearch}/$f
    done
    # need this or will not "find" the files in the directory, and
    # fail to link with gmp
    touch %{buildroot}%{python_sitearch}/sage/libs/gmp/__init__.py
popd

%if %{with docs}
#------------------------------------------------------------------------
%if %{with bundled_pexpect}
cp -fa $SAGE_PYTHONPATH/pexpect %{buildroot}%{python_sitearch}
%endif

# Build documentation, using %#{buildroot} environment
export SAGE_SETUP=$PWD/src/sage_setup
pushd src/doc
    export SAGE_DOC=`pwd`
    export PATH=%{buildroot}%{_bindir}:$SAGE_LOCAL/bin:$PATH
    export SINGULARPATH=%{_libdir}/Singular/LIB
    export SINGULAR_BIN_DIR=%{_libdir}/Singular
    export LD_LIBRARY_PATH=%{_libdir}/atlas:$LD_LIBRARY_PATH
    export PYTHONPATH=$SAGE_SETUP:%{buildroot}%{python_sitearch}:$SAGE_PYTHONPATH:$SAGE_DOC

%if %{with sphinx_hack}
    cp -far %{python_sitelib}/sphinx %{buildroot}%{python_sitearch}
    sed -i "s|\(source.startswith('>>>')\)|\1 or source.startswith('sage: ')|" \
	%{buildroot}%{python_sitearch}/sphinx/highlighting.py
%endif

    # there we go
    ln -sf %{buildroot}%{SAGE_DOC} %{buildroot}%{SAGE_SRC}/doc
    export SAGE_DOC=%{buildroot}%{SAGE_DOC}
    export SAGE_DOC_SRC=$SAGE_DOC
    # python -m sage_setup.docbuild
    # FIXME there is a 'ja' translation, but adding it to $LANGUAGES
    # does not get documentation built
    LANGUAGES="ca de en fr hu it pt ru tr" \
	%__python2 -m docbuild --no-pdf-links -k all html
    rm -f %{buildroot}%{SAGE_SRC}/doc
    ln -sf %{SAGE_DOC} %{buildroot}%{SAGE_SRC}/doc

    # should not be required and encodes buildroot
    rm -fr $SAGE_DOC/output/doctrees
popd

%if %{with check}
export SAGE_TIMEOUT=%{SAGE_TIMEOUT}
export SAGE_TIMEOUT_LONG=%{SAGE_TIMEOUT_LONG}
sage -testall --verbose || :
install -p -m644 $DOT_SAGE/tmp/test.log $SAGE_DOC/test.log
# remove buildroot references from test.log
sed -i 's|%{buildroot}||g' $SAGE_DOC/test.log
%endif

%if %{with bundled_pexpect}
    rm -f %{buildroot}%{python_sitearch}/pexpect
%endif

%if %{with sphinx_hack}
    rm -fr %{buildroot}%{python_sitearch}/sphinx
%endif

# More wrong buildroot references
perl -pi -e 's|%{buildroot}||g;' \
	 -e "s|$PWD/src/doc|%{SAGE_DOC}|g;" \
    %{buildroot}%{SAGE_DOC}/output/html/en/reference/todolist.html
# with docs
%endif

# Script was used to build documentation
perl -pi -e 's|%{buildroot}||g;s|^##||g;' %{buildroot}%{_bindir}/sage

#------------------------------------------------------------------------
# Fix links
rm -fr $SAGE_SRC/sage $SAGE_ETC/sage $SAGE_ROOT/doc $SAGE_SRC/doc
rm -fr $SAGE_ROOT/share $SAGE_ROOT/devel
ln -sf %{python_sitearch}/sage $SAGE_SRC/sage
ln -sf %{python_sitearch} $SAGE_ETC/sage
ln -sf %{SAGE_DOC} $SAGE_ROOT/doc
ln -sf %{SAGE_DOC} $SAGE_SRC/doc
ln -sf %{SAGE_SHARE} $SAGE_ROOT/share
# compat devel symlink
ln -sf src $SAGE_ROOT/devel

# Install menu and icons
pushd build/pkgs/sagenb/src/sagenb/data
    install -p -m644 -D sage/images/icon128x128.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
popd
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=Sagemath
Comment=A free open-source mathematics software system
Exec=sage
Icon=%{name}
Terminal=true
Type=Application
Categories=Science;Math;
EOF
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop

# Fix permissions
find %{buildroot} -name '*.so' | xargs chmod 755
pushd %{buildroot}%{SAGE_LOCAL}/bin
    chmod 755 QuadraticSieve
    chmod 755 mcube dikcube cu2 size222 cubex optimal
popd
for file in `find %{buildroot} -name \*.py`; do
    if head -1 $file | grep -q '^#!'; then
	chmod +x $file
    fi
done

%if %{with docs}
chmod -x %{buildroot}%{SAGE_DOC}/en/prep/media/Rplot001.png

# Documentation is not rebuilt (also corrects rpmlint warning of hidden file)
find %{buildroot}%{SAGE_DOC} -name .buildinfo -exec rm {} \;
rm -fr %{buildroot}%{SAGE_DOC}/output/inventory
find %{buildroot}%{SAGE_DOC} -type d -name _sources | xargs rm -fr
%endif

# remove .po files
rm %{buildroot}%{python_sitearch}/sagenb/translations/*/LC_MESSAGES/*.po

%if %{without sage3d}
rm -r %{buildroot}%{python_sitearch}/sagenb/data/sage3d
%endif

# remove build directory in buildroot
[ -d %{buildroot}%{SAGE_SRC}/build ] &&
    rm -r %{buildroot}%{SAGE_SRC}/build

%if %{with bundled_pari}
install -D -m 755 %{_builddir}/bin/gp-2.8 %{buildroot}%{SAGE_LOCAL}/bin/gp-2.8
for dest in gp sage_pari; do
    ln -sf gp-2.8 %{buildroot}%{SAGE_LOCAL}/bin/$dest
done
install -D -m 755 %{_builddir}/lib/libpari-gmp-2.8.so.0.0.0 \
    %{buildroot}%{SAGE_ROOT}/lib/libpari-gmp-2.8.so.0.0.0
ln -s libpari-gmp-2.8.so.0.0.0 \
    %{buildroot}%{SAGE_ROOT}/lib/libpari-gmp-2.8.so.0
install -D -m 644 %{_builddir}/share/pari/pari.desc \
    %{buildroot}%{SAGE_LOCAL}/pari.desc

# make sure pari is in link path
ln -s libpari-gmp-2.8.so.0.0.0 %{buildroot}%{SAGE_ROOT}/lib/libpari.so
perl -pi -e 's|(libdirs = cblas_library_dirs)|$1 + \["%{SAGE_ROOT}/lib"\]|;' %{buildroot}%{python_sitearch}/sage/misc/cython.py
%endif

# remove sage_setup
rm -r %{buildroot}%{python_sitearch}/sage_setup

# pretend sagemath spkgs are installed to reduce number of errors
# in doctests
mkdir -p %{buildroot}%{SAGE_SPKG_INST}
pushd upstream
for file in *.tar.*; do
    touch %{buildroot}%{SAGE_SPKG_INST}/$(echo $file | sed -e 's|\.tar.*||')
done
popd
#------------------------------------------------------------------------
cat > %{buildroot}%{SAGE_LOCAL}/bin/sage-list-packages << EOF
#!/bin/sh
NOVERSION=false
INSTALLED=no
while [ \$# -gt 0 ]; do
    if [ x\$1 = x--no-version ]; then
	NOVERSION=true
    elif [ x\$1 = xinstalled ]; then
        INSTALLED=yes
    fi
    shift
done
if [ \$INSTALLED = no ]; then
    exit 0
fi
LIST=\$(cd %{SAGE_SPKG_INST}; echo *)
if [ \$NOVERSION = false ]; then
    for pkg in \$LIST; do
	echo \$pkg | sed -e 's/-/ /'
    done
else
    for pkg in \$LIST; do
	echo \$pkg | sed -e 's/-.*//'
    done
fi
EOF
chmod +x %{buildroot}%{SAGE_LOCAL}/bin/sage-list-packages
#------------------------------------------------------------------------

# do not install symlink to '.'
rm %{buildroot}%{SAGE_DOC}/output

# last install command
rm -fr $DOT_SAGE

########################################################################
%pretrans	-p /usr/bin/lua
posix = require('posix')
path = "%{python_sitearch}/sagenb/data/mathjax"
st = posix.stat(path)
if st and st.type == "directory" then
  status = os.rename(path, path .. ".rpmmoved")
  if not status then
    suffix = 0
    while not status do
      suffix = suffix + 1
      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
    end
    os.rename(path, path .. ".rpmmoved")
  end
end

%post		core
/sbin/ldconfig
exit 0

%postun		core
/sbin/ldconfig
exit 0

# Upgrade correction for change from directory to symlink
%post		doc
if [ ! -e %{SAGE_DOC}/common ]; then
    ln -sf . %{SAGE_DOC}/common
fi
exit 0

%preun		doc
if [ $1 -eq 0 ] ; then
    if [ -h %{SAGE_DOC}/common ]; then
	rm %{SAGE_DOC}/common
    fi
fi
exit 0

%post		sagetex
%{_bindir}/mktexlsr
exit 0

%postun		sagetex
if [ $1 -eq 0 ] ; then
    %{_bindir}/mktexlsr
fi
exit 0

########################################################################
%files
# GPLv2+
%dir %{SAGE_ROOT}
%doc %{SAGE_ROOT}/COPYING.txt
%dir %{SAGE_LOCAL}
%dir %{SAGE_LOCAL}/bin
%{SAGE_LOCAL}/bin/QuadraticSieve
%{SAGE_LOCAL}/bin/ecm
%{SAGE_LOCAL}/bin/gap_stamp
%if %{with bundled_pari}
%{SAGE_LOCAL}/bin/gp*
%endif
%{SAGE_LOCAL}/bin/python
%{SAGE_LOCAL}/bin/sage*
%{SAGE_LOCAL}/include
%{SAGE_LOCAL}/lib
%{SAGE_LOCAL}/share
%{SAGE_ROOT}/doc
%{SAGE_ROOT}/devel
%{SAGE_ROOT}/share
%dir %{SAGE_SRC}
%if %{with docs}
%{SAGE_SRC}/doc
%endif
%{SAGE_SRC}/sage
%dir %{SAGE_PYTHONPATH}
# GPLv2+
%{_bindir}/sage
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%if %{with bundled_pari}
%{SAGE_ROOT}/lib
%{SAGE_LOCAL}/pari.desc
%endif
%{SAGE_SPKG_INST}

#------------------------------------------------------------------------
%files		core
# GPLv2+
%{SAGE_LOCAL}/bin/cysignals*
%{python_sitearch}/sage
%{python_sitearch}/sage-*.egg-info
%{python_sitearch}/cysignals
%{python_sitearch}/cysignals-*.egg-info

#------------------------------------------------------------------------
%files		data
%dir %{SAGE_SHARE}
%dir %{SAGE_ETC}
%{SAGE_ETC}/sage
%{SAGE_ETC}/gprc.expect

#------------------------------------------------------------------------
%files		data-conway_polynomials
# GPLv2+
%{SAGE_SHARE}/conway_polynomials

#------------------------------------------------------------------------
%files		data-elliptic_curves
# GPLv2+
%{SAGE_SHARE}/cremona
%{SAGE_SHARE}/ellcurves

#------------------------------------------------------------------------
%files		data-etc
# GPLv2+
%{SAGE_ETC}/gap
%{SAGE_ETC}/images
%{SAGE_ETC}/magma
%{SAGE_ETC}/mwrank
%{SAGE_ETC}/pari

#------------------------------------------------------------------------
%files		data-graphs
# GPLv2+
%{SAGE_ETC}/graphs
%{SAGE_SHARE}/graphs

#------------------------------------------------------------------------
%files		data-polytopes_db
# GPL+
%{SAGE_SHARE}/reflexive_polytopes

%if %{with docs}
#------------------------------------------------------------------------
%files		doc
# GPLv2+
%dir %{SAGE_DOC}
%{SAGE_DOC}/common
%dir %{SAGE_DOC}/html

#------------------------------------------------------------------------
%files		doc-ca
# GPLv2+
%{SAGE_DOC}/ca
%{SAGE_DOC}/html/ca

#------------------------------------------------------------------------
%files		doc-de
# GPLv2+
%{SAGE_DOC}/de
%{SAGE_DOC}/html/de

#------------------------------------------------------------------------
%files		doc-en
# GPLv2+
%{SAGE_DOC}/en
%{SAGE_DOC}/html/en

#------------------------------------------------------------------------
%files		doc-fr
# GPLv2+
%{SAGE_DOC}/fr
%{SAGE_DOC}/html/fr

#------------------------------------------------------------------------
%files		doc-hu
# GPLv2+
%{SAGE_DOC}/hu
%{SAGE_DOC}/html/hu

#------------------------------------------------------------------------
%files		doc-it
# GPLv2+
%{SAGE_DOC}/it
%{SAGE_DOC}/html/it

#------------------------------------------------------------------------
%files		doc-pt
# GPLv2+
%{SAGE_DOC}/pt
%{SAGE_DOC}/html/pt

#------------------------------------------------------------------------
%files		doc-ru
# GPLv2+
%{SAGE_DOC}/ru
%{SAGE_DOC}/html/ru

#------------------------------------------------------------------------
%files		doc-tr
# GPLv2+
%{SAGE_DOC}/tr
%{SAGE_DOC}/html/tr
# with docs
%endif

#------------------------------------------------------------------------
%files		notebook
%{SAGE_ETC}/notebook-ipython
# GPLv2+
%{SAGE_SRC}/sagenb
%dir %{python_sitearch}/sagenb
%{python_sitearch}/sagenb/*.py*
%{python_sitearch}/sagenb-*.egg-info
%dir %{python_sitearch}/sagenb/data
# BSD
%{python_sitearch}/sagenb/data/codemirror
# MIT
%{python_sitearch}/sagenb/data/graph_editor
# ASL 2.0
%{python_sitearch}/sagenb/data/highlight
# LGPLv2+
%{SAGE_SHARE}/jsmol
# (MIT or GPLv2) and (MIT and BSD and GPL)
%{python_sitearch}/sagenb/data/jquery
# (MIT or GPLv2) and (MIT and BSD and GPL)
%{python_sitearch}/sagenb/data/jqueryui
# Public Domain
%{python_sitearch}/sagenb/data/json
# Symbolic link to $_jsdir/mathjax
%{python_sitearch}/sagenb/data/mathjax
%ghost %{python_sitearch}/sagenb/data/mathjax.rpmmoved
# Empty (do not run doctests flag file)
%{python_sitearch}/sagenb/data/nodoctest.py*
# BSD
%{python_sitearch}/sagenb/data/openid-realselector
# GPLv2+
%{python_sitearch}/sagenb/data/sage
%if %{with sage3d}
# GPLv2+
%{python_sitearch}/sagenb/data/sage3d
%endif
# LGPLv2+
%{python_sitearch}/sagenb/data/tiny_mce
# LGPLv2+
%{python_sitearch}/sagenb/data/zorn
# GPLv2+
%{python_sitearch}/sagenb/flask_version
# GPLv2+
%{python_sitearch}/sagenb/interfaces
# GPLv2+
%{python_sitearch}/sagenb/misc
# GPLv2+
%{python_sitearch}/sagenb/notebook
# GPLv2+
%{python_sitearch}/sagenb/simple
# GPLv2+
%{python_sitearch}/sagenb/storage
# GPLv2+
%dir %{python_sitearch}/sagenb/testing
%{python_sitearch}/sagenb/testing/*.py*
%{python_sitearch}/sagenb/testing/tests
# ASL 2.0
%{python_sitearch}/sagenb/testing/selenium
# GPLv2+
%dir %{python_sitearch}/sagenb/translations
%lang(cs_CZ) %{python_sitearch}/sagenb/translations/cs_CZ
%lang(de_AT) %{python_sitearch}/sagenb/translations/de_AT
%lang(de_AT) %{python_sitearch}/sagenb/translations/en_US
%lang(de_AT) %{python_sitearch}/sagenb/translations/es_ES
%lang(de_AT) %{python_sitearch}/sagenb/translations/fr_FR
%lang(pt_BR) %{python_sitearch}/sagenb/translations/pt_BR
%lang(ru_RU) %{python_sitearch}/sagenb/translations/ru_RU
%lang(uk_UA) %{python_sitearch}/sagenb/translations/uk_UA

#------------------------------------------------------------------------
%files		rubiks
# GPL+
%{SAGE_LOCAL}/bin/optimal
# MIT
%{SAGE_LOCAL}/bin/dikcube
%{SAGE_LOCAL}/bin/size222
# GPL+
%{SAGE_LOCAL}/bin/cu2
%{SAGE_LOCAL}/bin/cubex
%{SAGE_LOCAL}/bin/mcube

#------------------------------------------------------------------------
%files		sagetex
# GPLv2+
%{python_sitearch}/sagetex*
%{_datadir}/texmf/tex/latex/sagetex
%doc %{_docdir}/sagetex

########################################################################
%changelog
* Tue Dec 20 2016 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 7.3.7
- Correct f24 to f25 upgrade, sagemath 6.8 to 7.3 (#1396848)

* Thu Oct 20 2016 Jerry James <loganjerry@gmail.com> - 7.3-6
- Rebuild for ntl 10.1.0

* Sun Oct 09 2016 Dominik Mierzejewski <rpm@greysector.net> - 7.3-5
- rebuild for aarch64 (#1380191 fixed)

* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 7.3-4
- rebuilt for matplotlib-2.0.0
- sync supported arches with maxima

* Mon Sep  5 2016 Jerry James <loganjerry@gmail.com> - 7.3-3
- Rebuild for ntl 9.11.0
- Add gap-pkg-guava requirement

* Wed Aug 24 2016 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 7.3-2
- Make notebook functional with python-flask-0.11.1

* Sat Aug 20 2016 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 7.3-1
- Update to sagemath 7.3
- Switch from polybori to brial
- Default to use system pexpect
- Use system mathjax

* Fri Aug 12 2016 Jerry James <loganjerry@gmail.com> - 6.8-14
- Rebuild for fflas-ffpack 2.2.2, givaro 4.0.2, and linbox 1.4.2
- GAP packages atlasrep, design, and hap are now available

* Sat Jul 23 2016 Jerry James <loganjerry@gmail.com> - 6.8-13
- Rebuild for ntl 9.10.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.8-12
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Jun  2 2016 Jerry James <loganjerry@gmail.com> - 6.8-11
- Rebuild for ntl 9.9.1

* Fri Apr 29 2016 Jerry James <loganjerry@gmail.com> - 6.8-10
- Rebuild for ntl 9.8.0
- Nauty is now available under a free license

* Wed Apr 13 2016 Jerry James <loganjerry@gmail.com> - 6.8-9
- Rebuild for linbox 1.4.1

* Thu Apr  7 2016 Jerry James <loganjerry@gmail.com> - 6.8-8
- Rebuild for libgap 4.8.3

* Sat Mar 19 2016 Jerry James <loganjerry@gmail.com> - 6.8-7
- Rebuild for glpk 4.59, ntl 9.7.0 and gmp-ecm 7.0

* Mon Mar  7 2016 Jerry James <loganjerry@gmail.com> - 6.8-6
- Doc packages cannot be noarch since they are not built for all arches

* Sat Feb 27 2016 Jerry James <loganjerry@gmail.com> - 6.8-6
- Rebuild for givaro 4.0.1, fflas-ffpack 2.2.0, and linbox 1.4.0
- Add -givaro patch to adapt to header file changes in those releases

* Mon Feb 22 2016 Orion Poplawski <orion@cora.nwra.com> - 6.8-5
- Rebuild for gsl 2.1

* Sat Feb 20 2016 Jerry James <loganjerry@gmail.com> - 6.8-4
- Rebuild for ntl 9.6.4

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 6.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Dec 29 2015 Jerry James <loganjerry@gmail.com> - 6.8-2
- Rebuild for arb 2.8.0

* Tue Dec 22 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.8-1
- Update to sagemath 6.8
- Remove scons, lrcalc, cryptominisat, parallel and ipython3 patches
- Add lcalc, fes-build and arb patches

* Fri Dec  4 2015 Jerry James <loganjerry@gmail.com> - 6.5-14
- Rebuild for ntl 9.6.2

* Fri Oct 16 2015 Jerry James <loganjerry@gmail.com> - 6.5-13
- Rebuild for m4rie 20150908 and ntl 9.4.0

* Sat Oct  3 2015 Jerry James <loganjerry@gmail.com> - 6.5-12
- Rebuild for ecl 16.0.0

* Sat Sep 19 2015 Jerry James <loganjerry@gmail.com> - 6.5-11
- Rebuild for eclib 20150827, flint 2.5.2, and ntl 9.3.0

* Fri Sep  4 2015 Jerry James <loganjerry@gmail.com> - 6.5-10
- Rebuild for cryptominisat 2.9.10

* Sat Aug 29 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.5-9
- Apply conditionally not required for f22 ipython3 patch (#1258006)
- Add missing sphinx requires (#1229283)

* Mon Aug  3 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.5-8
- Bump release for f23 rebuild

* Sun Jul 19 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.5-7
- Correct unable to start QEPCAD within sage (#1243590)
- Use interactive bash on wrappers to work with other login shells (#1238341)
- Properly generate localized translations

* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon May 18 2015 Jerry James <loganjerry@gmail.com> - 6.5-5
- Rebuild for ntl 9.1.1 and cddlib 094h

* Sat May  9 2015 Jerry James <loganjerry@gmail.com> - 6.5-4
- Rebuild for ntl 9.1.0

* Tue May  5 2015 Peter Robinson <pbrobinson@fedoraproject.org> 6.5-3
- Drop old F-18 comparisions
- Build on ARMv7, all deps now met

* Sun Apr 26 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.5-2
- Add patch to work with ipython 3

* Fri Apr  3 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.5-1
- Update to sagemath 6.5
- Add new Catalan and Hungarian doc subpackages
- Add customizations to not need a patched pari
- Add "with docs" test build option
- Convert build conditionals to use bcond
- Correct deprecated warning when loading sagenb

* Sat Feb  7 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.4.1-4
- Rebuild with a functional jsmol interface (#1190356)

* Mon Feb  2 2015 Jerry James <loganjerry@gmail.com> - 6.4.1-3
- Rebuild for ntl 8.1.2

* Thu Jan 15 2015 Jerry James <loganjerry@gmail.com> - 6.4.1-2
- Rebuild for ntl 8.1.0
- Future-proof the gap package names

* Wed Nov 26 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.4.1-1
- Update to sagemath 6.4.1 (#1095282)

* Sat Nov 1 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.3-4
- Install 128x128 icon (#1157575)

* Mon Oct 27 2014 Jerry James <loganjerry@gmail.com>
- Rebuild for m4ri 20140914 and ntl 6.2.1

* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Wed Aug 13 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.3-1
- Update to sagemath 6.3 (#1095282)
- Add new doc-it Italian documentation subpackage

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon May 26 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.2-1
- Update to sagemath 6.2 (#1095282)
- Rebuild with Singular 3.1.6 (#1074597)
- Add missing python-docutils requires (#1056374)
- Correct uninstall of sagemath-notebook (#1097428)
- Enable coin-or-Cbc interface
- Make coin-or-Cbc not optional
- Make lrcalc not optional
- Use upstream patch to support pari 2.7
- Rediff ntl6 patch

* Wed Apr  2 2014 Jerry James <loganjerry@gmail.com> - 6.1.1-5
- Rebuild for ntl 6.1.0
- Fix ld ignoring __global_ldflags due to embedded trailing space
- Fix Singular paths in the build environment

* Wed Mar 19 2014 Jerry James <loganjerry@gmail.com> - 6.1.1-4
- Rebuild for libgap 4.7.4 and cryptominisat 2.9.9

* Mon Mar 10 2014 Rex Dieter <rdieter@fedoraproject.org> 6.1.1-3
- rebuild (Singular)

* Wed Feb 12 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.1.1-2
- Enable optional fes dependency
- Correct jmol applet interface
- Add missing python-twisted-mail requires (#1063061)
- Correct problems when starting sage for the first time as a new user
- Correct atlas library path for f21 or newer

* Fri Feb  7 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 6.1.1-1
- Update to sagemath 6.1.1

* Tue Jan 28 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.13-1
- Update to sagemath 5.13

* Fri Jan 17 2014 Jerry James <loganjerry@gmail.com> - 5.12-3
- Also adapt Requires to the new gap subpackage structure

* Wed Jan 15 2014 Jerry James <loganjerry@gmail.com> - 5.12-2
- Rebuild for libgap 4.7.2
- Adapt gap BRs to new gap subpackage structure

* Wed Oct 16 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.12-1
- Update to sagemath 5.12.

* Sat Sep 14 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.10-4
- Do not hardcode SAGE_BROWSER (#967251)
- Remove pre(trans) scriptlet used to upgrade from prototype packages

* Tue Sep 10 2013 Rex Dieter <rdieter@fedoraproject.org> 5.10-3
- pretrans scriplet uses shell commands (#1006230)

* Mon Aug 12 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.10-2
- Correct side effect of using system mpmath (#974769)

* Mon Aug  5 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.10-1
- Update to sagemath 5.10.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> 
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jul  3 2013 Jerry James <loganjerry@gmail.com> - 5.9-8
- Rebuild for maxima 5.30.0

* Wed Jun 12 2013 Remi Collet <rcollet@redhat.com> - 5.9-7
- rebuild for new GD 2.1.0

* Tue Jun  4 2013 Jerry James <loganjerry@gmail.com> - 5.9-6
- Rebuild for ecl 2013.5.1

* Sun May 12 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.9-5
- Need one extra directory derefence in symlink SAGE_SRC symlink.

* Sun May 12 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.9-4
- Correct wrong symlink to /builddir if not using pretrans (first install).

* Sat May 11 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.9-3
- Add pretrans for clean upgrade after rename of SAGE_DEVEL to SAGE_SRC.

* Sat May 11 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.9-2
- Build in f18 and f18 with workaround to cython wrong defines (#961372)

* Mon May 6 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.9-1
- Update to sagemath 5.9.
- Match upstream rename of SAGE_DEVEL to SAGE_SRC.
- Merged -buildroot in -rpmbuild patch.
- Drop cython 0.19 patch already applied to sagemath 5.9.
- Add macro conditionals to use same spec and patches in f18, f19 and f20.

* Mon May  6 2013 Jerry James <loganjerry@gmail.com> - 5.8-9
- Rebuild for libfplll 4.0.3, m4ri and m4rie 20130416, and ntl 6.0.0
- Drop sagemath-unpatched_ntl.patch now that Fedora's NTL is patched
- Add sagemath-ntl6.patch to adapt to NTL 6
- Add sagemath-m4rie.patch to adapt to m4rie 20130416

* Sat Apr 27 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-8
- Add surf-geometry to path for proper Singular plotting
- Add workaround to an rpm scriptlet problem (#877651#89)

* Tue Apr 23 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-7
- Correct problem of package requiring a -devel file to work.

* Tue Apr 23 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-6
- Correct a remaining arch specific file (symlink) in noarch package.

* Mon Apr 22 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-5
- Do not build requires optional rpy in f18 due to it being broken in f18
- Correct koji sanity check finding arch specific file in noarch package
- Add patch to build with just upgraded cython in rawhide

* Mon Apr 22 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-4
- Remove noop icon cache regeneration scriplets (#877651#72)
- First Fedora 18 and Fedora 19 approved package

* Sun Apr 14 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-3
- Use proper license tag for non versioned GPL attribution (#877651#63)
- Remove no longer required workarounds for clean upgrades (#877651#63)

* Fri Apr 12 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-2
- Properly describe the license breakdown in the spec (#877651#60)
- Correct lrslib requires to lrslib-utils (#877651#60)
- Remove zero length files (#877651#60)
- Correct png file with executable permission (#877651#60)
- Avoid rpmlint warning in rubiks subpackage description (#877651#60)

* Tue Mar 19 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.8-1
- Update to sagemath 5.8.
- Do full cleanup of notebook package on uninstall.
- Remove with_sage_cython build conditional.
- Remove with_sage_networkx build conditional.
- Add nopari2.6 patch to not rely on not yet available interfaces.
- Add cryptominisat patch to build package in f18.

* Sat Mar 16 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.7-3
- Create jmol symbolic links in post and remove in postun.
- Disable libgap by default as it does not work with rawhide gap.
- Also add python-ipython to build requires to regenerate documentation.

* Wed Mar  6 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.7-2
- Add missing python-ipython requires (#877651#52)
- Enable libgap build in packager debug build (#877651#52)

* Fri Feb 22 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.7-1
- Update to sagemath 5.7.
- Add conditional patch for libgap.
- Add conditional patch for fes.
- Remove with_sage_ipython conditional.
- Add patch to create a libcsage with a soname.

* Mon Feb 18 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.6-6
- Rebuild with latest rawhide and f18 updates
- Make sagemath-notebook owner of its base data directory
- Explicitly mark notebook translations as %%lang (#877651#c46)
- Remove sage3d as it is not functional in the rpm package (#877651#c46)
- Remove reference to buildroot in libcsage.so debuginfo

* Fri Feb 15 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.6-5
- Export CFLAGS and CXXFLAGS (#877651#c45)
- Make sagemath-data owner of SAGE_SHARE (#877651#c45)
- Relocate SAGE_DOC and make sagemath-doc packages noarch (#877651#c45)
- Relocate SAGE_SHARE and make sagemath-data packages noarch (#877651#c45)
- Remove sagenb binary egg bundled in tarball (#877651#c45)
- Update license tag due to unlisted Apache v2 license (#877651#c45)
- Break down licenses in files listing (#877651#c45)
- Add post scriplets to handle the installed icon (#877651#c45)
- Do not install empty directories in SAGE_EXTCODE (#877651#c45)
- Do not install bundled mathjax fonts (#877651#c45)
- Add a descriptive comment to patches without one (#877651#c45)
- Correct mispelled donwload_tarball macro name (#877651#c45)
- Remove reference to buildroot in prep (#877651#c45)
- Simplify coin-or-Cbc build requires as it has proper dependencies

* Sun Feb 10 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.6-4
- Correct "canonicalization unexpectedly shrank by one character" error.
- Add packager_debug macro for conditional package debug mode build.
- Add donwload_tarball macro to avoid fedora-review donwloading it every run.

* Sat Feb  9 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.6-3
- Add cryptominisat-devel to build requires.
- Add conditional build for lrcalc (fedora review rhbz #909510)
- Add conditional build for coin-or-CoinUtils (fedora review rhbz #894585)
- Add conditional build for coin-or-Osi (fedora review rhbz #894586)
- Add conditional build for coin-or-Clp (fedora review rhbz #894587)
- Add conditional build for coin-or-Cgl (fedora review rhbz #894588)
- Add conditional build for coin-or-Cbc (fedora review rhbz #894597)
- Rebuild with latest rawhide and f18 dependency updates.

* Mon Jan 28 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.6-2
- Rebuild with latest rawhide and f18 updates.

* Fri Jan 25 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.6-1
- Update to sagemath 5.6.
- Remove no longer required patch to build with system cython.

* Sat Jan 19 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.5-3
- Rediff rpmbuild patch to address some underlinked modules.
- Make gap-sonata a mandatory requires.
- Add cremona patch to adjust logic as only cremona mini is built.
- Add lrslib patch to know lrslib is available.
- Add nauty patch and comment about reason it cannot be made available.
- Add gap-hap patch for better description of missing gap hap package.

* Fri Jan 04 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.5-2
- Add cython to build requires (#877651#c28).

* Sat Dec 29 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.5-1
- Update to sagemath 5.5.
- Add maxima.system patch to work with maxima 5.29.1 package.

* Fri Dec 14 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.1-5
- Build with system cython by default on fedora 18 or newer (#877651).

* Fri Dec 14 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.1-4
- The fplll patch is also required to build in f18.
- Add factory include to plural.pyx build.

* Wed Dec 05 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.1-3
- Revert requires python-matplotlib-tk as it was a python-matplotlib bug.
- Add stix-fonts requires.

* Sat Dec 01 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.1-2
- Change back to install .c and .h files in bundled cython.
- Make symlink of gmp-ecm to $SAGE_LOCAL/bin/ecm.
- Add SAGE_LOCAL/bin to python path so that "sage -gdb" works.
- Require python-matplotlib-tk to avoid possible import error in doctests.

* Fri Nov 30 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.1-1
- Update to sagemath 5.4.1.

* Tue Nov 20 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4-2
- Do not install alternate cygdb in %%_bindir
- Create the sagemath-core subpackage
- Create the sagemath-doc subpackage
- Create the sagemath-doc-en subpackage
- Create the sagemath-doc-de subpackage
- Create the sagemath-doc-fr subpackage
- Create the sagemath-doc-pt subpackage
- Create the sagemath-doc-ru subpackage
- Create the sagemath-doc-tr subpackage
- Create the sagemath-data metapackage
- Create the sagemath-data-conway_polynomials subpackage
- Create the sagemath-data-elliptic_curves subpackage
- Create the sagemath-data-extcode subpackage
- Do not install pickle_jar extcode contents
- Do not install notebook extcode contents
- Create the sagemath-data-graphs subpackage
- Create the sagemath-data-polytopes_db subpackage
- Create the sagemath-notebook subpackage
- Create the sagemath-rubiks subpackage
- Create the sagemath-sagetex subpackage

* Mon Nov 12 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4-1
- Update to sagemath 5.4.
- Build with system networkx.
- Install only one fallback icon.
- Prevent rpm from providing private shared object.
- Change base directory to %%{_libdir} to avoid rpmlint errors.
- Correct permissions of installed shared objects.
- Rename most patches to use %%{name} prefix as "suggested" by fedora-review.
- Remove bundled jar files before %%build.
- Make cube solvers build optional and disabled by default.
- Add option to run "sage -testall" during package build.

* Sat Nov 10 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.beta1-4
- Add patch to make jmol export image functional
- Update pari patch to use proper path to gprc.expect
- Force usage of firefox in notebook (known to work are firefox and chromium)

* Fri Oct 26 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.beta1-3
- Add support for releases with libmpc 0.9.

* Wed Oct 24 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.beta1-2
- Add Portuguese translations of Tutorial and A Tour of Sage

* Sat Oct 20 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.4.beta1-1
- Update to sagemath 5.4.beta1
- Removed already applied upstream linbox upgrade patch
- Removed already applied upstream givaro upgrade patch
- Removed already applied upstream singular upgrade patch
- Install rubiks spkg binaries

* Wed Sep 12 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.3-1
- Update to sagemath 5.3.
- Remove version from patches name.
- Drop m4ri patch already applied to upstream.

* Fri Sep 7 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.2-2
- Add sphinx workaround to have editable tutorial forms (#839321)
- Make interactive 3d plots using jmol applet functional (#837166)
- Use system genus2reduction
- Add workaround to mp_set_memory_functions call from pari library

* Sat Aug 4 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.2-1
- Update to sagemath 5.2.

* Sun Jul 1 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 5.0.1-1
- Initial sagemath spec.