Add -buildroot patch and only build cython interfaces once.

Also:
- Drop LANGUAGES variable setting, now ignored by the sagemath build system.
- Drop unused SAGE_CBLAS variable from /usr/bin/sage.
- Do not force the C locale when launching sagemath.
- Allow the user to override SAGE_DEBUG in /usr/bin/sage.
- Add -ecm, -giac, and -latte patches to fix interactions with external tools.
- Add -sigfpe patch from upstream.
- Fix flask_autoindex and flask_openid imports in sagenb.
- Add Education category to the desktop file (bz 1624545).
- Fix SINGULAR_SO variable in /usr/bin/sage (bz 1636759 and 1655248).
- Invoke twistd-2 instead of twistd (bz 1640890).
- Improve jupyter integration (bz 1663165).
- Move existing jupyter integration into the notebook subpackage.
- Require python-jupyter-filesystem instead of owning its directories.
- Drop one more remnant of the F24 to F25 upgrade fixup.
This commit is contained in:
Jerry James 2019-01-19 09:07:04 -07:00
parent 1a0bd1afc6
commit 87098dcde0
8 changed files with 301 additions and 56 deletions

View file

@ -1,6 +1,6 @@
%global __provides_exclude_from .*/site-packages/.*\\.so
# This package install python files in nonstandard places
# This package installs python files in nonstandard places
%global _python_bytecompile_extra 0
%bcond_with bundled_pexpect
@ -86,7 +86,7 @@
Name: sagemath
Summary: A free open-source mathematics software system
Version: 8.3
Release: 1%{?dist}
Release: 2%{?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
@ -97,8 +97,11 @@ Source1: gprc.expect
# 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
# Fix ecm interact() command
Patch0: %{name}-ecm.patch
# Adapt a giac doctest to recent versions of giac
Patch1: %{name}-giac.patch
# Set of patches to work with system wide packages
Patch2: %{name}-scripts.patch
@ -145,6 +148,9 @@ Patch11: %{name}-cremona.patch
# http://pallini.di.uniroma1.it/
Patch13: %{name}-nauty.patch
# remove the buildroot path from Cython output
Patch14: %{name}-buildroot.patch
# correct path to Lfunction include
# update c++ standard to fix FTBFS
Patch15: %{name}-lcalc.patch
@ -175,7 +181,7 @@ Patch22: %{name}-qepcad.patch
Patch23: %{name}-arb.patch
# No support for f" notation
Patch24: %{name}-nofstring.patch
Patch24: %{name}-nofstring.patch
# Add missing include paths
Patch25: %{name}-includes.patch
@ -186,6 +192,12 @@ Patch26: %{name}-atlas.patch
# Adapt to recent versions of eclib
Patch27: %{name}-eclib.patch
# Fix paths to latte-integrale binaries
Patch28: %{name}-latte.patch
# Upstream fixes for random SIGFPEs due to ecl messing with the fp state
Patch29: %{name}-sigfpe.patch
BuildRequires: 4ti2
BuildRequires: arb-devel
BuildRequires: atlas-devel
@ -644,6 +656,7 @@ This package contains the Turkish %{name} documentation.
%package notebook
Summary: The Sage Notebook
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python-jupyter-filesystem
%description notebook
The Sage Notebook is a web-based graphical user interface for
@ -825,6 +838,7 @@ pushd build/pkgs/widgetsnbextension
popd
%endif
%patch0
%patch1
%patch2
%patch3
@ -837,6 +851,7 @@ popd
%patch10
%patch11
%patch13
%patch14
%patch15
%patch16
%patch17
@ -855,12 +870,15 @@ popd
%patch25
%patch26
%patch27
%patch28
%patch29
sed -e 's|@@SAGE_ROOT@@|%{SAGE_ROOT}|' \
-e 's|@@SAGE_DOC@@|%{SAGE_DOC}|' \
-i src/sage/env.py
sed -e 's|@@CYSIGNALS@@|%{python2_sitearch}/cysignals|' \
-e 's|@@BUILDROOT@@|%{buildroot}|' \
-i src/setup.py
sed -e "/flask-oldsessions/d" \
@ -889,6 +907,7 @@ grep -FrlZ '#!%{_bindir}/env python' | \
xargs -0 sed -i 's,#!%{_bindir}/env python,#!%{__python2},'
grep -FrlZ '#!%{_bindir}/env sage-python23' | \
xargs -0 sed -i 's,#!%{_bindir}/env sage-python23,#!%{__python2},'
grep -FrlZ 'sage-python23' | xargs -0 sed -i 's,sage-python23,#!%{__python2},'
grep -FrlZ '#!%{_bindir}/env' | \
xargs -0 sed -i 's,#!%{_bindir}/env ,#!%{_bindir}/,'
grep -rlZ '#!%{_bindir}/python$' | xargs -0 sed -i 's,#!%{_bindir}/python$,&2,'
@ -906,6 +925,12 @@ sed -e "s|'%{_bindir}/env', 'which'|'%{_bindir}/which'|" \
-i build/pkgs/ipython/src/IPython/utils/_process_posix.py
%endif
# Fix twistd invocation; the python3 version has no suffix
sed -i 's/exec twistd/&-2/' src/bin/sage
# GAP does not have enough memory to load the entire workspace
sed -i 's/64m/128m/' src/sage/libs/gap/util.pyx
########################################################################
%build
export CC=%{__cc}
@ -1005,16 +1030,6 @@ 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
@ -1068,8 +1083,8 @@ pushd src/ext
if [ $COUNT -gt 0 ]; then
cp -far $dir $SAGE_ETC
fi
cp -far pari $SAGE_ETC
done
cp -far pari $SAGE_ETC
cp -fa %{SOURCE1} $SAGE_ETC
popd
@ -1274,7 +1289,7 @@ popd
cat > %{buildroot}%{_bindir}/sage << EOF
#!/bin/bash -i
export CUR=\`pwd\`
export CUR=\$PWD
##export DOT_SAGE="\$HOME/.sage"
mkdir -p \$DOT_SAGE/{maxima,sympow,tmp}
export SAGE_TESTDIR=\$DOT_SAGE/tmp
@ -1286,23 +1301,22 @@ export SAGE_ETC="$SAGE_ETC"
export SAGE_SRC="%{buildroot}%{SAGE_SRC}"
##export SAGE_DOC="$SAGE_DOC"
##export SAGE_DOC_SRC="\$SAGE_DOC"
##export SAGE_PKGS="\$SAGE_LOCAL//var/lib/sage/installed"
##export SAGE_PKGS="\$SAGE_LOCAL/var/lib/sage/installed"
module load 4ti2-%{_arch}
module load lrcalc-%{_arch}
module load surf-geometry-%{_arch}
export PATH=$SAGE_LOCAL/bin:\$PATH
export SINGULAR_DATA_DIR=%{_datadir}
export SINGULAR_BIN_DIR=%{_libdir}/Singular
export SINGULAR_SO=%{_libdir}/libSingular-4.1.1.so
export SINGULAR_SO=%{_libdir}/libSingular-4.1.0.so
##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_ALL=C.UTF-8
export LD_LIBRARY_PATH=\$SAGE_ROOT/lib:\$LD_LIBRARY_PATH
# Required for sage -gdb
export SAGE_DEBUG=no
: \${SAGE_DEBUG:=no}
export SAGE_DEBUG
$SAGE_LOCAL/bin/sage "\$@"
EOF
#------------------------------------------------------------------------
@ -1361,7 +1375,7 @@ pushd src/doc
export SAGE_DOC_SRC=$SAGE_DOC
# python -m sage_setup.docbuild
# Build with an X server running, required by some doc builders
SAGE_NUM_THREADS=2 LANGUAGES="ca de en fr hu it ja pt ru tr" \
SAGE_NUM_THREADS=2 \
xvfb-run -a -n 1 %__python2 -m docbuild --no-pdf-links -k all html -j
rm -f %{buildroot}%{SAGE_SRC}/doc
ln -sf %{SAGE_DOC} %{buildroot}%{SAGE_SRC}/doc
@ -1426,7 +1440,7 @@ Exec=sage
Icon=%{name}
Terminal=true
Type=Application
Categories=Science;Math;
Categories=Education;Science;Math;
EOF
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
@ -1519,6 +1533,18 @@ chmod +x %{buildroot}%{SAGE_LOCAL}/bin/sage-list-packages
# Byte compile python files in nonstandard places
%py_byte_compile %{__python2} %{buildroot}%{_texmf_main}/tex/latex/sagetex
#------------------------------------------------------------------------
# Jupyter integration
mkdir -p %{buildroot}%{_datadir}/jupyter/kernels/sagemath
pushd %{buildroot}%{_datadir}/jupyter/kernels/sagemath
ln -s %{_docdir}/%{name}/html/en doc
ln -s %{SAGE_ETC}/notebook-ipython/logo-64x64.png logo-64x64.png
ln -s %{SAGE_ETC}/notebook-ipython/logo.svg logo.svg
cat > kernel.json << EOF
{"display_name": "SageMath %{version}", "argv": ["%{_bindir}/sage", "--python", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"]}
EOF
popd
# last install command
rm -fr $DOT_SAGE
@ -1581,14 +1607,6 @@ rm -fr $DOT_SAGE
%if %{with bundled_ipywidgets}
%{SAGE_PYTHONPATH}/ipywidgets
%endif
%if %{with bundled_widgetsnbextension}
%dir %{_sysconfdir}/jupyter
%dir %{_sysconfdir}/jupyter/nbconfig
%dir %{_sysconfdir}/jupyter/nbconfig/notebook.d
%config(noreplace) %{_sysconfdir}/jupyter/nbconfig/notebook.d/*.json
%{_datadir}/jupyter/
%{python2_sitelib}/widgetsnbextension*
%endif
#------------------------------------------------------------------------
%files data
@ -1697,6 +1715,10 @@ rm -fr $DOT_SAGE
# with docs
%endif
#------------------------------------------------------------------------
%files jupyter
%{_datadir}/jupyter/kernels/sagemath/
#------------------------------------------------------------------------
%files notebook
%{SAGE_ETC}/notebook-ipython
@ -1722,7 +1744,6 @@ rm -fr $DOT_SAGE
%{python2_sitearch}/sagenb/data/json
# Symbolic link to $_jsdir/mathjax
%{python2_sitearch}/sagenb/data/mathjax
%ghost %{python2_sitearch}/sagenb/data/mathjax.rpmmoved
# Empty (do not run doctests flag file)
%{python2_sitearch}/sagenb/data/nodoctest.py*
# BSD
@ -1765,6 +1786,12 @@ rm -fr $DOT_SAGE
%lang(pt_BR) %{python2_sitearch}/sagenb/translations/pt_BR
%lang(ru_RU) %{python2_sitearch}/sagenb/translations/ru_RU
%lang(uk_UA) %{python2_sitearch}/sagenb/translations/uk_UA
%if %{with bundled_widgetsnbextension}
%config(noreplace) %{_sysconfdir}/jupyter/nbconfig/notebook.d/*.json
%{_datadir}/jupyter/nbextensions/
%{python2_sitelib}/widgetsnbextension*
%endif
%{_datadir}/jupyter/kernels/sagemath/
#------------------------------------------------------------------------
%files notebook-export
@ -1794,6 +1821,23 @@ rm -fr $DOT_SAGE
########################################################################
%changelog
* Sat Jan 19 2019 Jerry James <loganjerry@gmail.com> - 8.3-2
- Add -buildroot patch and only build cython interfaces once
- Drop LANGUAGES variable setting, now ignored by the sagemath build system
- Drop unused SAGE_CBLAS variable from /usr/bin/sage
- Do not force the C locale when launching sagemath
- Allow the user to override SAGE_DEBUG in /usr/bin/sage
- Add -ecm, -giac, and -latte patches to fix interactions with external tools
- Add -sigfpe patch from upstream
- Fix flask_autoindex and flask_openid imports in sagenb
- Add Education category to the desktop file (bz 1624545)
- Fix SINGULAR_SO variable in /usr/bin/sage (bz 1636759 and 1655248)
- Invoke twistd-2 instead of twistd (bz 1640890)
- Improve jupyter integration (bz 1663165)
- Move existing jupyter integration into the notebook subpackage
- Require python-jupyter-filesystem instead of owning its directories
- Drop one more remnant of the F24 to F25 upgrade fixup
* Sat Sep 22 2018 Jerry James <loganjerry@gmail.com> - 8.3-1
- Update to sagemath 8.3 (bz 1612867)
- Drop -lrslib, -gap-hap, and -flask patches