Created attachment 369010 [details, diff] Suggested modifications. Sage uses the ecls build of maxima in an embedded fashion. With the current build system, this leads to infinite loops, as discussed in some detail at https://github.com/cschwan/sage-on-gentoo/issues/226#issuecomment-19073854 and subsequent comments. The core issue seems to be the way in which this library version of maxima is built. It seems to cause double initialization of some data structures, which in turn violates assumptions and causes broken behavior. Although sage is perhaps the most likely way to observe this problem, https://github.com/cschwan/sage-on-gentoo/issues/226#issuecomment-19081539 indicates that a simple "(require 'maxima)" on the ecl command line will reproduce the problem, which manifests as a segmentation fault. I suggest a new approach, which works well enough on my system with various versions of sage and maxima, and which has been used by sage-on-gentoo for some time now so I consider it rather mature. The key idea is to extend the ecls-0.patch (thus creating ecls-1.patch in the process) in such a way that it duplicates the lines about c::build-program into a preceding c::build-fasl call. That will ensure that a library is built at compile time, thus making most of the build instructions currently executed at install time obsolete. What is more, it works nicely without the issues currently observed when loading the file. In the attached diff, notice that this compares the existing ecls-0.patch with a new ecls-1.patch which would have to be created. So it might be best to copy ecls-0.patch to ecls-1.patch then apply the diff. You might also consider revbumping maxima, but the diff does not include a revision in the ebuild name.
*maxima-5.32.1-r1 (29 Jan 2014) 29 Jan 2014; Andrey Grozin <grozin@gentoo.org> +maxima-5.32.1-r1.ebuild, +files/ecls-1.patch: Fix the library version of the ecls maxima needed by sage (bug #499634), thanks to Martin von Gagern <Martin.vGagern@gmx.net>