Compiling from source with Zero Install
I'm still undecided about how to handle compiling from source with the injector. There are two models I'm considering:
- Each binary interface has a corresponding source interface. Executing a source interface creates a binary package, which can then be added to the binary interface's list of implementations.
- Source is another type of architecture (probably a low-priority one). So, the injector will pick a binary archive for your platform if one exists, or a source archive if one doesn't. Executing a source implementation still runs it, but it just takes longer the first time (sorry, can't remember who suggested this method).
The second one is more automatic in some ways and only requires one interface. On the other hand, it makes it less explicit that a binary archive is being created (that's just a side-effect) so how to create binaries is less obvious. Also, the build-dependencies get mixed in with the execution dependencies.
With the first model things are more explicit. E.g.:
$ 0launch http://site/MyProg-src [ choose version of MyProg and a version of each build dependency ] Compiling in [somewhere]/MyProg-build-tmp Adding local feed [somewhere]/MyProg-build-result/MyProg.xml to http://site/MyProg $ 0launch http://site/MyProg [ new binary runs ]
A window pops up asking you to choose a version of MyProg-src to compile, along with version of gtk-devel, gcc, and anything else needed during the compile. The binary that appears as the result of this doesn't require the GTK headers or the C compiler, but has its own requirements.
Of course, we would have a '--source' flag to automatically find and run the source for a given binary interface.
Some issues to resolve:
- Does the source go in the cache like everything else? In Debian, apt-get source works differently to apt-get install: it just downloads a copy to the current directory without storing it anywhere or requiring root access. Of course, Zero Install doesn't require root access anyway so maybe storing it in the cache is OK.
- How can you edit the source? If it's in the cache, you'll have to make a copy first. Is this the common case, or is compiling an unmodified version the common case? For unmodified versions, it would be better to build straight from the cache, even though it makes the build system a little more complicated.
- Where are 'temporary' files stored? Where is the final binary archive placed? In the current directory?
- What happens after the build? Do the object files hang around in case you want to change something and recompile, or do they get deleted automatically? This comes back to the question of why you are compiling (because no binary is available, or because you wanted to change something).