Hi anyone interested in Sage (the distribution's) build system,

I have a ticket that's been languishing for months now which makes
some significant overhauls to how Sage's build/make/Makefile is
generated and structured: https://trac.sagemath.org/ticket/21524
I know we're all very busy and that it's a difficult patch to
evaluate, so I haven't been too pushy about trying to get eyes on it.

But I've been doing some new work (rather successful so far) to
implement a general method for how I can easily add configure-time
checks to use system packages for more of Sage's dependencies, and
I've been doing this work on top of #21524.  So if I want to proceed
any further with that work I think progress is needed on this ticket.

The basic issue is that Sage's old configure.ac contains code in it
for directly writing the Makefile, rather than using a template (a
Makefile.in) per the usual autoconf pattern.  Of course, the fact that
we weren't doing that isn't *wrong*--after all there's nothing else
very "standard" about Sage's Makefile--so there was some question as
to why this was worth doing at all.  I think my approach to fixing the
issue answers that question: I think the resulting Makefile, and its
template, are easier to understand for one. And the resulting
configure script runs *much* faster. Especially on Cygwin where it has
always been painfully slow, but the speedup is even noticeable on a
fast Linux machine.

To summarize what this ticket changed:

1) The configure.ac template does not contain code that directly
writes the Makefile.  Instead, it loops *once* over all the packages
in build/pkgs, classifies them into various categories, and generates
some variables that are easily consumed by make (e.g. a list of
standard packages, and variables containing each package's
dependencies).

2) These variables are then inserted into a Makefile template
(Makefile.in) by config.status, at the end of running the configure
script, via the standard AC_OUTPUT mechanism.

3) Unlike the old Makefile, neither the new Makefile nor the template
it is generated from contain explicit rules for building each package.
As a result it's actually quite a bit shorter.  Instead it uses
relatively advanced features of GNU make (but easy to understand, I
think, especially with the inline comments I've added)--it uses the
variables substituted into the Makefile.in by configure along with
some simple templates and foreach/eval loops to generate the build and
clean rules for each package.

The result is a more compact Makefile that, for the most part, just
contains some variables with information about the individual
packages, and some templates for generating rules for the packages.

Most other parts of the Makefile, such as those included from
build/make/deps, remain mostly unchanged for now.

The resulting configure script is also much faster, as it only loops
over the packages once and performs some relatively simple checks,
since it has much less text to generate.  The old configure had a
shell function in it called filtered_packages_list that would loop
over all the packages and filter them according to some criteria, and
the old configure script called this four or five times, which was
responsible for much of the slowness.  The new script loops over the
packages only once to generate the variables needed by the Makefile.

Hopefully this makes sense, and will be of interest to someone.  I'm
not 100% married to all the details of my current approach, but I
think the general approach is much cleaner and, as I've noted, faster.

Best,
E

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to