summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO108
-rw-r--r--PKGBUILD175
-rw-r--r--anal.h65
-rw-r--r--clean.patch23
-rw-r--r--disable-fes.patch19
-rw-r--r--env.patch132
-rw-r--r--extensions.patch12
-rw-r--r--ntl9.patch178
-rw-r--r--package.patch11
-rw-r--r--paths.patch33
-rw-r--r--pexpect-del.patch15
-rw-r--r--pexpect-env.patch32
-rw-r--r--skip-check.patch21
13 files changed, 824 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2eae6857a715
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,108 @@
+pkgbase = sagemath-git
+ pkgdesc = Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab
+ pkgver = 6.8.beta3.r0.g336ae6c
+ pkgrel = 1
+ url = http://www.sagemath.org
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = cython2-devel
+ makedepends = boost
+ makedepends = ratpoints
+ makedepends = symmetrica
+ makedepends = fflas-ffpack
+ makedepends = python2-jinja
+ makedepends = coin-or-cbc
+ makedepends = mcqd
+ makedepends = coxeter3
+ makedepends = cryptominisat
+ makedepends = arb
+ makedepends = modular_decomposition
+ makedepends = bliss-graphs
+ depends = ipython2
+ depends = ppl
+ depends = glpk
+ depends = mpfi
+ depends = palp
+ depends = polybori
+ depends = singular
+ depends = libcliquer
+ depends = maxima-ecl
+ depends = gfan
+ depends = sympow
+ depends = tachyon
+ depends = python2-rpy2
+ depends = python2-matplotlib
+ depends = python2-scipy
+ depends = python2-sympy
+ depends = python2-networkx
+ depends = libgap
+ depends = gap
+ depends = flintqs
+ depends = lcalc
+ depends = lrcalc
+ depends = eclib
+ depends = gmp-ecm
+ depends = zn_poly
+ depends = gd
+ depends = python2-cvxopt
+ depends = pynac
+ depends = linbox
+ depends = gsl
+ depends = rubiks
+ depends = pari-galdata
+ depends = pari-seadata-small
+ depends = planarity
+ depends = sage-data-combinatorial_designs
+ depends = sage-data-elliptic_curves
+ depends = sage-data-graphs
+ depends = sage-data-polytopes_db
+ depends = sage-data-conway_polynomials
+ optdepends = cython2: to compile cython code
+ optdepends = jmol: 3D plots
+ optdepends = sage-notebook: Browser-based (flask) notebook interface
+ optdepends = sagemath-doc: Documentation and inline help
+ optdepends = sagemath-src: source files needed to build cython code
+ optdepends = ipython2-notebook: IPython notebook interface
+ optdepends = mathjax: IPython notebook interface
+ optdepends = coin-or-cbc: COIN backend for numerical computations
+ optdepends = nauty: for generating some classes of graphs
+ optdepends = buckygen: for generating fullerene graphs
+ optdepends = plantri: for generating some classes of graphs
+ optdepends = benzene: for generating fusenes and benzenoids
+ optdepends = modular_decomposition: modular decomposition of graphs
+ optdepends = lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes
+ optdepends = imagemagick: to show animations
+ optdepends = coxeter3: Coxeter groups implementation
+ optdepends = cryptominisat: SAT solver
+ optdepends = arb: floating-point ball arithmetic
+ provides = sagemath
+ provides = sage-mathematics
+ conflicts = sagemath
+ source = git://git.sagemath.org/sage.git#branch=develop
+ source = http://mirrors.mit.edu/sage/spkg/upstream/pexpect/pexpect-2.0.tar.bz2
+ source = anal.h
+ source = package.patch
+ source = env.patch
+ source = paths.patch
+ source = clean.patch
+ source = skip-check.patch
+ source = pexpect-env.patch
+ source = pexpect-del.patch
+ source = ntl9.patch
+ source = disable-fes.patch
+ md5sums = SKIP
+ md5sums = d9a3e113ed147dcee8f89962a8dccd43
+ md5sums = a906a180d198186a39820b0a2f9a9c63
+ md5sums = 0eb5ac1537aac93bd67a2925c0cfd84d
+ md5sums = a97ad60cca257b389f1e6e60eef2525f
+ md5sums = 020bdb34b6fc0f2c9f46341bdb79937a
+ md5sums = 46c212a3a6713b0f78c370c7186d0982
+ md5sums = 5947a420a0b1483f0cbc74c76895789b
+ md5sums = a83a3b1bc7fcb7cbf752a83a8311fc42
+ md5sums = f333939ea6c41377b66407c81016cee4
+ md5sums = 308abbb1a49db9b8f0e088aff69567ff
+ md5sums = 4eb23a3c7363258bc9ba764d6e5512ba
+
+pkgname = sagemath-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..03ffa57d46a6
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,175 @@
+# $Id: PKGBUILD 118896 2014-09-13 07:12:02Z arcanis $
+# Maintainer: Evgeniy Alekseev <arcanis.arch at gmail dot com>
+# Maintainer: Antonio Rojas <arojas@archlinux.org>
+# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
+# Contributor: Thomas Dziedzic <gostrc at gmail dot com>
+# Contributor: Osman Ugus <ugus11 at yahoo dot com>
+# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
+# Special thanks to Nareto for moving the compile from the .install to the PKGBUILD
+
+pkgname=sagemath-git
+pkgver=6.8.beta3.r0.g336ae6c
+pkgrel=1
+pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
+arch=('i686' 'x86_64')
+url="http://www.sagemath.org"
+license=('GPL')
+depends=('ipython2' 'ppl' 'glpk' 'mpfi' 'palp' 'polybori' 'singular' 'libcliquer' 'maxima-ecl' 'gfan' 'sympow' 'tachyon' 'python2-rpy2'
+ 'python2-matplotlib' 'python2-scipy' 'python2-sympy' 'python2-networkx' 'libgap' 'gap' 'flintqs' 'lcalc' 'lrcalc'
+ 'eclib' 'gmp-ecm' 'zn_poly' 'gd' 'python2-cvxopt' 'pynac' 'linbox' 'gsl' 'rubiks' 'pari-galdata' 'pari-seadata-small' 'planarity'
+ 'sage-data-combinatorial_designs' 'sage-data-elliptic_curves' 'sage-data-graphs' 'sage-data-polytopes_db' 'sage-data-conway_polynomials')
+optdepends=('cython2: to compile cython code'
+ 'jmol: 3D plots'
+ 'sage-notebook: Browser-based (flask) notebook interface'
+ 'sagemath-doc: Documentation and inline help'
+ 'sagemath-src: source files needed to build cython code'
+ 'ipython2-notebook: IPython notebook interface'
+ 'mathjax: IPython notebook interface'
+ 'coin-or-cbc: COIN backend for numerical computations'
+ 'nauty: for generating some classes of graphs'
+ 'buckygen: for generating fullerene graphs'
+ 'plantri: for generating some classes of graphs'
+ 'benzene: for generating fusenes and benzenoids'
+ 'modular_decomposition: modular decomposition of graphs'
+ 'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
+ 'imagemagick: to show animations'
+ 'coxeter3: Coxeter groups implementation'
+ 'cryptominisat: SAT solver'
+ 'arb: floating-point ball arithmetic')
+makedepends=('cython2-devel' 'boost' 'ratpoints' 'symmetrica' 'fflas-ffpack' 'python2-jinja' 'coin-or-cbc'
+ 'mcqd' 'coxeter3' 'cryptominisat' 'arb' 'modular_decomposition' 'bliss-graphs')
+conflicts=('sagemath')
+provides=('sagemath' 'sage-mathematics')
+source=("git://git.sagemath.org/sage.git#branch=develop"
+"http://mirrors.mit.edu/sage/spkg/upstream/pexpect/pexpect-2.0.tar.bz2" 'anal.h'
+'package.patch' 'env.patch' 'paths.patch' 'clean.patch' 'skip-check.patch'
+'pexpect-env.patch' 'pexpect-del.patch' 'ntl9.patch' 'disable-fes.patch')
+md5sums=('SKIP'
+ 'd9a3e113ed147dcee8f89962a8dccd43'
+ 'a906a180d198186a39820b0a2f9a9c63'
+ '0eb5ac1537aac93bd67a2925c0cfd84d'
+ 'a97ad60cca257b389f1e6e60eef2525f'
+ '020bdb34b6fc0f2c9f46341bdb79937a'
+ '46c212a3a6713b0f78c370c7186d0982'
+ '5947a420a0b1483f0cbc74c76895789b'
+ 'a83a3b1bc7fcb7cbf752a83a8311fc42'
+ 'f333939ea6c41377b66407c81016cee4'
+ '308abbb1a49db9b8f0e088aff69567ff'
+ '4eb23a3c7363258bc9ba764d6e5512ba')
+
+pkgver() {
+ cd sage
+ git describe --long --tags | sed -r 's/([^-]*-g)/r\1/;s/-/./g'
+}
+
+
+prepare(){
+ cd sage
+
+# Arch-specific patches
+# assume all optional packages are installed
+ patch -p0 -i "$srcdir"/package.patch
+# find L.h header
+ sed -e 's|libLfunction|Lfunction|' -i src/module_list.py
+# don't try to link against libpng 1.2
+ sed -e 's|png12|png|' -i src/module_list.py
+# set env variables
+ patch -p0 -i "$srcdir"/env.patch
+# fix paths in python imports
+ patch -p0 -i "$srcdir"/paths.patch
+# fix cython linking
+ sed -e "s| atlas(),||" -i src/sage/misc/cython.py
+# don't try to remove installed files
+ patch -p0 -i "$srcdir"/clean.patch
+# skip checking build status
+ patch -p0 -i "$srcdir"/skip-check.patch
+# supress warning about GAP install dir
+ sed -e "s|gapdir = os.path.join(SAGE_LOCAL, 'gap', 'latest')|gapdir = '/usr/lib/gap'|" -i src/sage/libs/gap/util.pyx
+# fix Cremona database detection
+ sed -e "s|is_package_installed('database_cremona_ellcurve')|os.path.exists('/usr/share/sage/cremona/cremona.db')|" \
+ -i src/sage/databases/cremona.py
+# fix IPython kernel path
+ sed -e "s|os.path.join(SAGE_ROOT, 'sage')|'/usr/bin/sage'|" -i src/sage/repl/ipython_kernel/install.py
+# find bliss headers
+ sed -e 's|graph.hh|bliss/graph.hh|' -i src/sage/graphs/bliss.pyx
+# Rename class to fix conflicts with NTL
+ sed -e 's|WrappedPtr|SageWrappedPtr|' -i src/sage/libs/polybori/decl.pxd -i src/sage/libs/polybori/pb_wrap.h
+# Disable fes module, broken upstream
+ patch -p0 -i "$srcdir"/disable-fes.patch
+
+# Upstream patches
+# fix build aginst NTL 9 (Fedora)
+ patch -p0 -i "$srcdir"/ntl9.patch
+
+# use python2
+ sed -e 's|#!/usr/bin/env python|#!/usr/bin/env python2|' -e 's|exec python|exec python2|' -i src/bin/*
+ sed -e 's|cython %s %s|cython2 %s %s|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
+ sed -e 's|exec ipython|exec ipython2|' -e 's|cygdb|cygdb2|' -i src/bin/sage
+ sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
+ sed -e 's|python -c|python2 -c|' -i src/Makefile
+
+# copy required private PARI header
+ mkdir -p src/pari
+ cp "$srcdir"/anal.h src/pari/anal.h
+
+# remove developer interface
+ rm -r src/sage/dev
+
+ cd "$srcdir"/pexpect-2.0
+# fix env in pexpect
+ patch -p1 -i "$srcdir"/pexpect-env.patch
+# hide exceptions in pexpect
+ patch -p1 -i "$srcdir"/pexpect-del.patch
+}
+
+
+build() {
+ cd sage/src
+
+ export SAGE_LOCAL="/usr"
+ export SAGE_SRC="$PWD"
+ export CC=gcc
+
+ make sage/libs/pari/auto_gen.pxi
+ make sage/ext/interpreters/__init__.py
+
+ python2 setup.py build
+
+# build pexpect
+ pushd "$srcdir"/pexpect-2.0
+ python2 setup.py build
+ popd
+}
+
+
+package() {
+ cd sage/src
+
+ export SAGE_ROOT="/usr"
+ export SAGE_LOCAL="$SAGE_ROOT"
+ export SAGE_SRC="$PWD"
+
+ python2 setup.py install --root="$pkgdir" --optimize=1
+
+ mkdir -p "$pkgdir"/usr/bin
+ cp bin/sage "$pkgdir"/usr/bin
+ for _i in arch-env banner cachegrind callgrind cleaner coverage coverageall CSI CSI-helper.py cython env eval grep grepdoc inline-fortran ipython \
+ massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run run-cython runtests startuptime.py \
+ sws2rst valgrind version.sh
+ do
+ cp bin/sage-$_i "$pkgdir"/usr/bin
+ done
+ cp bin/math-readline "$pkgdir"/usr/bin
+
+ mkdir -p "$pkgdir"/usr/share/sage
+ cp -r ext "$pkgdir"/usr/share/sage
+
+# Create SAGE_SRC, needed for the notebook
+ mkdir "$pkgdir"/usr/share/sage/src
+
+# Install Sage's own pexpect
+ cd "$srcdir"/pexpect-2.0
+ python2 setup.py install --root="$pkgdir" --optimize=1
+ mkdir -p "$pkgdir"/usr/lib/sage/site-packages/
+ mv "$pkgdir"/usr/lib/python2.7/site-packages/pexpect* "$pkgdir"/usr/lib/sage/site-packages/
+}
diff --git a/anal.h b/anal.h
new file mode 100644
index 000000000000..f77d47025c97
--- /dev/null
+++ b/anal.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2000 The PARI group.
+
+This file is part of the PARI/GP package.
+
+PARI/GP is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation. It is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY WHATSOEVER.
+
+Check the License for details. You should have received a copy of it, along
+with the package; see the file 'COPYING'. If not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+/*************************************************************************/
+/* */
+/* Declarations specific to the analyzer */
+/* */
+/*************************************************************************/
+BEGINEXTERN
+/* GP control structures */
+#define EXPR_WRAP(code, call) \
+{ GEN z; GEN __E = code; \
+ push_lex(gen_0, __E); z = call; pop_lex(1); return z; }
+#define EXPR_ARG __E, &gp_eval
+#define EXPR_ARGUPTO __E, &gp_evalupto
+#define EXPR_ARGBOOL __E, &gp_evalbool
+
+/* functions */
+void changevalue(entree *ep, GEN val);
+void freeep(entree *ep);
+void pari_fill_hashtable(entree **table, entree *ep);
+
+void compile_err(const char *msg, const char *str);
+void compile_varerr(const char *str);
+
+#ifdef STACK_CHECK
+extern THREAD void *PARI_stack_limit;
+#endif
+
+extern entree **varentries;
+
+struct node_loc
+{
+ const char *start,*end;
+};
+
+union token_value { long val; };
+
+int pari_lex(union token_value *yylval, struct node_loc *yylloc, char **lex);
+int pari_parse(char **lex);
+entree* fetch_entry(const char *s, long len);
+entree* fetch_member(const char *s, long len);
+void pari_close_parser(void);
+void pari_close_compiler(void);
+void pari_close_evaluator(void);
+void pari_init_parser(void);
+void pari_init_compiler(void);
+void pari_init_evaluator(void);
+void optimizenode(long n);
+void push_frame(GEN C, long lpc, long flag);
+const char * closure_func_err(void);
+GEN gp_closure(long n);
+long eval_mnemonic(GEN str, const char *tmplate);
+
+ENDEXTERN
diff --git a/clean.patch b/clean.patch
new file mode 100644
index 000000000000..c577d3d42114
--- /dev/null
+++ b/clean.patch
@@ -0,0 +1,23 @@
+--- src/setup.py.orig 2014-11-16 10:34:05.521441703 +0100
++++ src/setup.py 2014-11-16 10:34:16.054812569 +0100
+@@ -581,20 +581,6 @@
+
+
+ #########################################################
+-### Clean
+-#########################################################
+-
+-print('Cleaning up stale installed files....')
+-t = time.time()
+-from sage_setup.clean import clean_install_dir
+-output_dirs = SITE_PACKAGES + glob.glob(os.path.join(SAGE_SRC, 'build', 'lib*'))
+-for output_dir in output_dirs:
+- print('- cleaning {0}'.format(output_dir))
+- clean_install_dir(output_dir, python_packages, python_modules, ext_modules)
+-print('Finished cleaning, time: %.2f seconds.' % (time.time() - t))
+-
+-
+-#########################################################
+ ### Distutils
+ #########################################################
+
diff --git a/disable-fes.patch b/disable-fes.patch
new file mode 100644
index 000000000000..873a6a663cfb
--- /dev/null
+++ b/disable-fes.patch
@@ -0,0 +1,19 @@
+--- src/module_list.py.orig 2015-06-07 11:29:30.710612146 +0200
++++ src/module_list.py 2015-06-07 11:30:21.877506106 +0200
+@@ -685,11 +685,11 @@
+ include_dirs = [SAGE_INC + '/ecl'],
+ depends = [SAGE_INC + '/ecl/ecl.h']),
+
+- OptionalExtension("sage.libs.fes",
+- ["sage/libs/fes.pyx"],
+- language = "c",
+- libraries = ['fes'],
+- package = 'fes'),
++# OptionalExtension("sage.libs.fes",
++# ["sage/libs/fes.pyx"],
++# language = "c",
++# libraries = ['fes'],
++# package = 'fes'),
+
+ Extension('sage.libs.flint.flint',
+ sources = ["sage/libs/flint/flint.pyx"],
diff --git a/env.patch b/env.patch
new file mode 100644
index 000000000000..430823ca1f40
--- /dev/null
+++ b/env.patch
@@ -0,0 +1,132 @@
+--- src/bin/sage-env.orig 2015-01-06 10:46:04.469687605 +0100
++++ src/bin/sage-env 2015-01-06 10:49:59.547762019 +0100
+@@ -110,41 +110,7 @@
+ }
+
+
+-# New value for SAGE_ROOT: either SAGE_ROOT (if given)
+-# or a guessed value based on pwd.
+-if [ -n "$SAGE_ROOT" ]; then
+- NEW_SAGE_ROOT="$SAGE_ROOT"
+-elif [ -f sage -a -d build ]; then
+- NEW_SAGE_ROOT="."
+-elif [ -f ../../sage -a -d ../../build ]; then
+- NEW_SAGE_ROOT="../.."
+-else
+- # No idea what SAGE_ROOT should be...
+- echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
+- echo >&2 "script from the SAGE_ROOT or SAGE_ROOT/local/bin/ directory."
+- return 1
+-fi
+-
+-# Make NEW_SAGE_ROOT absolute
+-NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
+-
+-# Sanity check NEW_SAGE_ROOT
+-if [ -f "$NEW_SAGE_ROOT/sage" -a -d "$NEW_SAGE_ROOT/build" ]; then
+- :
+-else
+- echo >&2 "Error: SAGE_ROOT is set to a bad value:"
+- echo >&2 "SAGE_ROOT=$SAGE_ROOT"
+- echo >&2 "You must correct it or erase it and run this script from the SAGE_ROOT"
+- echo >&2 "or SAGE_ROOT/local/bin/ directory."
+- return 1
+-fi
+-
+-# Warn if NEW_SAGE_ROOT does not equal the old SAGE_ROOT
+-if [ "$SAGE_ROOT" != "$NEW_SAGE_ROOT" -a -n "$SAGE_ROOT" ]; then
+- echo >&2 "Warning: overwriting SAGE_ROOT environment variable:"
+- echo >&2 "Old SAGE_ROOT=$SAGE_ROOT"
+- echo >&2 "New SAGE_ROOT=$NEW_SAGE_ROOT"
+-fi
++NEW_SAGE_ROOT="/usr"
+
+ # Don't execute the commands more than once for the same version of
+ # sage-env. Check this after checking the validity of SAGE_ROOT, but
+@@ -245,20 +211,12 @@
+ fi
+
+ # Setting Sage-related location environment variables.
+-export SAGE_LOCAL="$SAGE_ROOT/local"
+-export SAGE_ETC="$SAGE_LOCAL/etc"
+-export SAGE_SHARE="$SAGE_LOCAL/share"
+-export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+-export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
+-export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
+-export SAGE_SRC="$SAGE_ROOT/src"
+-export SAGE_DOC="$SAGE_SRC/doc"
+-
+-if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
+- SAGE_ORIG_PATH=$PATH && export SAGE_ORIG_PATH
+- SAGE_ORIG_PATH_SET=True && export SAGE_ORIG_PATH_SET
+-fi
+-export PATH="$SAGE_SRC/bin:$SAGE_LOCAL/bin:$PATH"
++export SAGE_LOCAL="$SAGE_ROOT"
++export SAGE_ETC="/etc/sage"
++export SAGE_SHARE="$SAGE_LOCAL/share/sage"
++export SAGE_EXTCODE="$SAGE_SHARE/ext"
++export SAGE_SRC="$SAGE_SHARE/src"
++export SAGE_DOC="/usr/share/doc/sage"
+
+ # We offer a toolchain option, so if $SAGE_LOCAL/toolchain/toolchain-env exists source it.
+ # Since the user might do something crazy we do not do any checks, but hope for the best.
+@@ -309,9 +267,6 @@
+ GIT_TEMPLATE_DIR="$SAGE_LOCAL"/share/git-core/templates && export GIT_TEMPLATE_DIR
+ GIT_EXEC_PATH="$SAGE_LOCAL"/libexec/git-core && export GIT_EXEC_PATH
+
+-SINGULARPATH="$SAGE_LOCAL/share/singular" && export SINGULARPATH
+-SINGULAR_EXECUTABLE="$SAGE_LOCAL/bin/Singular" && export SINGULAR_EXECUTABLE
+-
+ if [ -z "$SAGE_REPO_ANONYMOUS" ]; then
+ SAGE_REPO_ANONYMOUS="git://trac.sagemath.org/sage.git"
+ export SAGE_REPO_ANONYMOUS
+@@ -363,25 +318,17 @@
+ export SAGE_STARTUP_FILE
+ fi
+
+-IPYTHONDIR=`find "$SAGE_SPKG_INST" -name "ipython*"`
+-if [ -n "$IPYTHONDIR" ]; then
+- export IPYTHONDIR="$DOT_SAGE/${IPYTHONDIR##*/}"
+-fi
++export IPYTHONDIR="$DOT_SAGE/ipython"
+
+ if [ "$PYTHON_EGG_CACHE" = "" ]; then
+ PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
+ export PYTHON_EGG_CACHE
+ fi
+
+-if [ -d "$SAGE_LOCAL/lib/python" ]; then
+- PYTHONPATH="$SAGE_LOCAL/lib/python:$SAGE_LOCAL/lib/python/site_packages"
+- if [ -n "$SAGE_PATH" ]; then
+- PYTHONPATH="$SAGE_PATH:$PYTHONPATH"
+- fi
+- PYTHONHOME="$SAGE_LOCAL"
+- export PYTHONPATH
+- export PYTHONHOME
+-fi
++PYTHONPATH="/usr/lib/sage/site-packages:$PYTHONPATH"
++PYTHONHOME="$SAGE_ROOT"
++export PYTHONPATH
++export PYTHONHOME
+
+ if [ -z "${SAGE_ORIG_LD_LIBRARY_PATH_SET}" ]; then
+ SAGE_ORIG_LD_LIBRARY_PATH=$LD_LIBRARY_PATH && export SAGE_ORIG_LD_LIBRARY_PATH
+@@ -431,8 +378,6 @@
+ R_MAKEVARS_SITE="$SAGE_LOCAL/lib/R/share/Makevars.site" && export R_MAKEVARS_SITE
+ R_MAKEVARS_USER="$SAGE_LOCAL/lib/R/share/Makevars.user" && export R_MAKEVARS_USER
+
+-MAXIMA_PREFIX="$SAGE_ROOT/local" && export MAXIMA_PREFIX
+-
+ ############ architecture flags
+
+ # Support flags to change the build architecture. Currently, this is
+@@ -602,9 +547,6 @@
+ LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
+ fi
+
+-# See trac 7186 -- this is needed if ecl is moved
+-ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
+-
+ # Handle parallel building/testing/...
+ # See Trac Ticket #12016
+ # First, figure out the right values for SAGE_NUM_THREADS (default
diff --git a/extensions.patch b/extensions.patch
new file mode 100644
index 000000000000..802155d974f9
--- /dev/null
+++ b/extensions.patch
@@ -0,0 +1,12 @@
+--- src/module_list.py.orig 2015-01-02 01:37:15.614093528 +0100
++++ src/module_list.py 2015-01-02 01:37:26.140827483 +0100
+@@ -2126,7 +2126,8 @@
+ # These extensions are to be compiled only if the
+ # corresponding packages have been installed
+
+-from sage.misc.package import is_package_installed
++def is_package_installed(name):
++ return False
+
+ if is_package_installed('fes'):
+ ext_modules.extend([
diff --git a/ntl9.patch b/ntl9.patch
new file mode 100644
index 000000000000..191491826e8e
--- /dev/null
+++ b/ntl9.patch
@@ -0,0 +1,178 @@
+--- ./src/sage/rings/bernmm/bernmm-test.cpp.orig 2015-02-16 17:15:12.000000000 -0700
++++ ./src/sage/rings/bernmm/bernmm-test.cpp 2015-05-07 21:39:58.565251320 -0600
+@@ -70,7 +70,7 @@ void bern_naive(mpq_t* res, long n)
+ */
+ int testcase__bern_modp_powg(long p, long k, mpq_t b)
+ {
+- double pinv = 1 / ((double) p);
++ wide_double pinv = wide_double(1) / wide_double(p);
+
+ // compute B_k mod p using _bern_modp_powg()
+ long x = _bern_modp_powg(p, pinv, k);
+@@ -147,7 +147,7 @@ int test__bern_modp_powg()
+ */
+ int testcase__bern_modp_pow2(long p, long k)
+ {
+- double pinv = 1 / ((double) p);
++ wide_double pinv = wide_double(1) / wide_double(p);
+
+ if (PowerMod(2, k, p, pinv) == 1)
+ return 1;
+--- ./src/sage/rings/bernmm/bern_modp.cpp.orig 2015-02-16 17:15:12.000000000 -0700
++++ ./src/sage/rings/bernmm/bern_modp.cpp 2015-05-07 20:17:37.680381004 -0600
+@@ -43,14 +43,14 @@ namespace bernmm {
+ pinv = 1 / ((double) p)
+ g = a multiplicative generator of GF(p), in [0, p)
+ */
+-long bernsum_powg(long p, double pinv, long k, long g)
++long bernsum_powg(long p, wide_double pinv, long k, long g)
+ {
+ long half_gm1 = (g + ((g & 1) ? 0 : p) - 1) / 2; // (g-1)/2 mod p
+ long g_to_jm1 = 1;
+ long g_to_km1 = PowerMod(g, k-1, p, pinv);
+ long g_to_km1_to_j = g_to_km1;
+ long sum = 0;
+- double g_pinv = ((double) g) / ((double) p);
++ wide_double g_pinv = wide_double(g) / wide_double(p);
+ mulmod_precon_t g_to_km1_pinv = PrepMulModPrecon(g_to_km1, p, pinv);
+
+ for (long j = 1; j <= (p-1)/2; j++)
+@@ -224,7 +224,7 @@ public:
+ #error Number of bits in a long must be divisible by TABLE_LG_SIZE
+ #endif
+
+-long bernsum_pow2(long p, double pinv, long k, long g, long n)
++long bernsum_pow2(long p, wide_double pinv, long k, long g, long n)
+ {
+ // In the main summation loop we accumulate data into the _tables_ array;
+ // tables[y][z] contributes to the final answer with a weight of
+@@ -481,7 +481,7 @@ long PrepRedc(long n)
+ (See bernsum_pow2() for code comments; we only add comments here where
+ something is different from bernsum_pow2())
+ */
+-long bernsum_pow2_redc(long p, double pinv, long k, long g, long n)
++long bernsum_pow2_redc(long p, wide_double pinv, long k, long g, long n)
+ {
+ long pinv2 = PrepRedc(p);
+ long F = (1L << (ULONG_BITS/2)) % p;
+@@ -655,7 +655,7 @@ long bernsum_pow2_redc(long p, double pi
+
+ Algorithm: uses bernsum_powg() to compute the main sum.
+ */
+-long _bern_modp_powg(long p, double pinv, long k)
++long _bern_modp_powg(long p, wide_double pinv, long k)
+ {
+ Factorisation F(p-1);
+ long g = primitive_root(p, pinv, F);
+@@ -685,7 +685,7 @@ long _bern_modp_powg(long p, double pinv
+ Algorithm: uses bernsum_pow2() (or bernsum_pow2_redc() if p is small
+ enough) to compute the main sum.
+ */
+-long _bern_modp_pow2(long p, double pinv, long k)
++long _bern_modp_pow2(long p, wide_double pinv, long k)
+ {
+ Factorisation F(p-1);
+ long g = primitive_root(p, pinv, F);
+@@ -717,7 +717,7 @@ long _bern_modp_pow2(long p, double pinv
+ 2 <= k <= p-3, k even
+ pinv = 1 / ((double) p)
+ */
+-long _bern_modp(long p, double pinv, long k)
++long _bern_modp(long p, wide_double pinv, long k)
+ {
+ if (PowerMod(2, k, p, pinv) != 1)
+ // 2^k != 1 mod p, so we use the faster version
+@@ -765,7 +765,7 @@ long bern_modp(long p, long k)
+ if (m == 0)
+ return -1;
+
+- double pinv = 1 / ((double) p);
++ wide_double pinv = wide_double(1) / wide_double (p);
+ long x = _bern_modp(p, pinv, m); // = B_m/m mod p
+ return MulMod(x, k, p, pinv);
+ }
+--- ./src/sage/rings/bernmm/bern_modp.h.orig 2015-02-16 17:15:12.000000000 -0700
++++ ./src/sage/rings/bernmm/bern_modp.h 2015-05-09 08:06:39.732529882 -0600
+@@ -12,6 +12,7 @@
+ #ifndef BERNMM_BERN_MODP_H
+ #define BERNMM_BERN_MODP_H
+
++#include <NTL/ZZ.h>
+
+ namespace bernmm {
+
+@@ -29,8 +30,8 @@ long bern_modp(long p, long k);
+ /*
+ Exported for testing.
+ */
+-long _bern_modp_powg(long p, double pinv, long k);
+-long _bern_modp_pow2(long p, double pinv, long k);
++long _bern_modp_powg(long p, NTL::wide_double pinv, long k);
++long _bern_modp_pow2(long p, NTL::wide_double pinv, long k);
+
+
+ };
+--- ./src/sage/rings/bernmm/bern_modp_util.cpp.orig 2015-02-16 17:15:12.000000000 -0700
++++ ./src/sage/rings/bernmm/bern_modp_util.cpp 2015-05-07 21:38:06.662182003 -0600
+@@ -20,7 +20,7 @@ NTL_CLIENT;
+ namespace bernmm {
+
+
+-long PowerMod(long a, long ee, long n, double ninv)
++long PowerMod(long a, long ee, long n, wide_double ninv)
+ {
+ long x, y;
+
+@@ -89,7 +89,7 @@ PrimeTable::PrimeTable(long bound)
+ }
+
+
+-long order(long x, long p, double pinv, const Factorisation& F)
++long order(long x, long p, wide_double pinv, const Factorisation& F)
+ {
+ // in the loop below, m is always some multiple of the order of x
+ long m = p - 1;
+@@ -113,7 +113,7 @@ long order(long x, long p, double pinv,
+
+
+
+-long primitive_root(long p, double pinv, const Factorisation& F)
++long primitive_root(long p, wide_double pinv, const Factorisation& F)
+ {
+ if (p == 2)
+ return 1;
+--- ./src/sage/rings/bernmm/bern_modp_util.h.orig 2015-02-16 17:15:12.000000000 -0700
++++ ./src/sage/rings/bernmm/bern_modp_util.h 2015-05-09 08:58:22.618458475 -0600
+@@ -17,6 +17,7 @@
+ #include <vector>
+ #include <cassert>
+ #include <climits>
++#include <NTL/ZZ.h>
+
+
+ #if ULONG_MAX == 4294967295U
+@@ -39,7 +40,7 @@ namespace bernmm {
+
+ (Implementation is adapted from ZZ.c in NTL 5.4.1.)
+ */
+-long PowerMod(long a, long ee, long n, double ninv);
++long PowerMod(long a, long ee, long n, NTL::wide_double ninv);
+
+
+ /*
+@@ -123,13 +124,13 @@ long next_prime(long p);
+ /*
+ Computes order of x mod p, given the factorisation F of p-1.
+ */
+-long order(long x, long p, double pinv, const Factorisation& F);
++long order(long x, long p, NTL::wide_double pinv, const Factorisation& F);
+
+
+ /*
+ Finds the smallest primitive root mod p, given the factorisation F of p-1.
+ */
+-long primitive_root(long p, double pinv, const Factorisation& F);
++long primitive_root(long p, NTL::wide_double pinv, const Factorisation& F);
+
+
+ }; // end namespace
diff --git a/package.patch b/package.patch
new file mode 100644
index 000000000000..08ab8a8bde66
--- /dev/null
+++ b/package.patch
@@ -0,0 +1,11 @@
+--- src/sage/misc/package.py.orig 2014-11-23 15:58:13.000000000 +0100
++++ src/sage/misc/package.py 2015-01-22 20:32:25.651383902 +0100
+@@ -194,7 +194,7 @@
+ sage: is_package_installed('sage')
+ True
+ """
+- return any(p.startswith(package) for p in install_package())
++ return True
+
+ def standard_packages():
+ """
diff --git a/paths.patch b/paths.patch
new file mode 100644
index 000000000000..4691c8af94ef
--- /dev/null
+++ b/paths.patch
@@ -0,0 +1,33 @@
+--- src/sage/env.py.orig 2014-06-25 10:47:25.827203554 +1200
++++ src/sage/env.py 2014-06-25 10:49:07.667402821 +1200
+@@ -86,21 +86,18 @@
+ _add_variable_or_fallback('LOCAL_IDENTIFIER','$HOSTNAME.%s'%os.getpid())
+
+ # bunch of sage directories and files
+-_add_variable_or_fallback('SAGE_ROOT', None)
+-_add_variable_or_fallback('SAGE_LOCAL', opj('$SAGE_ROOT', 'local'))
+-_add_variable_or_fallback('SAGE_ETC', opj('$SAGE_LOCAL', 'etc'))
+-_add_variable_or_fallback('SAGE_SHARE', opj('$SAGE_LOCAL', 'share'))
++_add_variable_or_fallback('SAGE_ROOT', '/usr')
++_add_variable_or_fallback('SAGE_LOCAL', '/usr')
++_add_variable_or_fallback('SAGE_ETC', '/etc/sage')
++_add_variable_or_fallback('SAGE_SHARE', opj('$SAGE_LOCAL', 'share', 'sage'))
+
+ _add_variable_or_fallback('SAGE_SRC', opj('$SAGE_ROOT', 'src'))
+-_add_variable_or_fallback('SITE_PACKAGES', site.getsitepackages())
++_add_variable_or_fallback('SITE_PACKAGES', site.getsitepackages()+['/usr/lib/sage/site-packages'])
+ _add_variable_or_fallback('SAGE_LIB', SITE_PACKAGES[0])
+
+-_add_variable_or_fallback('SAGE_EXTCODE', opj('$SAGE_SHARE', 'sage', 'ext'))
+-_add_variable_or_fallback('SAGE_LOGS', opj('$SAGE_ROOT', 'logs', 'pkgs'))
+-_add_variable_or_fallback('SAGE_SPKG_INST', opj('$SAGE_LOCAL', 'var', 'lib', 'sage', 'installed'))
+-_add_variable_or_fallback('SAGE_DOC', opj('$SAGE_SRC', 'doc'))
+-_add_variable_or_fallback('DOT_SAGE', opj(os.environ.get('HOME','$SAGE_ROOT'), '.sage'))
+-_add_variable_or_fallback('SAGE_DOT_GIT', opj('$SAGE_ROOT', '.git'))
++_add_variable_or_fallback('SAGE_EXTCODE', opj('$SAGE_SHARE', 'ext'))
++_add_variable_or_fallback('SAGE_DOC', '/usr/share/doc/sage')
++_add_variable_or_fallback('DOT_SAGE', opj(os.environ.get('HOME'), '.sage'))
+ _add_variable_or_fallback('SAGE_DISTFILES', opj('$SAGE_ROOT', 'upstream'))
+
+ # misc
+
diff --git a/pexpect-del.patch b/pexpect-del.patch
new file mode 100644
index 000000000000..3019968d2fc5
--- /dev/null
+++ b/pexpect-del.patch
@@ -0,0 +1,15 @@
+diff -ru src/pexpect.py src.del/pexpect.py
+--- src/pexpect.py 2005-11-17 15:36:09.000000000 +0100
++++ src.del/pexpect.py 2012-01-13 10:24:01.000000000 +0100
+@@ -341,7 +341,10 @@
+ """
+ if self.closed:
+ return
+- self.close()
++ try:
++ self.close()
++ except:
++ pass
+
+ def __str__(self):
+ """This returns the current state of the pexpect object as a string.
diff --git a/pexpect-env.patch b/pexpect-env.patch
new file mode 100644
index 000000000000..99cf44885b9c
--- /dev/null
+++ b/pexpect-env.patch
@@ -0,0 +1,32 @@
+diff -ru src.p4/pexpect.py src.new/pexpect.py
+--- src.p4/pexpect.py 2009-01-23 11:01:57.000000000 +0100
++++ src.new/pexpect.py 2012-01-12 13:38:06.000000000 +0100
+@@ -209,7 +209,7 @@
+ Use this class to start and control child applications.
+ """
+
+- def __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None):
++ def __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None, env=None):
+ """This is the constructor. The command parameter may be a string
+ that includes a command and any arguments to the command. For example:
+ p = pexpect.spawn ('/usr/bin/ftp')
+@@ -302,6 +302,7 @@
+ self.child_fd = -1 # initially closed
+ self.timeout = timeout
+ self.delimiter = EOF
++ self.env = env
+ self.logfile = logfile
+ self.maxread = maxread # Max bytes to read at one time into buffer.
+ self.buffer = '' # This is the read buffer. See maxread.
+@@ -421,7 +422,10 @@
+ # (specifically, Tomcat).
+ signal.signal(signal.SIGHUP, signal.SIG_IGN)
+
+- os.execv(self.command, self.args)
++ if self.env is None:
++ os.execv(self.command, self.args)
++ else:
++ os.execve(self.command, self.args, self.env)
+
+ # Parent
+ self.terminated = 0
diff --git a/skip-check.patch b/skip-check.patch
new file mode 100644
index 000000000000..dae5f7277312
--- /dev/null
+++ b/skip-check.patch
@@ -0,0 +1,21 @@
+--- src/bin/sage.orig 2014-12-18 09:47:27.354829070 +0100
++++ src/bin/sage 2014-12-18 09:48:00.041563401 +0100
+@@ -286,18 +286,6 @@
+
+ # Prepare for running Sage, either interactively or non-interactively.
+ sage_setup() {
+- # Check that we're not in a source tarball which hasn't been built yet (#13561).
+- if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
+- echo >&2 '************************************************************************'
+- echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
+- echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
+- echo >&2 'finished). You should run `make` in the Sage root directory first.'
+- echo >&2 'If you did not intend to build Sage from source, you should download'
+- echo >&2 'a binary tarball instead. Read README.txt for more information.'
+- echo >&2 '************************************************************************'
+- exit 1
+- fi
+-
+ # Display the startup banner
+ if [ "$SAGE_BANNER" != "no" ]; then
+ cat "$SAGE_LOCAL/bin/sage-banner"