sagemath / sage-windows

Build tools for the Sagemath Windows installer
350 stars 47 forks source link

How should the Makefile itself be run? #54

Closed ChrisJefferson closed 3 years ago

ChrisJefferson commented 3 years ago

This is probably a small / obvious thing, but I wasn't sure in what system to run the Makefile (cygwin? mingw? I'd guess another Cygwin, but wasn't sure if that would confuse things).

I thought it might be worth adding to the readme, just so people know how to get started.

embray commented 3 years ago

Hi @ChrisJefferson , I saw your e-mail too, so I'll just answer here. Indeed I should write more actual documentation for this build system some day...

Yes, it is intended to be run in a Cygwin install. Typically just the same Cygwin I do normal development in, or the Cygwin installed on an automated build machine, etc.

What the Makefile does then is it makes two more Cygwin installations: One in which to build Sage, which has all the build dependencies. Then a separate one that has just the minimal runtime dependencies, into which the build is copied. (In practice, for the case of Sage, the difference between the two environments has become almost nil, since in fact many Sage features, such as the ability to compile Cython functions from within Sage, require a lot of the build dependencies to be installed anyways).

The Makefile uses the script subcyg for running programs in one of the other Cygwin environments and interacting with them.

Regarding the symlinks issue, as I think you found, the Makefile runs the script fixup-symlinks which goes through the "runtime" environment and converts all symlinks to .lnk files. Then the InnoSetup script has a FixupSymlinks procedure that is run as a post-install step, which applies the necessary DOS flags for Cygwin to recognize them as symlinks.

Actually, this code has been in use for a long time, and only had to be changed once Cygwin stopped having a way to make "magic cookie" symlinks; I just mention this because even though it's ugly it seems to have solved the problem pretty reliably.

It wasn't clear from your e-mail if this was your intent, but it would be interesting to try to adapt this Makefile to be more generic, such that it could also be used, e.g., to build a GAP installer. A lot of it is not really specific to Sage, and those parts could be factored out. LMK if you want to work on that.

ChrisJefferson commented 3 years ago

I have been generally using parts of this, mostly to understand how it all works. I think it would be interesting to try to make a common repository.

I'm doing some things a little differently (for example my script to run things in a child cygwin is a .bat script), but that's because it didn't occur to me to try running "cygwin in cygwin". Now I better understand how things work, I might try starting by making a branch of this repository, and see how many changes I have to make.

embray commented 3 years ago

I think we can go ahead and close this, and continue discussion in #56.