Some people within DebianScience would like to package again Sage for Debian. An old version of Sage got packaged long time ago by Tim Abbott, but, because of lack of maintainance, it became totally unusable and was removed from Debian. The status pages (master branch, develop branch) give an overview about package versions in Sage and Debian. If you want to help out, pick one of the open tasks or issues below and get going. Or contact us via the mailing list or in #debianscience on irc.oftc.net.
Building Sage with Debian packages
We have a git repository (sagemath) to document the steps we currently do to experiment with building Sage against Debian packages. Important elements are the build dependencies of Sage, patches for Sage and a script called "pruner" that uses automake to determine if the necessary packages are installed (see also this mail).
To set up your system for working with our repo:
for d in deb debsrc; do \ 
Add our unstablesage repo for patched dependencies. This is optional; if you prefer you can build these yourself from the instructions in the table below. 
torsocks gpg2 recvkeys 0xD1188AF4A1398A5FCC3F576654B3F967097676A0 
Get the repo key. 
gpg2 export 0xD1188AF4A1398A5FCC3F576654B3F967097676A0  sudo aptkey add  
Install the repo key. 
printf "Package: *\nPin: release n=sidsage\nPinPriority: 100\n" \ 
Pin our repo at a low priority so it doesn't mess with the rest of your system. OTOH, if you really really want this repo's packages, to make sure you get the latest and greatest efforts of the Debian Sage packaging team above all else (including maybe our patched dependency packages messing up your system) then you can set the PinPriority to a high number like 800. 
git clone recursive https://anonscm.debian.org/git/debianscience/packages/sagemath.git 
Recursive git clone to also get sage which is included as a git submodule. 
To build the package, run:
sudo mkbuilddeps install debian/control 
Install build dependencies that are in unstable and unstablesage. 
quilt push a 
Apply patches to Sage. 
debian/rules prune 
Run the pruner script. 
debian/rules build 
Build sage and run the test suite (includes pruning if necessary, but not patching). 
The output of the pruner tells you in the end which dependencies were not found on the machine. These will be downloaded and built in the build step, before Sage itself is built. In the moment the pruner should output something like the following, and it is for now recommended to use these three packages from Sage.
libgap will not come from debian! singular will not come from debian! jmol will not come from debian! 100 system packages will be used
When building against our patched packages, the compilation of Sage 6.7 finishes, but building the documentation fails due to our outdated ipython version. To get around this one can uninstall the ipython Debian package. Then Sage will build and use its own version. (TODO: this information is outofdate, update it)
The following commands clean everything up properly.
debian/rules clean 
Clean up after prune and build. 
quilt pop a 
Unapply patches. 
cd sage && git clean dfx 
Clean sage folder (git does not show untracked files from the built due to .gitignore). 
rm rf ~/.local/lib/python2.7/sitepackages/sage* 
Remove sage python library that is installed during the build process. 
Open tasks
Package 
Bug / Link 
Assigned 
Comments 
Packages we have patched, needs merging into official Debian packages: 


singular 3.1.6 is packaged in debianscience's git and Sage >= 6.2 has also 3.1.6. Singular 4.0.3 is now in Debian but unfortunately its API is restructured from 3.1.7 and the latter is what Sage are using. We may have to package singular 3 separately for now, or wait for Sage upstream to migrate. 









Must be rebuilt against our patched pari. 



Must be rebuilt against our patched pari; use the branch pari2.8 



0.22 needs to be patched with with embedsignatures.patch and includes.patch from here 



with the workaround described in 777473 

Sage components that need a new maintainer and an upload to Debian: 



All dependencies are in Debian now, except for 787311 which is in the NEW queue. However the current sagenb package ships a bunch of javascript libraries. It should use at least these Debian packages instead: mathjax, tinymce, jquery, jqueryui, codemirror 

sagetex 



Packages that need a new maintainer and an upload to Debian: 

jmol 


There is a request for help, see 719330 
libgap 


Can maybe be replaced by a wrapper for GAP. 
pexpect2.0 


(outofdate; Debian now ships v4): Debian ships version 2.4, but Sage requires version 2.0 (though one of the necessary patches is already in 2.4). Plotting in the notebook is likely to break with newer versions that are in Debian; and >2.0 is reported to be slow. There is a new upstream version so Sage might update, see this sage bug. 
Packages that are (hopefully) not needed: 

cephes 


The Cephes Mathematical Library is only needed for systems where the libc doesn't provide appropriate mathematical functions (cygwin and FreeBSD) and so is not required for Debian. 
iconv 


is part of the libc 

mpir is supposed to be ABIcompatible with gmp. A lot of math packages use gmp and we hope we can have a purely gmp based Sage in Debian. Combining the two will most likely lead to conflicts, using mpir we would need an extra mpir version of many packages. 
Uploading patched packages
We've set up a minidinstall APT repo to upload our patched Debian packages to, so that we can build sage against these. This is a temporary measure to make everything work more quickly, and these patched packages are unlikely to be added to Debian officially.
To upload, you must be a member of the debianscience group on alioth. Then, you should add this to your ~/.dput.cf:
[debscisage] method = scp fqdn = alioth.debian.org incoming = /home/groups/debianscience/htdocs/apt/minidinstall/incoming/ post_upload_command = ssh alioth.debian.org /home/groups/debianscience/minidinstall
minidinstall is pretty forgiving and you should be able to overwrite any existing version in this repo or even downgrade versions. However, you *must* set the distribution in debian/changelog to "sidsage" or "unstablesage", otherwise your package will get rejected.
Links
Older information
Outofdate autotoolsbased build system for Sage
(This is slightly out of date, also, Sage (the community) is not interested in using packages that another distribution provides.)
The Sage library is getting an autotools build system in the course of a Google Summer of Code project. With the new build system, it can be built against system libraries. There are tarballs with the code at http://tool.em.cs.unifrankfurt.de/~felix/sage/. (There is also a git repository but the tarballs are recommended). Note that this is work in progress and problems are expected, but we are happy about testers. The transition of this work into Sage is coordinated via a bunch of Sage tickets.
We have a Debian package sagelib that currently builds metapackages that help installing the build dependencies of Sage. To test building Sage against Debian packages, one should consult the control file. The dependencies of the metapackage sagelibbuilddepsgit still need special treatment and can't be just installed from Debian. See also http://tool.em.cs.unifrankfurt.de/~felix/sagelib/.
The following Debian packages should be installed from the git repositories:
For the remaining packages where the Debian package is missing or is missing features required by Sage, it is currently most convenient to use the versions from Sage. This is done by configuring with
../configure \ disableall \ enable{boehm_gc,cython,ecl,flintqs,genus2reduction,maxima,pari,pexpect,pynac,rubiks,sagelib,sagetex,tachyon} \ withgmp
Old sagemath package
The old, buggy sagemath Debian package source code is available at http://snapshot.debian.org/package/sagemath/3.0.5dfsg5.1/