Adding Mercurial patches before building Sage
The following problem and accompanying solution were posted to sage-devel. I have polished them up a bit and put them here so they won’t be buried in the huge sage-devel mailing list.
- Build a Sage source distribution.
- Apply your patches to the Sage library.
- Produce a new source tarball based on your patched Sage source distribution.
- Compile your newly wrapped up modified Sage source tarball.
The key problem is that you don’t want to run through two separate compilation processes.
The following solution uses the queues extension of Mercurial. In a Sage source tarball, the Sage library is wrapped up as the package
Uncompress that bzip2 compressed tarball to get a directory named
If you want, you could delete
Now patch the Sage library as if it had been built and found under SAGE_ROOT/devel:
$ cd SAGE_ROOT/spkg/standard/sage-x.y.z/ $ hg qimport /URL/or/path/to/patch.patch $ hg qpush $ <repeat-previous-two-commands-as-often-as-required>
$ hg qapplied
should return a list of patches you have applied using “hg qpush“. Once you are happy that you have applied all necessary patches, wrap up the patched Sage library:
$ pwd SAGE_ROOT/spkg/standard/sage-x.y.z/ $ hg qfinish -a $ cd ..
Now you should have
so you could delete
Finally, proceed to build Sage from source.